Compare commits

..

16 Commits

Author SHA1 Message Date
wenlong 0a9151eb3c 市况汇率更新 2024-08-22 00:32:58 +08:00
wenlong ccdf3b458f 市况汇率 2024-08-18 11:48:30 +08:00
wenlong 9384b096b2 市况汇率 2024-08-06 00:34:35 +08:00
wenlong b4f9d35de0 市况汇率 2024-08-06 00:28:06 +08:00
wwl b47fce05ca fix bugs 2024-08-02 10:16:24 +08:00
wwl a3d6077599 首页/cd 2024-07-31 14:19:42 +08:00
wwl 7b8c17de6f fix bugs 2024-07-22 13:14:24 +08:00
wwl 479c2d497c cd页面更新 2024-07-16 09:42:05 +08:00
wwl f48e39b7f6 首页菜单加下拉按钮 2024-06-27 11:30:16 +08:00
wwl f54f7e1608 新增置顶和定时发布功能,其他优化 2024-06-13 17:46:47 +08:00
wwl 06d4d33eb5 fix bug 2024-05-22 15:07:11 +08:00
wwl cdc9fff2d9 fix bug 2024-05-21 10:10:16 +08:00
wwl 405b215bf5 fix bug 2024-05-11 17:19:42 +08:00
wwl d233857ce2 fix bug 2024-05-08 13:41:28 +08:00
wwl 21a629b4fb fix bug 2024-05-05 21:57:08 +08:00
wwl 3734a770dd fix bug 2024-04-24 11:11:04 +08:00
77 changed files with 19333 additions and 11330 deletions

3
components.d.ts vendored
View File

@ -33,12 +33,15 @@ declare module 'vue' {
ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElProgress: typeof import('element-plus/es')['ElProgress']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRow: typeof import('element-plus/es')['ElRow']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']

View File

@ -1050,6 +1050,19 @@ export async function marketPreADD(data: any) {
export async function badartAdd(data: any) {
return http.post(`/quality/badartAdd`, data)
}
/**---
*
* http://127.0.0.1:8811/openApi/quality/badartAdd
*/
export async function badartAddUser(data: any) {
return http.post(`/quality/addUser`, data)
}
/**-
* http://127.0.0.1:8811/openApi/quality/badartDel?id=3
*/
export async function badartGetUser(params: { indexId: any }) {
return http.get(`/quality/getUser`, { params })
}
/**-
* http://127.0.0.1:8811/openApi/quality/badartDel?id=3
*/
@ -1404,3 +1417,104 @@ export async function fetchPostList(params?: any) {
export async function fetchInternalUserStat(params?: any) {
return http.get(`/moduleStat/internalUserStat`, { params })
}
// CD-三个据点总发注金额饼状图
export async function fetchPartStatisRate(params?: any) {
return http.get(`/cdcontent/partStatisRate`, { params })
}
// CD-三据点历年发注金额
export async function fetchPartHisList(params?: any) {
return http.get(`/cdcontent/partHisList`, { params })
}
// CD-小业种发注金额
export async function fetchPartminBusSeedsRate(params?: any) {
return http.get(`/cdcontent/partminBusSeedsRate`, { params })
}
// CD-大业种发注金额
export async function fetchPartmaxBusSeedsRate(params?: any) {
return http.get(`/cdcontent/partmaxBusSeedsRate`, { params })
}
// CD-图表2-大业种发注金额
export async function fetchPartmaxBusSeedsDetailList(params?: any) {
return http.get(`/cdcontent/maxBusSeedsDetailList`, { params })
}
// CD-图表2-大业种发注金额供应商
export async function fetchPartmaxBusSeedsRateBySupplier(params?: any) {
return http.get(`/cdcontent/partmaxBusSeedsRateBySupplier`, { params })
}
// smm首页数据
export async function fetchHomeSmmExInfo(params?: any) {
return http.get(`/marketPre/homeSmmExInfo`, { params })
}
// smm/lme 分类数据
export async function fetchExchangeInfo(params?: any) {
return http.get(`/marketPre/getExchangeInfo`, { params })
}
// 获取分时数据 --沪铜主连
export async function fetchTimeFuturecenterCu(params?: any) {
return http.get(`/marketPre/getTimeFuturecenter/${params.type}`)
}
// 获取分时数据 --沪铜主连
export async function fetchTimeFuturecenterAl(params?: any) {
return http.get(`/marketPre/getTimeFuturecenter/${params.type}`)
}
// 获取SMM/LEM 更新时间
export async function fetchMarketUpdateTime(params?: any) {
return http.get(`/marketPre/getLastTime`, { params })
}
// 查询HP-联络人列表
export async function fetchContactList(params?: any) {
return http.get(`/liaison/list`, { params })
}
// 获取HP-联络人详细信息
export async function fetchContactDetail(id: any = '') {
return http.get(`/liaison/info/${id}`)
}
// 新增HP-联络人
export async function fetchContactAdd(data?: any) {
return http.post(`/liaison/post`, data)
}
// 修改HP-联络人
export async function fetchContactEdit(data?: any) {
return http.post(`/liaison/update`, data)
}
// 删除HP-联络人
export async function fetchContactDel(id: any = '') {
return http.get(`/liaison/${id}`)
}
// 查询HP-年度方针列表
export async function fetchYearPlanList(params?: any) {
return http.get(`/policy/list`, { params })
}
// 获取HP-年度方针详细信息
export async function fetchYearPlanDetail(id: any = '') {
return http.get(`/policy/info/${id}`)
}
// 新增HP-年度方针
export async function fetchYearPlanAdd(data?: any) {
return http.post(`/policy/add`, data)
}
// 修改HP-年度方针
export async function fetchYearPlanEdit(data?: any) {
return http.post(`/policy/update`, data)
}
// 删除HP-年度方针
export async function fetchYearPlanDel(id: any = '') {
return http.get(`/policy/${id}`)
}

View File

@ -12,161 +12,163 @@ const noticeData = ref()
const flgs = ref(false)
const userCode = ref(false)
async function getNoticeList() {
const { data } = await getAllNoticeList()
noticeData.value = data
const { data } = await getAllNoticeList()
noticeData.value = data
}
onMounted(() => {
getNoticeList()
getNoticeList()
// console.log( flgs.value,flg)
// console.log( flgs.value,flg)
})
watchEffect(() => {
// console.log( flgs.value,store.user.type, 'tech_service')
flgs.value = [1, 2, 3, 4].includes(store.user.type)
userCode.value = ['admin', 'tech_service', 'footprint_dandang'].includes(
store.user.roleCode
)
// console.log( flgs.value,store.user.type, 'tech_service')
flgs.value = [1, 2, 3, 4].includes(store.user.type)
userCode.value = ['admin', 'tech_service', 'footprint_dandang'].some((item) =>
store.user.roleCode?.includes(item)
)
})
const options = [
{ label: '个人中心', key: 'ucenter' },
,
{
label: '修改密码',
key: 'ChangePWD',
props: {
onclick: () => {
console.log(route.path)
const pth = route.path === '/external' ? 'modify' : 'modifys'
push({ name: pth })
}
}
},
{
key: 'logout',
label: '退出登录',
props: {
style: { width: '150px' },
onClick: () => {
store.LogOut()
}
}
}
{ label: '个人中心', key: 'ucenter' },
,
{
label: '修改密码',
key: 'ChangePWD',
props: {
onclick: () => {
console.log(route.path)
const pth = route.path === '/external' ? 'modify' : 'modifys'
push({ name: pth })
}
}
},
{
key: 'logout',
label: '退出登录',
props: {
style: { width: '150px' },
onClick: () => {
store.LogOut()
}
}
}
]
const noticeShow = ref(false)
let showIs = false
//id1- 2- 3- 4-BCP 5- 6- 7-LAB
const goModeuls = (obj) => {
const { moduleId } = obj
if (!moduleId) return
switch (moduleId) {
case 1:
if (store.user.isReview === 1 || store.user.isPublish === 1) {
push('/Home/Process')
} else {
push('/Home/intelligence')
}
break
case 2:
push({ name: 'Market' })
break
case 3:
push({ name: 'CD' })
break
case 4:
push({ name: 'BCP' })
break
case 5:
push({ name: 'CSR' })
break
case 6:
push({ name: 'Quality' })
break
case 7:
push({ name: 'Diffspace' })
break
case 9:
push({ name: 'DataBaseReview' })
break
default:
push('/Home/intelligence')
break
}
const { moduleId, type } = obj
if (!moduleId) return
switch (moduleId) {
case 1:
if ((store.user.isReview === 1 || store.user.isPublish === 1) && type == 2) {
push('/Home/Process')
} else {
push('/Home/intelligence')
}
break
case 2:
push({ name: 'Market' })
break
case 3:
push({ name: 'CD' })
break
case 4:
push({ name: 'BCP' })
break
case 5:
push({ name: 'CSR' })
break
case 6:
push({ name: 'Quality' })
break
case 7:
push({ name: 'Diffspace' })
break
case 9:
push({ name: type === 2 ? 'DataBaseReview' : 'DataBase' })
break
default:
push('/Home/intelligence')
break
}
}
const noticeShows = () => {
if (noticeData.value && noticeData.value.length > 0) {
// console.log(noticeData.value)
noticeShow.value = !noticeShow.value
}
if (noticeData.value && noticeData.value.length > 0) {
// console.log(noticeData.value)
noticeShow.value = !noticeShow.value
}
}
const toFootPrint = () => {
console.log(111)
push('/Home/footprint')
console.log(111)
push('/Home/footprint')
}
</script>
<template>
<div class="inline-flex items-center relative">
<!-- 足迹 -->
<!-- <div class="cursor-pointer w-40px h-40px z-200"> -->
<el-icon size="35" v-if="userCode" @click="toFootPrint"
><Platform
/></el-icon>
<!-- </div> -->
<div class="inline-flex items-center relative">
<!-- 足迹 -->
<!-- <div class="cursor-pointer w-40px h-40px z-200"> -->
<el-icon size="35" v-if="userCode" @click="toFootPrint"><Platform /></el-icon>
<!-- </div> -->
<!-- 全屏小图标 -->
<div
size="40"
color="#ccc"
style="font-size: 20px; width: 30px; margin: 10px"
@click="toggle"
class="cursor-pointer"
>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 20 20"
>
<g fill="none">
<path
d="M3.75 3a.75.75 0 0 0-.75.75v3.5a.75.75 0 0 0 1.5 0V5.56l2.22 2.22a.75.75 0 0 0 1.06-1.06L5.56 4.5h1.69a.75.75 0 0 0 0-1.5h-3.5zm0 14a.75.75 0 0 1-.75-.75v-3.5a.75.75 0 0 1 1.5 0v1.69l2.22-2.22a.75.75 0 0 1 1.06 1.06L5.56 15.5h1.69a.75.75 0 0 1 0 1.5h-3.5zM17 3.75a.75.75 0 0 0-.75-.75h-3.5a.75.75 0 0 0 0 1.5h1.69l-2.22 2.22a.75.75 0 0 0 1.06 1.06l2.22-2.22v1.69a.75.75 0 0 0 1.5 0v-3.5zM16.25 17a.75.75 0 0 0 .75-.75v-3.5a.75.75 0 0 0-1.5 0v1.69l-2.22-2.22a.75.75 0 1 0-1.06 1.06l2.22 2.22h-1.69a.75.75 0 0 0 0 1.5h3.5z"
fill="currentColor"
></path>
</g>
</svg>
</div>
<div
v-if="flgs"
class="bg-#fff/20 b-1px b-solid b-#fff rd-12px flex items-center h-52px px12px cursor-pointer"
>
<div size="small" @click="noticeShows">
<img
src="../assets/images/tongzhi@2x.png"
class="w20px mr5px mt--5px"
/><span class="ml8px pl5px pr5px rounded-20px bg-#002FA7">{{
store.user.reviewCount ?? 0
}}</span>
</div>
<!-- 跳转到碳中和页面的 -->
<div class="notice" v-if="noticeShow">
<div
v-for="ite in noticeData"
class="p10px box flex justify-between"
v-if="noticeData"
@click="goModeuls(ite)"
>
<div>{{ ite.moduleName }}</div>
<span class="">{{ ite.moduleCount }}</span>
</div>
</div>
<!-- 全屏小图标 -->
<div
size="40"
color="#ccc"
style="font-size: 20px; width: 30px; margin: 10px"
@click="toggle"
class="cursor-pointer"
>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 20 20"
>
<g fill="none">
<path
d="M3.75 3a.75.75 0 0 0-.75.75v3.5a.75.75 0 0 0 1.5 0V5.56l2.22 2.22a.75.75 0 0 0 1.06-1.06L5.56 4.5h1.69a.75.75 0 0 0 0-1.5h-3.5zm0 14a.75.75 0 0 1-.75-.75v-3.5a.75.75 0 0 1 1.5 0v1.69l2.22-2.22a.75.75 0 0 1 1.06 1.06L5.56 15.5h1.69a.75.75 0 0 1 0 1.5h-3.5zM17 3.75a.75.75 0 0 0-.75-.75h-3.5a.75.75 0 0 0 0 1.5h1.69l-2.22 2.22a.75.75 0 0 0 1.06 1.06l2.22-2.22v1.69a.75.75 0 0 0 1.5 0v-3.5zM16.25 17a.75.75 0 0 0 .75-.75v-3.5a.75.75 0 0 0-1.5 0v1.69l-2.22-2.22a.75.75 0 1 0-1.06 1.06l2.22 2.22h-1.69a.75.75 0 0 0 0 1.5h3.5z"
fill="currentColor"
></path>
</g>
</svg>
</div>
<div
v-if="flgs"
class="bg-#fff/20 b-1px b-solid b-#fff rd-12px flex items-center h-52px px12px cursor-pointer"
>
<div size="small" @click="noticeShows">
<img src="../assets/images/tongzhi@2x.png" class="w20px mr5px mt--5px" />新着通知<span
class="ml8px pl5px pr5px rounded-20px bg-#002FA7"
>{{ store.user.reviewCount ?? 0 }}</span
>
</div>
<!-- 跳转到碳中和页面的 -->
<div class="notice" v-if="noticeShow">
<div
v-for="ite in noticeData"
class="p10px box flex justify-between items-center"
v-if="noticeData"
@click="goModeuls(ite)"
>
<template v-if="ite.type == 1">
<div>{{ ite.moduleName }}</div>
<span class="min-w-70px">未读{{ ite.moduleCount }}</span>
</template>
<template v-if="ite.type == 2">
<div>{{ ite.moduleName }}</div>
<span class="min-w-70px">待审批{{ ite.moduleCount }}</span>
</template>
</div>
</div>
<!-- 跳转到审批页面 -->
<!-- <div size="small">
<!-- 跳转到审批页面 -->
<!-- <div size="small">
新着通知
<span class="ml8px pl5px pr5px rounded-20px bg-#002FA7">{{
store.user.reviewCount ?? 0
}}</span>
</div> -->
<!-- <n-popover :overlap="false" placement="bottom-start" trigger="click">
</div>
<n-popover :overlap="false" placement="bottom-start" trigger="click">
<template #trigger>
<div size="small">
新着通知
@ -174,11 +176,8 @@ const toFootPrint = () => {
store.user.reviewCount ?? 0
}}</span>
</div>
</template> -->
<!-- <div
class="inline-flex items-center p10px cursor-pointer"
v-if="store.user.isReview === 1"
>
</template>
<div class="inline-flex items-center p10px cursor-pointer" v-if="store.user.isReview === 1">
待审核信息{{ store.user.reviewCount ?? 0 }}
<n-button
class="text-#fff bg-#0058E4 rounded-5px p5px pt2px pb2px ml 8px"
@ -206,61 +205,58 @@ const toFootPrint = () => {
@click="push({ path: '/Home/intelligence' })"
>去查看</n-button
>
</div> -->
<!-- </n-popover> -->
</div>
<!-- 当前登录用户信息 -->
<NDropdown show-arrow placement="bottom-end" size="huge" :options="options">
<div class="cursor-pointer inline-flex items-center">
<img
src="@/assets/images/icon-user.svg"
class="ml40px mr16px w60px h60px"
/>
<!-- @click="toggle" -->
<span>{{ store.user.nikeName ?? '游客' }}</span>
<img src="@/assets/images/icon-more.svg" class="ml30px w13px" />
</div>
</NDropdown>
</div>
</div>
</n-popover> -->
</div>
<!-- 当前登录用户信息 -->
<NDropdown show-arrow placement="bottom-end" size="huge" :options="options">
<div class="cursor-pointer inline-flex items-center">
<img src="@/assets/images/icon-user.svg" class="ml40px mr16px w60px h60px" />
<!-- @click="toggle" -->
<span>{{ store.user.nikeName ?? '游客' }}</span>
<img src="@/assets/images/icon-more.svg" class="ml30px w13px" />
</div>
</NDropdown>
</div>
</template>
<style scoped lang="less">
.notice {
position: absolute;
top: 52px;
left: -3px;
width: 200px;
background: rgb(255, 255, 255);
max-height: 520px;
z-index: 500;
font-size: 18px;
border-radius: 15px;
padding: 10px;
color: rgb(26, 25, 25);
box-shadow: 1px 1px 5px 1px #d9d5d5;
.box:hover {
background: #e5e5e5;
border-radius: 5px;
color: #1836c3;
position: absolute;
top: 52px;
left: -3px;
min-width: 240px;
background: rgb(255, 255, 255);
max-height: 520px;
z-index: 500;
font-size: 18px;
border-radius: 15px;
padding: 10px;
color: rgb(26, 25, 25);
box-shadow: 1px 1px 5px 1px #d9d5d5;
.box:hover {
background: #e5e5e5;
border-radius: 5px;
color: #1836c3;
span {
color: #ffffff;
background: red;
}
}
span {
color: #ffffff;
background: red;
}
}
span {
color: #1836c3;
padding: 2px 7px;
border-radius: 50px;
}
span {
color: #1836c3;
padding: 2px 7px;
border-radius: 50px;
}
}
.popover-grid {
display: grid;
grid-template-columns: auto auto auto auto auto;
grid-gap: 12px;
justify-content: center;
align-items: center;
display: grid;
grid-template-columns: auto auto auto auto auto;
grid-gap: 12px;
justify-content: center;
align-items: center;
}
</style>

View File

@ -18,9 +18,9 @@ const props = defineProps({
<img
v-if="isNotOneWeekAgo(publishTime) && labelText !== '紧急'"
src="../assets/images/NEW3.gif"
:class="size || []"
:class="'h20px'"
/>
<img v-if="labelText === ''" src="../assets/images/jj.gif" :class="size || []" />
<img v-if="labelText === ''" src="../assets/images/jj.gif" :class="'h30px'" />
<span :style="isRead === 2 ? 'color:#0058E5;font-weight:800' : ''">{{ text }}</span>
<!-- <span class="invisible">{{ date }}</span> -->
</div>

View File

@ -1,22 +1,21 @@
import { createApp } from "vue";
import { createPinia } from "pinia";
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ECharts from 'vue-echarts'
import App from "./App.vue";
import router from "./router";
import "./styles/smallDog.css"
import "./styles/main.css";
import "uno.css";
import "animate.css"; // https://animate.style/
import App from './App.vue'
import router from './router'
import './styles/smallDog.css'
import './styles/main.css'
import 'uno.css'
import 'animate.css' // https://animate.style/
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
const app = createApp(App);
const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)
}
app.component('VChart',ECharts)
app.use(createPinia());
app.use(router);
app.component(key, component)
}
app.component('VChart', ECharts)
app.use(createPinia())
app.use(router)
app.mount("#app");
app.mount('#app')

View File

@ -80,16 +80,16 @@ const router = createRouter({
name: 'DetailInfos',
component: () => import('@/views/extermal/Article/Details.vue')
},
{
path: '/external/Board',
name: 'BoardlInfo',
component: () => import('@/views/extermal/Board/index.vue')
},
{
path: '/external/Process',
name: 'Process1',
component: () => import('@/views/extermal/Process/index.vue')
},
// {
// path: '/external/Board',
// name: 'BoardlInfo',
// component: () => import('@/views/extermal/Board/index.vue')
// },
// {
// path: '/external/Process',
// name: 'Process1',
// component: () => import('@/views/extermal/Process/index.vue')
// },
// 内部首页
{
@ -260,7 +260,8 @@ const router = createRouter({
{
path: '',
name: 'Market',
component: () => import('@/views/home/market/Market.vue')
component: () => import('@/views/home/market/Market_new.vue')
// component: () => import('@/views/home/market/Market.vue')
},
{
path: 'MarketDataModify',
@ -356,6 +357,16 @@ const router = createRouter({
name: 'Process',
component: () => import('@/views/home/intelligence/process/Process.vue')
},
{
path: '/external/Board',
name: 'BoardlInfo',
component: () => import('@/views/extermal/Board/index.vue')
},
{
path: '/external/Process',
name: 'Process1',
component: () => import('@/views/extermal/Process/index.vue')
},
{
path: '/Home/Process/ProcessInfo/:id',
meta: { title: '情报审批详情' },
@ -456,6 +467,12 @@ const router = createRouter({
name: 'Group',
component: () => import('@/views/company/index.vue')
},
{
path: '',
meta: { title: '集团方针管理' },
name: 'policyManage',
component: () => import('@/views/company/manage.vue')
},
{
path: 'company',
meta: { title: '公司方针' },
@ -480,6 +497,11 @@ const router = createRouter({
name: 'phone',
component: () => import('@/views/home/phone/index.vue')
},
{
path: 'manage',
name: 'phoneManage',
component: () => import('@/views/home/phone/manage.vue')
},
{
path: 'visit',
meta: { title: '拜访' },

View File

@ -10,34 +10,34 @@ export const useUserStore = defineStore('user', () => {
roleName: '',
//账号类型 1-管理员 2-调达本部内部课长 3-调达本部内部一般人员 4-公司其他部门人员 5-供应商
type: '',
roleCode:'',
isReview:0,
deptId:'',
nikeName:'',
reviewCount:0,
isPublish:0,
token:'',
appLoginCount:0,
appLoginToDayCount:0,
isUpPwd:0,
roleCode: '',
isReview: 0,
deptId: '',
nikeName: '',
reviewCount: 0,
isPublish: 0,
token: '',
appLoginCount: 0,
appLoginToDayCount: 0,
isUpPwd: 0
})
async function getUser() {
const a = ['review_person','zhuxi','tech_service']
const b = ['publish','tech_service']
const a = ['review_person', 'zhuxi', 'tech_service']
const b = ['publish', 'tech_service']
try {
// if (!unref(token)) return
const { data } = await getCurLogin()
user.value = Object.assign(data,{
token:token.value
user.value = Object.assign(data, {
token: token.value
})
if(a.includes(data.roleCode)){
if (a.some((item) => data.roleCode?.includes(item))) {
user.value.isReview = 1
}
if(b.includes(data.roleCode)){
if (b.some((item) => data.roleCode?.includes(item))) {
user.value.isPublish = 1
}
// console.log( user.value)
// console.log('----40----', user.value)
} catch (error) {
LogOut()
}
@ -46,22 +46,22 @@ export const useUserStore = defineStore('user', () => {
const { push } = useRouter()
function LogOut() {
token.value = null
user.value ={
user.value = {
id: '',
account: '',
roleName: '',
//账号类型 1-管理员 2-调达本部内部课长 3-调达本部内部一般人员 4-公司其他部门人员 5-供应商
type: '',
roleCode:'',
isReview:0,
nikeName:'',
reviewCount:0,
isPublish:0,
token:'',
appLoginCount:0,
isUpPwd:0
roleCode: '',
isReview: 0,
nikeName: '',
reviewCount: 0,
isPublish: 0,
token: '',
appLoginCount: 0,
isUpPwd: 0
}
console.log(user.value)
// console.log('------64-', user.value)
push({ name: 'Entry' })
}
return { user, getUser, LogOut }

View File

@ -275,5 +275,6 @@ declare global {
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue'
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
import('vue')
}

53
src/utils/date.ts Normal file
View File

@ -0,0 +1,53 @@
import dayjs from 'dayjs'
const pickerOptions = {
disabledDate: (time) => {
return time.getTime() < Date.now()
},
valueFormat: 'YYYY-MM-DD HH:mm:ss',
shortcuts: [
{
text: '3天后',
value: () => {
const date = new Date()
date.setTime(date.getTime() + 3600 * 1000 * 24 * 3)
date.setHours(0, 0, 0, 0)
return date
}
},
{
text: '5天后',
value: () => {
const date = new Date()
date.setTime(date.getTime() + 3600 * 1000 * 24 * 5)
date.setHours(0, 0, 0, 0)
return date
}
},
{
text: '7天后',
value: () => {
const date = new Date()
date.setTime(date.getTime() + 3600 * 1000 * 24 * 7)
date.setHours(0, 0, 0, 0)
return date
}
},
{
text: '10天后',
value: () => {
const date = new Date()
date.setTime(date.getTime() + 3600 * 1000 * 24 * 10)
date.setHours(0, 0, 0, 0)
return date
}
}
],
day: (() => {
const date = new Date()
date.setTime(date.getTime() + 3600 * 1000 * 24 * 1)
date.setHours(0, 0, 0, 0)
return dayjs(date).format('YYYY-MM-DD HH:mm:ss')
})()
}
export { pickerOptions }

View File

@ -7,20 +7,20 @@ import router from '@/router'
export const TOKEN_KEY = 'token'
declare module 'axios' {
export interface AxiosRequestConfig {
showLoading?: boolean
// [自定义属性声明]
}
export interface AxiosRequestConfig {
showLoading?: boolean
// [自定义属性声明]
}
}
// const { createMessage, createWarningModal } = useMessage()
// 创建axios实例
const service = axios.create({
// 服务接口请求
baseURL: '/test-api',
// 超时设置
timeout: 15000,
headers: { 'Content-Type': 'application/json;charset=utf-8;' },
showLoading: false
// 服务接口请求
baseURL: '/test-api',
// 超时设置
timeout: 15000,
headers: { 'Content-Type': 'application/json;charset=utf-8;' },
showLoading: false
})
// let loading: any;
@ -31,143 +31,141 @@ const service = axios.create({
let requestCount: number = 0
//显示loading
const showLoading = () => {
if (requestCount === 0) {
//加载中显示样式可以自行修改
// loading = ElLoading.service({
// text: "拼命加载中,请稍后...",
// background: 'rgba(0, 0, 0, 0.7)',
// spinner: 'el-icon-loading',
// })
message.loading('请求中...')
}
requestCount++
if (requestCount === 0) {
//加载中显示样式可以自行修改
// loading = ElLoading.service({
// text: "拼命加载中,请稍后...",
// background: 'rgba(0, 0, 0, 0.7)',
// spinner: 'el-icon-loading',
// })
message.loading('请求中...')
}
requestCount++
}
//隐藏loading
const hideLoading = () => {
requestCount--
if (requestCount == 0) {
// loading.close()
message.destroyAll()
}
requestCount--
if (requestCount == 0) {
// loading.close()
message.destroyAll()
}
}
// 请求拦截
service.interceptors.request.use(
(config) => {
// config.showLoading
if (config.showLoading) {
showLoading()
}
if (token) config.headers[TOKEN_KEY] = unref(token)
// if (getToken()) {
// // 是否需要设置 token放在请求头
// config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
// }
(config) => {
// config.showLoading
if (config.showLoading) {
showLoading()
}
if (token) config.headers[TOKEN_KEY] = unref(token)
// if (getToken()) {
// // 是否需要设置 token放在请求头
// config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
// }
// get请求映射params参数
if (config.method === 'get' && config.params) {
let url = config.url + '?'
for (const propName of Object.keys(config.params)) {
const value = config.params[propName]
const part = encodeURIComponent(propName) + '='
if (value !== null && typeof value !== 'undefined') {
// 对象处理
if (typeof value === 'object') {
for (const key of Object.keys(value)) {
const params = propName + '[' + key + ']'
const subPart = encodeURIComponent(params) + '='
url += subPart + encodeURIComponent(value[key]) + '&'
}
} else {
url += part + encodeURIComponent(value) + '&'
}
}
}
url = url.slice(0, -1)
config.params = {}
config.url = url
}
return config
},
(error) => {
// console.log(error)
Promise.reject(error)
}
// get请求映射params参数
if (config.method === 'get' && config.params) {
let url = config.url + '?'
for (const propName of Object.keys(config.params)) {
const value = config.params[propName]
const part = encodeURIComponent(propName) + '='
if (value !== null && typeof value !== 'undefined') {
// 对象处理
if (typeof value === 'object') {
for (const key of Object.keys(value)) {
const params = propName + '[' + key + ']'
const subPart = encodeURIComponent(params) + '='
url += subPart + encodeURIComponent(value[key]) + '&'
}
} else {
url += part + encodeURIComponent(value) + '&'
}
}
}
url = url.slice(0, -1)
config.params = {}
config.url = url
}
return config
},
(error) => {
// console.log(error)
Promise.reject(error)
}
)
// 响应拦截器
service.interceptors.response.use(
async (response: any) => {
// console.log('响应拦截器res', response)
// if (res.config.showLoading) {
// showLoading()
// }
hideLoading()
// 未设置状态码则默认成功状态
async (response: any) => {
// console.log('响应拦截器res', response)
// if (res.config.showLoading) {
// showLoading()
// }
hideLoading()
// 未设置状态码则默认成功状态
const { data, status } = response
if (data instanceof Blob || data instanceof ArrayBuffer) {
return {
data,
code: 200
}
if (response.headers['content-disposition']) {
const fileName = response.headers['content-disposition']
?.split(';')[1]
?.split('=')[1]
} else {
return Promise.reject('没有访问权限')
}
}
const { errCode, code, msg } = data || {}
const errMsg = data?.errMsg || data?.message || msg
// console.log(11, code, errMsg)
const { data, status } = response
if (data instanceof Blob || data instanceof ArrayBuffer) {
return {
data,
code: 200
}
if (response.headers['content-disposition']) {
const fileName = response.headers['content-disposition']?.split(';')[1]?.split('=')[1]
} else {
return Promise.reject('没有访问权限')
}
}
const { errCode, code, msg } = data || {}
const errMsg = data?.errMsg || data?.message || msg
// console.log(11, code, errMsg)
if (code === 2000) {
await router.push('/')
}
if (code === 2000) {
await router.push('/')
}
if (![0, 200].includes(code)) {
// if(errMsg==='用户未登录')
// { message.error(errMsg);}
// else if(errMsg==='密码不正确'){
// message.error(errMsg);
// }
// else if(errMsg==="账户信息查找为空"){
// message.error(errMsg);
// }
// else{ message.error("服务器升级维护中,请稍后重试!")}\
message.error(errMsg)
return Promise.reject(errMsg)
}
if (![0, 200].includes(code)) {
if (errMsg === '用户未登录') return Promise.reject(errMsg)
// { message.error(errMsg);}
// else if(errMsg==='密码不正确'){
// message.error(errMsg);
// }
// else if(errMsg==="账户信息查找为空"){
// message.error(errMsg);
// }
// else{ message.error("服务器升级维护中,请稍后重试!")}\
message.error(errMsg)
return Promise.reject(errMsg)
}
if (/^[4|5].*/.test(code || errCode || status)) {
// console.error('> axios(interceptors.response): ', errMsg);
message.error(errMsg)
// message.error("服务器访问过多,请稍后重试!");
// 处理未登录token过期等 情况
// if (code !== 404 && /^[4].*/.test(code || errCode || status)) {
// await app.fedLogout();
// }
if (/^[4|5].*/.test(code || errCode || status)) {
// console.error('> axios(interceptors.response): ', errMsg);
message.error(errMsg)
// message.error("服务器访问过多,请稍后重试!");
// 处理未登录token过期等 情况
// if (code !== 404 && /^[4].*/.test(code || errCode || status)) {
// await app.fedLogout();
// }
return Promise.reject(data)
}
return data
},
(error) => {
// console.log('err' + error)
hideLoading()
let { message } = error
if (message == 'Network Error') {
message = '后端接口连接异常'
} else if (message.includes('timeout')) {
message = '系统接口请求超时'
} else if (message.includes('Request failed with status code')) {
message = '系统接口' + message.substr(message.length - 3) + '异常'
}
message.err('服务器升级维护中,请稍后重试!')
return Promise.reject(error)
}
return Promise.reject(data)
}
return data
},
(error) => {
// console.log('err' + error)
hideLoading()
let { message } = error
if (message == 'Network Error') {
message = '后端接口连接异常'
} else if (message.includes('timeout')) {
message = '系统接口请求超时'
} else if (message.includes('Request failed with status code')) {
message = '系统接口' + message.substr(message.length - 3) + '异常'
}
message.err('服务器升级维护中,请稍后重试!')
return Promise.reject(error)
}
)
export default service

View File

@ -4,10 +4,51 @@ dayjs.extend(isSameOrAfter)
// dayjs.extend(isBefore)
function isNotOneWeekAgo(date: any) {
if (!date) return false
const oneWeekAgo = dayjs().subtract(1, 'week')
// console.log('🚀 ~ oneWeekAgo:', oneWeekAgo.format('YYYY-MM-DD'))
return dayjs(date).isSameOrAfter(oneWeekAgo, 'day')
if (!date) return false
const oneWeekAgo = dayjs().subtract(1, 'week')
// console.log('🚀 ~ oneWeekAgo:', oneWeekAgo.format('YYYY-MM-DD'))
return dayjs(date).isSameOrAfter(oneWeekAgo, 'day')
}
export { isNotOneWeekAgo }
const pickerOptions = {
disabledDate(time) {
return time.getTime() < Date.now()
},
valueFormat: 'YYYY-MM-dd HH:mm:ss',
shortcuts: [
{
text: '3天后',
value: () => {
const date = new Date()
date.setTime(date.getTime() + 3600 * 1000 * 24 * 3)
return date
}
},
{
text: '5天后',
value: () => {
const date = new Date()
date.setTime(date.getTime() + 3600 * 1000 * 24 * 5)
return date
}
},
{
text: '7天后',
value: () => {
const date = new Date()
date.setTime(date.getTime() + 3600 * 1000 * 24 * 7)
return date
}
},
{
text: '10天后',
value: () => {
const date = new Date()
date.setTime(date.getTime() + 3600 * 1000 * 24 * 10)
return date
}
}
]
}
export { isNotOneWeekAgo, pickerOptions }

View File

@ -3,8 +3,11 @@
import HomeHead from '@/views/home/components/HomeHead.vue'
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import { useDate } from '@/views/home/hooks/useDate'
// import { NTimeline, NTimelineItem } from 'naive-ui'
import { useMessage } from 'naive-ui'
import { useUserStore } from '@/stores/modules/user'
// import { groupBy } from 'lodash-es'
const store = useUserStore()
import { cateFileList } from '@/api/daikin/base'
const { day, week } = useDate()
@ -66,7 +69,7 @@ const goFile = (row: any) => {
const { isSelect, filePath } = row
if (!isSelect || isSelect === 2) {
message.info('没有访问权限!')
return
return
}
if (!filePath) {
message.info('暂无文件')
@ -75,6 +78,13 @@ const goFile = (row: any) => {
}
getFile()
const userCode = ref(false)
watchEffect(() => {
userCode.value = ['admin', 'cd_dandang', 'tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
})
</script>
<template>
@ -103,7 +113,14 @@ getFile()
</div>
</div>
</div> -->
<div class="mt30px mr20px flex w100% relative">
<div class="mt20px mr20px pt40px flex w100% relative">
<!-- <el-button
v-if="userCode"
type="primary"
class="button absolute top-0px right-50px"
@click="push({ name: 'policyManage' })"
>数据管理</el-button
> -->
<!-- <img src="../../assets/images/fangz.png" class="w100%"/> -->
<!-- <img src="../../assets/images/fzqiet.png" class="w100%" />
<div
@ -115,14 +132,14 @@ getFile()
</div> -->
<img src="../../assets/images/2024fz.jpg" class="w100%" />
<div
class="absolute py10px left-880px top-250px pb-0px z-100 text-20px text-#285FE9 flex justify-center items-center hover:border-b-1px hover:border-b-solid hover:border-b-#285FE9 hover:cursor-pointer"
class="absolute py10px left-880px top-282px pb-0px z-100 text-20px text-#285FE9 flex justify-center items-center hover:border-b-1px hover:border-b-solid hover:border-b-#285FE9 hover:cursor-pointer font"
@click="goFile(fileItem)"
>
<img src="../../assets/images/wjqq@2x.png" class="w18px h20px mr8px" />
2024年グループ年頭方针
</div>
<div
class="absolute py10px left-920px top-645px pb-0px z-100 text-20px text-#285FE9 flex justify-center items-center hover:border-b-1px hover:border-b-solid hover:border-b-#285FE9 hover:cursor-pointer"
class="absolute py10px left-920px top-678px pb-0px z-100 text-20px text-#285FE9 flex justify-center items-center hover:border-b-1px hover:border-b-solid hover:border-b-#285FE9 hover:cursor-pointer font"
@click="goFile(fileItemTwo)"
>
<img src="../../assets/images/wjqq@2x.png" class="w18px h20px mr8px" />
@ -137,6 +154,9 @@ getFile()
right: 30px;
top: -92px;
}
.font {
font-family: '微软雅黑', 'Microsoft YaHei', sans-serif;
}
.g-wrapper {
border-radius: 18px;

View File

@ -0,0 +1,394 @@
<script setup lang="ts">
import AppBlock from '@/components/AppBlock.vue'
import HomeHead from '@/views/home/components/HomeHead.vue'
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import { useMessage, NModal } from 'naive-ui'
import { useUserStore } from '@/stores/modules/user'
import UserList from '@/views/home/intelligence/process/UserPages.vue'
import dayjs from 'dayjs'
import {
fetchDelHis,
marketPreADD,
getMetalList,
fetchGetHisPage,
fetchUpdateHis,
fetchSaveHis,
fetchContactList,
fetchContactEdit,
fetchContactDel,
fetchContactAdd,
fetchYearPlanList,
fetchYearPlanEdit,
fetchYearPlanAdd,
fetchYearPlanDel
} from '@/api/daikin/base'
const message = useMessage()
const store = useUserStore()
const header = { token: store.user.token }
const pageInfo = reactive({
currentPage: 1,
pageSize: 15,
total: 0
})
const dataA = ref<any>([])
const editA = ref<any>({})
const metaList = ref<any>([])
const metaObj = ref<any>({})
const stDateList = ref<any>([])
const shomkA = ref(false)
const type = ref(2)
async function getDataA() {
const { data } = await fetchGetHisPage({})
dataA.value = Object.entries(data).map(([key, value]: any) => {
return {
stDate: key,
yearId: key,
children: value.map((item: any) => {
return {
...item,
numbers: metaObj.value[item.number]
}
})
}
})
// setDataFiles(dataArr);
}
onMounted(async () => {
// const { data = [] } = await getMetalList()
// metaList.value = data
// data.forEach((item: any) => {
// metaObj.value[item.value] = item.title
// })
// getDataA()
fetchDataList()
})
const contactList = ref<any>([])
const fetchDataList = async () => {
const { rows = [] } = await fetchYearPlanList({
pageNum: pageInfo.currentPage,
pageSize: pageInfo.pageSize
})
contactList.value = rows
console.log('🚀 ~ file: manage.vue:66 ~ data:', rows)
}
async function onSubmitA(row: { id: any; fileList?: any; title?: any }) {
console.log(row, 555)
const { id, title } = row
// let moduleId = 1;
let sendData = {}
if (!row.id) {
sendData = { title, type: type.value, userIdList: userData.value }
if (row.fileList && row.fileList.length > 0) {
row.fileList.map((item) => {
if (item.response) {
sendData.filePath = item.response.url
// obj.title = title || computedName(item.response.originalFilename);
} else {
sendData.filePath = item.url
// obj.title = title || computedName(item.originalFilename);
}
})
}
} else {
sendData = { id, title, type: type.value, userIdList: userData.value }
}
const { code, msg } = await marketPreADD(sendData)
if (code === 200) {
message.success('修改成功!')
} else {
message.error(msg)
}
shomkA.value = false
getDataA()
}
const handleEditA = (type: string, row: any = { type: 1 }) => {
if (!row) return
editA.value = { ...row }
// editA.value.stDateList = [row.stDate, row.stDate]
// stDateList.value = [row.stDate, row.stDate]
// setUserList.value =[]
shomkA.value = true
// editA.value.fileList = [{
// name: row.title,
// originalFilename: row.title,
// url: row.filePath,
// }]
// setUserList.value =row.userIdList
}
async function handleDeleteA(index: number, row: any) {
const { id } = row
if (!id) return
const { code, msg } = await fetchYearPlanDel(id)
if (code === 200) {
message.success('删除成功!')
} else {
message.error(msg)
}
fetchDataList()
}
const showModal = ref(false)
const flg = ref()
const setUserList = ref()
async function getUser(row) {
console.log(row)
showModal.value = !showModal.value
flg.value = row
if (row.id && row.userIdList) {
setUserList.value = row.userIdList
}
// const {data: userArr} = await getBPCUser({moduleId})
// setUserList.value = userArr
}
//
const userData = ref()
const handleChild = (data: any) => {
const { showModal: show, multipleSelection } = data
showModal.value = unref(show)
let userIdList: any[] = []
multipleSelection.value.forEach((i: { userId: any }) => {
userIdList.push(i.userId)
})
if (flg.value.id) {
flg.value.userIdList = userIdList
marketPreADD(flg.value)
getDataA()
console.log(flg.value)
}
userData.value = userIdList
}
const CloseThiss = (data: boolean) => {
showModal.value = data
}
const goBacks = () => {
history.back()
}
const editForm = ref(null)
const channelList = ref([
{
label: 'LME',
value: 'LME'
},
{
label: 'SMM',
value: 'SMM'
}
])
const handleClickA = async () => {
const req = { ...editA.value }
let flag = false
try {
} catch (error) {}
let res: any = req.id ? await fetchYearPlanEdit(req) : await fetchYearPlanAdd(req)
if (res.code == 200) {
shomkA.value = false
message.success('操作成功!')
fetchDataList()
} else {
message.error(res.msg)
}
}
function generateDateRange() {
const [startDate, endDate] = stDateList.value || []
if (!startDate || !endDate) return []
const dateFormat = 'YYYY-MM-DD'
const dates = []
const start = dayjs(startDate, dateFormat)
const end = dayjs(endDate, dateFormat)
//
dates.push(start.format(dateFormat))
//
let currentDate = start
while (currentDate.isSameOrBefore(end)) {
currentDate = currentDate.add(1, 'day')
dates.push(currentDate.format(dateFormat))
}
return dates
}
// 1 2: DSZ 3: DISH
const typeList = [
{
label: '调达本部',
value: 1
},
{
label: 'DSZ',
value: 2
},
{
label: 'DISH',
value: 3
}
]
const handleClose = (tag: any) => {
editA.value = { type: 1 }
}
</script>
<template>
<HomeHead class="top">
<template #content>
<!-- <HomeHeadSearch /> -->
</template>
</HomeHead>
<AppBlock class="w-full h-full p30px text-#000">
<div class="font-600 flex items-center">
<!-- <img src="./images/logo.svg" class="h56px mr21px" /> -->
<div class="text-36px text-#000">年度方针-数据管理</div>
</div>
<div class="cont relative w100% h900px overflow-y-auto">
<el-button type="primary" @click="handleEditA" class="my20px">新增年度方针</el-button>
<div
class="rounded-md cursor-pointer float-right mr-30px mt-20px px20px py10px z-200 bg-#f5f5f5 flex items-center justify-center w-100px"
@click="goBacks"
>
<el-icon><ArrowLeftBold size="18" /></el-icon>
</div>
<el-table
:data="contactList"
style="width: 100%"
:header-cell-style="{
background: '#2A7BF7',
color: '#fff',
height: '60px',
textAlign: 'center',
'font-size': '24px'
}"
:cell-style="{ 'text-align': 'center' }"
height="740px"
>
<el-table-column label="标题" prop="title" />
<el-table-column label="内容" prop="content" />
<el-table-column label="文件路径" prop="filePath" />
<!-- <el-table-column label="手机号" prop="mobile" />
<el-table-column label="行号" prop="rowIndex" />
<el-table-column label="排序" prop="sort" />
<el-table-column label="创建时间" prop="createTime">
<template #default="{ row }">
{{ dayjs(row.createTime).format('YYYY-MM-DD') }}
</template>
</el-table-column> -->
<!-- <el-table-column label="查看范围" prop="userIdList">
<template #default="scope">
<span v-if="scope.row.userIdList" v-for="it in scope.row.userIdList"> &nbsp;&nbsp; {{it.nickName}}</span>
</template>
</el-table-column> -->
<el-table-column label="操作" width="180px">
<template #default="scope">
<template v-if="!scope.row.children?.length">
<el-button size="small" @click="handleEditA('edit', scope.row)">编辑</el-button>
<el-button size="small" type="danger" @click="handleDeleteA(scope.$index, scope.row)"
>删除</el-button
>
</template>
</template>
</el-table-column>
</el-table>
<div class="absolute bottom-50px left-50% translate-x-[-50%] z-11">
<el-pagination
background
v-model:current-page="pageInfo.currentPage"
v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, total,jumper,->"
:total="pageInfo.total"
@current-change="fetchDataList"
/>
<!-- @size-change="handleSizeChange" -->
</div>
</div>
</AppBlock>
<el-dialog
:z-index="200"
v-model="shomkA"
title=" "
width="30%"
:modal="false"
top="30vh"
@close="handleClose"
>
<div class="bg-#FFF">
<el-form ref="editForm" :model="editA" label-width="100px" size="large">
<!-- <el-form-item label="部门" prop="dept">
<el-select v-model="editA.type" placeholder="选择部门" class="!w-100%">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<br /> -->
<el-form-item label="标题" prop="title">
<el-input v-model="editA.title" placeholder="请输入标题"></el-input>
</el-form-item>
<br />
<el-form-item label="内容" prop="content">
<el-input v-model="editA.content" placeholder="请输入内容"></el-input>
</el-form-item>
<br />
<el-form-item label="文件路径" prop="filePath">
<el-input v-model="editA.filePath" placeholder="请输入手机号"></el-input>
</el-form-item>
<br />
<div class="text-center">
<el-button type="" @click="shomkA = false" class="mb-20px !mr-50rpx"> 取消</el-button>
<el-button type="primary" @click="handleClickA(editA)" class="mb-20px"> 确认</el-button>
</div>
</el-form>
</div>
</el-dialog>
<n-modal v-model:show="showModal">
<UserList :userDataList="setUserList" @clickChild="handleChild" @CloseThis="CloseThiss" />
</n-modal>
</template>
<style lang="less" scoped>
.demo-tabs > .el-tabs__content {
color: #6b778c;
font-size: 32px;
font-weight: 600;
}
.top {
position: absolute;
right: 30px;
top: -92px;
}
.flex-center {
display: flex;
justify-content: center;
margin: 0 auto;
}
:deep(.el-input-number .el-input__inner) {
text-align: left !important;
}
:deep {
.el-dialog__body {
margin-top: 18px;
padding-top: 10px;
}
}
</style>

View File

@ -1,15 +1,19 @@
<template>
<div class="page">
<HomeHead class="top">
<!-- <template #content>
<HomeHeadSearch />
</template> -->
</HomeHead>
<div class="back" @click="push({ name: 'external' })">返回首页</div>
<div class="bg-#fff p30px rounded-5px mt40px overflow-y-auto max-h980px">
<n-form :label-width="900" size="medium" :model="formValue">
<HomeHead class="top"> </HomeHead>
<div class="h-full relative flex flex-col">
<div class="font-600 flex items-end mt30px">
<div class="text-36px">
{{ not.article.cate == 7 ? '外部新增-News' : '外部新增-重要通知' }}
</div>
<div class="text-18px ml40px mr25px">{{ day }}</div>
<div class="text-18px">{{ week }}</div>
</div>
<div
class="q-wrapper flex-1 rounded-5px overflow-y-auto mt30px text-#142142 flex flex-col bg-#fff p30px"
>
<n-form :label-width="800" size="medium" :model="formValue">
<n-form-item label="标题" path="title">
<n-input v-model:value="formValue.title" placeholder="" />
<n-input class="w90%" v-model:value="formValue.title" placeholder="" />
</n-form-item>
<n-form-item v-if="formValue.cate == 8" label="是否置顶" path="isTop">
<n-radio-group v-model:value="formValue.isTop" name="radiogroup">
@ -28,14 +32,14 @@
<n-space>
<n-radio value="1">供应商留言</n-radio>
<n-radio value="2">空调需求依赖</n-radio> -->
<!-- <n-radio value="3">回执单</n-radio> -->
<!-- </n-space>
<!-- <n-radio value="3">回执单</n-radio> -->
<!-- </n-space>
</n-radio-group>
</n-form-item> -->
<n-form-item label="内容" path="title">
<Editor @getChildData="handleChild" class="bg-#fff" />
</n-form-item>
<n-button @click="thisClick" v-if="formValue.cate == 8">
<n-button class="w-120px" @click="thisClick" v-if="formValue.cate == 8">
情报公开范围
</n-button>
<div class="mt15px h150px overflow-y-auto" v-if="formValue.cate == 8">
@ -55,16 +59,43 @@
<n-form-item>
<n-button @click="showModal1 = true"> 文本内容预览</n-button>
</n-form-item>
<el-button type="primary" class="mt20px" @click="saveThis"
>提交</el-button
>
<n-form-item v-if="formValue.cate != 8" label="是否置顶">
<el-switch
v-model="formValue.isTop"
active-text="置顶"
inactive-text="不置顶"
inactive-value="Y"
active-value="N"
></el-switch>
</n-form-item>
<n-form-item label="是否定时发送">
<el-switch
v-model="formValue.isPublish"
active-text="是"
inactive-text="否"
:inactive-value="0"
:active-value="1"
@change="(val) => (formValue.publishTime = val ? pickerOptions.day : '')"
></el-switch>
</n-form-item>
<n-form-item label="发布时间" v-if="formValue.isPublish == 1">
<el-date-picker
v-model="formValue.publishTime"
align="right"
type="date"
placeholder="选择日期"
:disabledDate="pickerOptions.disabledDate"
:shortcuts="pickerOptions.shortcuts"
:value-format="pickerOptions.valueFormat"
>
</el-date-picker>
</n-form-item>
<el-button type="primary" class="mt20px w-100px" @click="saveThis"></el-button>
</div>
<n-modal v-model:show="showModal1">
<div class="flex w80% p30px bg-#fff my40px rounded-30px">
<div
class="overflow-y-auto h800px container"
v-html="editorContent"
></div>
<div class="overflow-y-auto h800px container" v-html="editorContent"></div>
</div>
</n-modal>
<div>
@ -82,8 +113,8 @@
</div>
</template>
<script setup lang="ts">
import Editor from "@/views/home/intelligence/components/TinyECE.vue";
import UserPage from "../../home/intelligence/process/UserPages.vue";
import Editor from '@/views/home/intelligence/components/TinyECE.vue'
import UserPage from '../../home/intelligence/process/UserPages.vue'
import {
NModal,
NCard,
@ -96,118 +127,122 @@ import {
NSpace,
NRadioGroup,
useMessage,
treeDark,
} from "naive-ui";
import HomeHead from "@/views/home/components/HomeHead.vue";
import { noticeld } from "@/stores/modules/noticeId";
import { saveArticle,trendsAdd } from "@/api/daikin/base";
const editorContent = ref();
const { push } = useRouter();
const message = useMessage();
const not = noticeld();
treeDark
} from 'naive-ui'
import HomeHead from '@/views/home/components/HomeHead.vue'
import { noticeld } from '@/stores/modules/noticeId'
import { saveArticle, trendsAdd } from '@/api/daikin/base'
import { useDate } from '@/views/home/hooks/useDate'
import { pickerOptions } from '@/utils/date'
const editorContent = ref()
const { push } = useRouter()
const message = useMessage()
const { day, week } = useDate()
const not = noticeld()
// const CloseThis = ()=>{
// mask.value = false
// }
let formValue: any = ref({
type: "1",
type: '1',
cate: not.article.cate,
title: "",
tag: "",
source: "",
content: "",
reviewSource: "3",
isTop: "N",
treeSource: "3",
});
title: '',
tag: '',
source: '',
content: '',
reviewSource: '3',
isTop: 'N',
treeSource: '3',
isPublish: 0,
publishTime: ''
})
function escapeHTML(html: string): string {
const tempElement = document.createElement("div");
tempElement.textContent = html;
return tempElement.innerHTML;
const tempElement = document.createElement('div')
tempElement.textContent = html
return tempElement.innerHTML
}
const handleClose = (tag: any) => {
dataList.value.splice(dataList.value.indexOf(tag), 1);
};
dataList.value.splice(dataList.value.indexOf(tag), 1)
}
//
async function save() {
let userIdList: any[] = [];
const cont = editorContent.value;
const content = escapeHTML(cont);
const { title, reviewSource, tag, treeSource, source, type, isTop } =
formValue.value;
const cate = not.article.cate;
let userIdList: any[] = []
const cont = editorContent.value
const content = escapeHTML(cont)
const { title, reviewSource, tag, treeSource, source, type, isTop, isPublish, publishTime } =
formValue.value
const cate = not.article.cate
// console.log(formValue.value, content,cate)
if (dataList.value) {
dataList.value.forEach((i: { userId: any }) => {
console.log(dataList.value);
userIdList.push(i.userId);
});
console.log(dataList.value)
userIdList.push(i.userId)
})
}
// console.log(formValue.value)
// if(userIdList.length<0) return
if (not.article.cate==='9') {
const { msg, code } = await trendsAdd({title,content});
if (not.article.cate === '9') {
const { msg, code } = await trendsAdd({ title, content })
if (code === 200) {
message.success("新增成功");
message.success('新增成功')
} else {
message.success(msg);
message.success(msg)
}
}
else{
const { msg, code } = await saveArticle({
title,
tag: "",
isTop,
treeSource,
reviewSource,
source,
cate,
type,
content,
userIdList,
});
if (code === 200) {
message.success("新增成功");
} else {
message.success(msg);
}
const { msg, code } = await saveArticle({
title,
tag: '',
isTop,
treeSource,
reviewSource,
source,
cate,
type,
content,
userIdList,
isPublish,
publishTime
})
if (code === 200) {
message.success('新增成功')
} else {
message.success(msg)
}
}
push({ name: "external" });
push({ name: 'external' })
}
//
const handleChild = (data: string) => {
editorContent.value = data;
editorContent.value = data
// console.log(data)
};
}
//
const saveThis = (e: { preventDefault: () => void }) => {
e.preventDefault();
save();
};
const stores = noticeld();
const showModal = ref(false);
const showModal1 = ref(false);
const setUserList = ref();
const dataList = ref();
e.preventDefault()
save()
}
const stores = noticeld()
const showModal = ref(false)
const showModal1 = ref(false)
const setUserList = ref()
const dataList = ref()
const thisClick = () => {
showModal.value = true;
setUserList.value = dataList.value;
stores.article.reviewSource = formValue.value.reviewSource;
};
const CloseThis = (data: boolean) => {
showModal.value = data;
};
const handleChild1 = (data: any) => {
const { showModal: show, multipleSelection } = data;
console.log(show);
showModal.value = unref(show);
dataList.value = unref(multipleSelection);
};
</script>
showModal.value = true
setUserList.value = dataList.value
stores.article.reviewSource = formValue.value.reviewSource
}
const CloseThis = (data: boolean) => {
showModal.value = data
}
const handleChild1 = (data: any) => {
const { showModal: show, multipleSelection } = data
console.log(show)
showModal.value = unref(show)
dataList.value = unref(multipleSelection)
}
</script>
<style scoped lang="less">
::-webkit-scrollbar {
@ -225,16 +260,28 @@ const handleChild1 = (data: any) => {
justify-content: center;
}
.top {
position: absolute;
right: 30px;
top: 0px;
top: -92px;
}
::-webkit-scrollbar {
width: 1px;
}
.q-wrapper {
border-radius: 18px;
border: 1px solid #e7ebf5;
box-shadow: inset 1px 2px 12px rgba(14, 86, 221, 0.32);
overflow: auto;
}
.page {
width: 100%;
// height: 100px;
font-family: "PingFang SC";
font-family: 'PingFang SC';
user-select: none;
background-image: url("@/assets/images/bg.jpg");
background-image: url('@/assets/images/bg.jpg');
background-color: #000;
background-position: 0 0;
background-repeat: no-repeat;
@ -264,7 +311,7 @@ const handleChild1 = (data: any) => {
}
}
.main {
background-image: url("@/assets/images/bg-rs-main.svg");
background-image: url('@/assets/images/bg-rs-main.svg');
background-position: 0 0;
background-repeat: repeat-x;
background-size: auto;

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,15 @@
<script setup lang="ts">
import { getImg } from "./images";
import { getImg } from './images'
import {
getNoticeList,
deleteWithdraw,
getManagerList,
getExternalManagerDetail, // news/-
externalWithdraw, // news/-
getExternalManagerList, // news/-
} from "@/api/daikin/base";
import Editor from "@/views/home/intelligence/components/TinyECE.vue";
import UserPage from "../../home/intelligence/process/UserPages.vue";
getExternalManagerList // news/-
} from '@/api/daikin/base'
import Editor from '@/views/home/intelligence/components/TinyECE.vue'
import UserPage from '../../home/intelligence/process/UserPages.vue'
import {
NModal,
NCard,
@ -24,137 +24,137 @@ import {
useMessage,
treeDark,
NTag
} from "naive-ui";
import { useUserStore } from "@/stores/modules/user";
import HomeHead from "@/views/home/components/HomeHead.vue";
import { noticeld } from "@/stores/modules/noticeId";
import { saveArticle } from "@/api/daikin/base";
const editorContent = ref();
const { push } = useRouter();
const message = useMessage();
const not = noticeld();
} from 'naive-ui'
import { useUserStore } from '@/stores/modules/user'
import HomeHead from '@/views/home/components/HomeHead.vue'
import { noticeld } from '@/stores/modules/noticeId'
import { saveArticle } from '@/api/daikin/base'
import { useDate } from '@/views/home/hooks/useDate'
const editorContent = ref()
const { push } = useRouter()
const message = useMessage()
const not = noticeld()
const route = useRoute()
const activeNames = ref("2");
const activeNames = ref('2')
const Status = reactive({
reviewStatus: 1,
reviewSource: 2,
});
reviewSource: 2
})
const cate = ref('7')
const activeName = ref("0");
const tabIndex = ref("0");
const activeName = ref('0')
const tabIndex = ref('0')
const tabs = ref([
{
name: "审核中",
icon: getImg("shhz2@2x.png"),
icons: getImg("shhz1@2x.png"),
id: 0,
name: '审核中',
icon: getImg('shhz2@2x.png'),
icons: getImg('shhz1@2x.png'),
id: 0
},
{
name: "已审核",
icon: getImg("wanc2@2x.png"),
icons: getImg("wanc1@2x.png"),
id: 1,
name: '已审核',
icon: getImg('wanc2@2x.png'),
icons: getImg('wanc1@2x.png'),
id: 1
},
{
name: "驳回/撤回",
icon: getImg("boh2@2x.png"),
icons: getImg("boh1@2x.png"),
id: 2,
},
]);
const listData = ref<any>([]);
name: '驳回/撤回',
icon: getImg('boh2@2x.png'),
icons: getImg('boh1@2x.png'),
id: 2
}
])
const listData = ref<any>([])
const store2 = useUserStore();
const store2 = useUserStore()
//
const handleClick = (tab: TabsPaneContext, event: Event) => {
tabIndex.value = tab.index;
tabIndex.value = tab.index
switch (tab.index) {
case "0":
getPageList("1");
break;
case "1":
case '0':
getPageList('1')
break
case '1':
//
getPageList("3");
break;
case "2":
getPageList('3')
break
case '2':
//
getPageList("4");
break;
getPageList('4')
break
default:
getPageList("1");
break;
getPageList('1')
break
}
};
}
async function getPageList(reviewStatus: string) {
const { pageNum, pageSize } = pageInfo;
const { pageNum, pageSize } = pageInfo
const resp = await getExternalManagerList({
pageNum,
pageSize,
reviewStatus,
cate: cate.value,
});
cate: cate.value
})
// listData.value = [];
listData.value = resp?.rows || [];
listData.value = resp?.rows || []
}
//
const clickCancel = (data: any) => {
const { id, noticeId, reviewStatus } = data;
const { id, noticeId, reviewStatus } = data
externalWithdraw(id).then((res) => {
console.log(res, "删除结果");
getPageList("1");
});
};
console.log(res, '删除结果')
getPageList('1')
})
}
let formValue: any = ref({
type: "1",
type: '1',
cate: not.article.cate,
title: "",
tag: "",
source: "",
content: "",
reviewSource: "3",
isTop: "N",
treeSource: "1",
});
title: '',
tag: '',
source: '',
content: '',
reviewSource: '3',
isTop: 'N',
treeSource: '1'
})
const pageInfo = reactive({
pageNum: 1,
pageSize: 10,
type: "1",
cate: "7",
total: 10,
});
type: '1',
cate: '7',
total: 10
})
onMounted(async () => {
cate.value = route.query.cate
getPageList("1");
});
getPageList('1')
})
function escapeHTML(html: string): string {
const tempElement = document.createElement("div");
tempElement.textContent = html;
return tempElement.innerHTML;
const tempElement = document.createElement('div')
tempElement.textContent = html
return tempElement.innerHTML
}
const handleClose = (tag: any) => {
dataList.value.splice(dataList.value.indexOf(tag), 1);
};
dataList.value.splice(dataList.value.indexOf(tag), 1)
}
//
async function save() {
let userIdList: any[] = [];
const cont = editorContent.value;
const content = escapeHTML(cont);
const { title, reviewSource, tag, treeSource, source, type, isTop } =
formValue.value;
const cate = not.article.cate;
let userIdList: any[] = []
const cont = editorContent.value
const content = escapeHTML(cont)
const { title, reviewSource, tag, treeSource, source, type, isTop } = formValue.value
const cate = not.article.cate
// console.log(formValue.value, content,cate)
if (dataList.value) {
dataList.value.forEach((i: { userId: any }) => {
console.log(dataList.value);
userIdList.push(i.userId);
});
console.log(dataList.value)
userIdList.push(i.userId)
})
}
// console.log(formValue.value)
// if(userIdList.length<0) return
const { msg, code } = await saveArticle({
title,
tag: "",
tag: '',
isTop,
treeSource,
reviewSource,
@ -162,54 +162,57 @@ async function save() {
cate,
type,
content,
userIdList,
});
userIdList
})
if (code === 200) {
message.success("新增成功");
message.success('新增成功')
} else {
message.success(msg);
message.success(msg)
}
push({ name: "external" });
push({ name: 'external' })
}
//
const handleChild = (data: string) => {
editorContent.value = data;
editorContent.value = data
// console.log(data)
};
}
//
const saveThis = (e: { preventDefault: () => void }) => {
e.preventDefault();
save();
};
const stores = noticeld();
const showModal = ref(false);
const setUserList = ref();
const dataList = ref();
e.preventDefault()
save()
}
const { day, week } = useDate()
const stores = noticeld()
const showModal = ref(false)
const setUserList = ref()
const dataList = ref()
const thisClick = () => {
showModal.value = true;
setUserList.value = dataList.value;
stores.article.reviewSource = formValue.value.reviewSource;
};
showModal.value = true
setUserList.value = dataList.value
stores.article.reviewSource = formValue.value.reviewSource
}
const CloseThis = (data: boolean) => {
showModal.value = data;
};
showModal.value = data
}
const handleChild1 = (data: any) => {
const { showModal: show, multipleSelection } = data;
console.log("🚀 ~ file: index.vue:197 ~ data:", data)
const { showModal: show, multipleSelection } = data
console.log('🚀 ~ file: index.vue:197 ~ data:', data)
// showModal.value = unref(show);
// dataList.value = unref(multipleSelection);
};
}
</script>
<template>
<div class="page">
<HomeHead class="top">
<!-- <template #content>
<HomeHeadSearch />
</template> -->
</HomeHead>
<div class="back" @click="push({ name: 'external' })">返回首页</div>
<div class="bg-#fff p30px rounded-5px mt40px overflow-y-scroll h900px">
<HomeHead class="top"> </HomeHead>
<div class="h-full relative flex flex-col">
<div class="font-600 flex items-end mt30px">
<div class="text-36px">{{ cate == 7 ? '外部审批流程-News' : '外部审批流程-重要通知' }}</div>
<div class="text-18px ml40px mr25px">{{ day }}</div>
<div class="text-18px">{{ week }}</div>
</div>
<div
class="q-wrapper flex-1 rounded-5px mt30px overflow-y-scroll h900px text-#142142 flex flex-col bg-#fff p30px"
>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane v-for="item in tabs" :key="item">
<template #label>
@ -253,7 +256,7 @@ const handleChild1 = (data: any) => {
</span> -->
<el-dropdown>
<span
class="truncate flex-1 text-#142142 hover:underline w400px max-w400px"
class="truncate flex-1 text-#142142 hover:underline w400px max-w400px"
:title="i.title"
@click="handleChild1(i)"
>
@ -263,28 +266,20 @@ const handleChild1 = (data: any) => {
<el-dropdown-menu>
<el-dropdown-item v-if="i.firstReviewName">
<div class="ml20px text-#808696 !text-12px flex">
<span class="min-w120px"
>初审人{{ i.firstReviewName }}</span
>
<span class="min-w120px">初审人{{ i.firstReviewName }}</span>
<span class="ml20px">初审时间{{ i.firstReviewTime }}</span>
</div>
</el-dropdown-item>
<el-dropdown-item v-if="i.ultimateReviewName">
<div class="ml20px text-#808696 !text-12px flex">
<span class="min-w120px"
>终审人{{ i.ultimateReviewName }}</span
>
<span class="ml20px"
>终审时间{{ i.ultimateReviewTime }}</span
>
<span class="min-w120px">终审人{{ i.ultimateReviewName }}</span>
<span class="ml20px">终审时间{{ i.ultimateReviewTime }}</span>
</div>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<span class="shrink-0 ml38px text-#808696 w220px">{{
i.createTime
}}</span>
<span class="shrink-0 ml38px text-#808696 w220px">{{ i.createTime }}</span>
<span
v-if="store2.user.isReview > 0 && i.publishName"
class="ml20px text-#808696 text-16px flex-1"
@ -314,16 +309,28 @@ const handleChild1 = (data: any) => {
justify-content: center;
}
.top {
position: absolute;
right: 30px;
top: 0px;
top: -92px;
}
::-webkit-scrollbar {
width: 1px;
}
.q-wrapper {
border-radius: 18px;
border: 1px solid #e7ebf5;
box-shadow: inset 1px 2px 12px rgba(14, 86, 221, 0.32);
overflow: auto;
}
.page {
width: 100%;
// height: 100px;
font-family: "PingFang SC";
font-family: 'PingFang SC';
user-select: none;
background-image: url("@/assets/images/bg.jpg");
background-image: url('@/assets/images/bg.jpg');
background-color: #000;
background-position: 0 0;
background-repeat: no-repeat;
@ -353,7 +360,7 @@ const handleChild1 = (data: any) => {
}
}
.main {
background-image: url("@/assets/images/bg-rs-main.svg");
background-image: url('@/assets/images/bg-rs-main.svg');
background-position: 0 0;
background-repeat: repeat-x;
background-size: auto;

1123
src/views/home/Home-bak.vue Executable file

File diff suppressed because it is too large Load Diff

View File

@ -4,14 +4,32 @@ import { useChart1, useChart22, useChart21, useChart3, useChart23 } from './Home
import AppHeadUserInfo from '@/components/AppHeadUserInfo.vue'
import { NSelect } from 'naive-ui'
import News from './components/New.vue'
import { homePageMarket, homePageRate, report, getHomeList, amountList } from '@/api/daikin/base'
import { useMessage } from 'naive-ui'
import {
homePageMarket,
homePageRate,
report,
getHomeList,
amountList,
fetchHomeSmmExInfo,
fetchExchangeInfo,
fetchMarketUpdateTime
} from '@/api/daikin/base'
import { useUserStore } from '@/stores/modules/user'
import { groupBy } from 'lodash-es'
const store = useUserStore()
const message = useMessage()
const isUpPwds = ref(false)
const userCode = ref(false)
const useCdView = ref(false)
watchEffect(() => {
userCode.value = ['admin', 'cd_dandang', 'tech_service'].includes(store.user.roleCode)
userCode.value = ['admin', 'cd_dandang', 'tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
useCdView.value = ['admin', 'cd_view', 'cd_dandang', 'tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
isUpPwds.value = store.user.isUpPwd === 2 ? true : false
})
const activeCard5NavKey = ref('DIS')
@ -50,6 +68,8 @@ const addDISH3 = ref()
const timeObj = ref<any>({})
onMounted(async () => {
try {
getHomeSmmExInfo()
// getHomeExInfo()
const {
data: { ailist, culist, lastUTime },
data
@ -168,7 +188,7 @@ onMounted(async () => {
addDISH3.value > 0 ? (addDISH3.value = addDISH3.value.toFixed(2)) : 0
}
if (isUpPwds.value) {
ElMessageBox.alert('为了您的帐号安全,首次登录必须更改初始密码', '重要提醒', {
ElMessageBox.alert('为了您的帐号安全,此次登录必须更改密码', '重要提醒', {
confirmButtonText: 'OK',
showClose: false,
showCancelButton: false
@ -188,19 +208,26 @@ const { chartRef: chartRef2, option: chartOption2, state } = useChart21()
const { chartRef: chartRef22, option: chartOption22 } = useChart22()
const { chartRef: chartRef23, option: chartOption23 } = useChart23()
const { chartRef: chartRef3, option: chartOption3 } = useChart3()
const displayDiffValue = (diffValue: number) => {
// return diffValue + '%'
if (diffValue > 0) {
return `+${diffValue} %`
return `+${diffValue}`
} else if (diffValue < 0) {
return `-${Math.abs(diffValue)} %`
// return `-${Math.abs(diffValue)}`
return `${diffValue}`
} else {
return `${diffValue} %`
// return `${formatNumber(diffValue)} %`
return `${diffValue}`
}
}
async function setModule(codes: any, names: any) {
const moduleCode = codes
console.log(codes, names)
if (names == 'CD' && !useCdView.value) {
return message.info('没有访问权限!')
}
push({ name: names })
const { code } = await report({ moduleCode })
}
@ -236,6 +263,31 @@ function formatNumber(num = 0) {
const formattedDecimalPart = decimalPart.padEnd(2, '0')
return `${wholePart}.${formattedDecimalPart}`
}
const homeSmmExInfo = ref<any>({:[],:[]})
async function getHomeSmmExInfo() {
// const { data } = await fetchHomeSmmExInfo()
// console.log("🚀 ~ file: Home.vue:268 ~ data:", groupBy(data,'instrumentName'))
// homeSmmExInfo.value = groupBy(data,'instrumentName')
const { data } = await homePageMarket()
homeSmmExInfo.value = data
delete homeSmmExInfo.value.lastUTime
}
const homeExchangeInfo = ref<any>([])
async function getHomeExInfo() {
const { data } = await fetchExchangeInfo()
homeExchangeInfo.value = data
console.log('🚀 ~ file: Home.vue:252 ~ }):', data)
}
getLastTime()
const updateTime = ref<any>({})
async function getLastTime() {
const { data } = await fetchMarketUpdateTime()
// homeExchangeInfo.value = data
updateTime.value = data
}
</script>
<template>
@ -266,9 +318,9 @@ function formatNumber(num = 0) {
</div>
<!-- <div class="card_sub-title">责任者调达中心 Device变革T/原材料变革T</div> -->
<div class="card_content">
<div class="card_content px-30px overflow-y-scroll">
<!-- <VChart :option="chartOption1" autoresize /> -->
<div class="flex pl15px pr10px pt15px text-#898F9F-1 text-#152242">
<!-- <div class="flex pl15px pr10px pt15px text-#898F9F-1 text-#152242">
<div class="">
<span class="icoT">市况</span>
<span class="ml10px text-14px">更新时间{{ timeA }}</span>
@ -384,7 +436,122 @@ function formatNumber(num = 0) {
</table>
</div>
</div>
</div> -->
<!-- <div class="flex flex-col">
<div class="flex justify-end items-center text-#ACACAC mb6px">
<div class="text-#fff bg-#002FA7 rounded-5px px18px py6px">市况</div>
<div class="min-w-180px text-end">更新时间{{ timeA }}</div>
</div>
<div class="flex justify-end items-center text-#ACACAC mb6px">
<div class="text-#fff bg-#99aff6 rounded-5px px18px py6px">汇率</div>
<div class="min-w-180px text-end">更新时间{{ timeB }}</div>
</div>
</div> -->
<div class="flex justify-between items-center">
<div class="text-#fff bg-#002FA7 rounded-5px px18px py6px">市况</div>
<div class="flex flex-col text-#ACACAC flex-1 justify-end text-end text-13px">
<div class="text- flex justify-end">更新时间<p class="min-w-100px text-start">{{ updateTime.SMM }}</p > (SMM)</div>
<div class="text- my4px flex justify-end"><p class="min-w-100px text-start">{{ updateTime.LME }}</p> (LME)</div>
</div>
</div>
<table
v-if="Object.keys(homeSmmExInfo)?.length"
class="history w-full text-center text-16px border-spacing-0"
>
<thead
style="
background-color: #417bef;
color: #fff;
height: 30px;
width: 220px;
border: 1px solid #417bef;
"
>
<tr class="h30px">
<th colspan="2" class="w-22%">原材料</th>
<th class="w-32%">最新</th>
<th>前日差</th>
<th>前日比</th>
</tr>
</thead>
<!-- <tbody>
<tr v-for="it in homeSmmExInfo" :key="it.instrumentId" class="h32px bg-#fff">
<td class="text-14px text-#000">{{ it.instrumentName }}</td>
<td class="text-14px text-#000">{{ it.negAmount }}</td>
<td
class="text-14px text-#000"
:class="it.diffValue < 0 ? 'text-#63BF8D' : 'text-red'"
>
{{ it.diffValue }}%
</td>
<td
class="text-14px text-#000"
:class="it.diffRate < 0 ? 'text-#63BF8D' : 'text-red'"
>
{{ it.diffRate }}%
</td>
</tr>
</tbody> -->
<tbody v-for="(item, index) in Object.keys(homeSmmExInfo)" :key="item" >
<tr class="h30px bg-#fff">
<td rowspan="2" class="text-14px text-#000 bg-#EDF8FF">{{ item === 'ailist' ? '铝': '铜' }}</td>
<td class="text-14px text-#000">{{ homeSmmExInfo[item]?.[0]?.channel }}</td>
<td class="text-14px text-#000">{{ homeSmmExInfo[item]?.[0]?.negAmount }}</td>
<td class="text-14px text-#000" :class="homeSmmExInfo[item]?.[0]?.diffPrice < 0 ? 'text-#63BF8D' : 'text-red'">{{ displayDiffValue(homeSmmExInfo[item]?.[0]?.diffPrice || '') }}</td>
<td class="text-14px text-#000" :class="homeSmmExInfo[item]?.[0]?.diffValue < 0 ? 'text-#63BF8D' : 'text-red'">{{ displayDiffValue(homeSmmExInfo[item]?.[0]?.diffValue || '') }}%</td>
</tr>
<tr class="h30px bg-#fff">
<!-- <td rowspan="2" class="text-14px text-#000 bg-#EDF8FF">{{ item }}</td> -->
<td class="text-14px text-#000">{{ homeSmmExInfo[item]?.[1]?.channel }}</td>
<td class="text-14px text-#000">{{ homeSmmExInfo[item]?.[1]?.negAmount }}</td>
<td class="text-14px text-#000" :class="homeSmmExInfo[item]?.[1]?.diffPrice < 0 ? 'text-#63BF8D' : 'text-red'">{{ displayDiffValue(homeSmmExInfo[item]?.[1]?.diffPrice || '') }}</td>
<td class="text-14px text-#000" :class="homeSmmExInfo[item]?.[1]?.diffValue < 0 ? 'text-#63BF8D' : 'text-red'">{{ displayDiffValue(homeSmmExInfo[item]?.[1]?.diffValue || '') }}%</td>
</tr>
</tbody>
</table>
<div class="flex justify-between items-center my4px">
<div class="text-#fff bg-#002FA7 rounded-5px px18px py6px">汇率</div>
<div class="flex flex-col text-#ACACAC flex-1 justify-end text-end text-13px">
<div class="text- flex justify-end">更新时间<p class="">{{ timeB }}</p class="min-w-200px"></div>
</div>
</div>
<table class="mb10px history w-full text-center text-16px border-spacing-0">
<thead
style="
background-color: #417bef;
color: #fff;
height: 30px;
width: 220px;
border: 1px solid #417bef;
"
>
<tr class="h30px">
<th colspan="0" class="w-22%">币种</th>
<th class="w-32%">最新</th>
<th>前日差</th>
<th>前日比</th>
</tr>
</thead>
<tbody v-if="itemLists" class="">
<tr
class="h30px !text-14px text-center"
v-for="(it, index) in itemLists"
:key="index"
:class="index % 2 !== 0 ? 'bg-#f9f9f9' : ''"
>
<td class="text-center text-#000">
{{ it.currencyNameFrom }}-{{ it.currencyNameTo }}
</td>
<td class="text-center text-#000">{{ it.negAmount }}</td>
<td class="text-center" :class="it.diffPrice < 0 ? 'text-#63BF8D' : 'text-red'">
{{ it.diffPrice > 0 ? "+" + it.diffPrice : it.diffPrice }}
</td>
<td class="text-center" :class="it.diffValue < 0 ? 'text-#63BF8D' : 'text-red'">
{{ displayDiffValue(it.diffValue)+'%' }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
@ -704,7 +871,8 @@ function formatNumber(num = 0) {
<div class="item_title hover:underline">AI差别化LAB</div>
<div class="item_sub-title">责任者开发调达部</div>
<div class="item_sub-title">差别化研究T</div>
<img src="@/assets/images/img-43.png" class="item_img" />
<!-- <img src="@/assets/images/img-43.png" class="item_img" /> -->
<img src="./images/LAB.pic.png" class="item_img w-200px right--10px" />
</div>
<div
class="item !w-full flex flex-col cursor-pointer"

984
src/views/home/Home.vue-b Executable file
View File

@ -0,0 +1,984 @@
<script setup lang="ts">
import VChart from 'vue-echarts'
import { useChart1, useChart22, useChart21, useChart3, useChart23 } from './HomeData'
import AppHeadUserInfo from '@/components/AppHeadUserInfo.vue'
import { NSelect } from 'naive-ui'
import News from './components/New.vue'
import { homePageMarket, homePageRate, report, getHomeList, amountList } from '@/api/daikin/base'
import { useUserStore } from '@/stores/modules/user'
import { useMessage } from 'naive-ui'
const store = useUserStore()
const message = useMessage()
const isUpPwds = ref(false)
const userCode = ref(false)
const useCdView = ref(false)
watchEffect(() => {
userCode.value = ['admin', 'cd_dandang', 'tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
useCdView.value = ['admin', 'cd_view', 'cd_dandang', 'tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
isUpPwds.value = store.user.isUpPwd === 2 ? true : false
})
const activeCard5NavKey = ref('DIS')
const Card5Navs = [
{ key: 'DIS', name: 'DIS' },
{ key: 'DSZ', name: 'DSZ' },
{ key: 'DISH', name: 'DISH' }
]
const ailists = ref()
const culists = ref()
const itemLists = ref()
const timeA = ref()
const timeB = ref()
const disList = ref<any>([{}, {}, {}, {}])
const dszList = ref<any>([{}, {}, {}, {}])
const dishList = ref<any>([{}, {}, {}, {}])
const month_1 = ref()
const month_2 = ref()
const month_3 = ref()
let now = new Date().getMonth() + 13
month_2.value = (now - 2) % 12
month_1.value = (now - 1) % 12
const dataDIS = ref()
const dataDSZ = ref()
const dataDISH = ref()
const addDSZ1 = ref()
const addDIS1 = ref()
const addDISH1 = ref()
const addDSZ2 = ref()
const addDIS2 = ref()
const addDISH2 = ref()
const addDSZ3 = ref()
const addDIS3 = ref()
const addDISH3 = ref()
const timeObj = ref<any>({})
onMounted(async () => {
try {
const {
data: { ailist, culist, lastUTime },
data
} = await homePageMarket() //市况
const {
data: { itemList, lastUTime: _lastUTime }
} = await homePageRate() //汇率
const { data: _disList } = await getHomeList({ number: 'DIS' }) //汇率
const { data: _dszList } = await getHomeList({ number: 'DSZ' }) //汇率
const { data: _dishList } = await getHomeList({ number: 'DISH' }) //汇率
const { data: fazhu } = await amountList()
fazhu.forEach((i: { number: string; amount: any }) => {
// timeObj.value[i.number] = i.modifyTime?.substring(0, 10) || ''
timeObj.value[i.number] = i.updateDate || ''
if (i.number == 'DIS') {
dataDIS.value = i.amount
}
if (i.number == 'DSZ') {
dataDSZ.value = i.amount
}
if (i.number == 'DISH') {
dataDISH.value = i.amount
}
})
ailists.value = ailist
culists.value = culist
itemLists.value = itemList
timeA.value = lastUTime
timeB.value = _lastUTime
disList.value = _disList
dszList.value = _dszList
dishList.value = _dishList
month_1.value = _disList[0].monthDate?.split('-')[1]
month_2.value = _dszList[0].monthDate?.split('-')[1]
month_3.value = _dishList[0].monthDate?.split('-')[1]
addDIS1.value = _disList.reduce((previousValue: any, currentValue: { budget: any }) => {
const sum = parseFloat(currentValue.budget) + parseFloat(previousValue)
// return sum > 0 ? sum.toFixed(2) : 0
return sum
}, 0)
if (_disList[0].budget == _disList[1].budget && addDIS1.value > 0) {
addDIS1.value -= _disList[0].budget
addDIS1.value > 0 ? (addDIS1.value = addDIS1.value.toFixed(2)) : 0
}
addDSZ1.value = _dszList.reduce((previousValue: any, currentValue: { budget: any }) => {
const sum = parseFloat(currentValue.budget) + parseFloat(previousValue)
// return sum > 0 ? sum.toFixed(2) : 0
return sum
}, 0)
if (_dszList[0].budget == _dszList[1].budget && addDSZ1.value > 0) {
addDSZ1.value -= _dszList[0].budget
addDSZ1.value > 0 ? (addDSZ1.value = addDSZ1.value.toFixed(2)) : 0
}
addDISH1.value = _dishList.reduce((previousValue: any, currentValue: { budget: any }) => {
const sum = parseFloat(currentValue.budget) + parseFloat(previousValue)
// return sum > 0 ? sum.toFixed(2) : 0
return sum
}, 0)
if (_dishList[0].budget == _dishList[1].budget && addDISH1.value > 0) {
addDISH1.value -= _dishList[0].budget
addDISH1.value > 0 ? (addDISH1.value = addDISH1.value.toFixed(2)) : 0
}
addDIS2.value = _disList.reduce((previousValue: any, currentValue: { monthOne: any }) => {
const sum = parseFloat(currentValue.monthOne) + parseFloat(previousValue)
// return sum > 0 ? sum.toFixed(2) : 0
return sum
}, 0)
if (_disList[0].monthOne == _disList[1].monthOne && addDIS2.value > 0) {
addDIS2.value -= _disList[0].monthOne
addDIS2.value > 0 ? (addDIS2.value = addDIS2.value.toFixed(2)) : 0
}
addDSZ2.value = _dszList.reduce((previousValue: any, currentValue: { monthOne: any }) => {
const sum = parseFloat(currentValue.monthOne) + parseFloat(previousValue)
// return sum > 0 ? sum.toFixed(2) : 0
return sum
}, 0)
if (_dszList[0].monthOne == _dszList[1].monthOne && addDSZ2.value > 0) {
addDSZ2.value -= _dszList[0].monthOne
addDSZ2.value > 0 ? (addDSZ2.value = addDSZ2.value.toFixed(2)) : 0
}
addDISH2.value = _dishList.reduce((previousValue: any, currentValue: { monthOne: any }) => {
const sum = parseFloat(currentValue.monthOne) + parseFloat(previousValue)
// return sum > 0 ? sum.toFixed(2) : 0
return sum
}, 0)
if (_dishList[0].monthOne == _dishList[1].monthOne && addDISH2.value > 0) {
addDISH2.value -= _dishList[0].monthOne
addDISH2.value > 0 ? (addDISH2.value = addDISH2.value.toFixed(2)) : 0
}
addDIS3.value = _disList.reduce((previousValue: any, currentValue: { monthTwo: any }) => {
const sum = parseFloat(currentValue.monthTwo) + parseFloat(previousValue)
// return sum > 0 ? sum.toFixed(2) : 0
return sum
}, 0)
if (_disList[0].monthTwo == _disList[1].monthTwo && addDIS3.value > 0) {
addDIS3.value -= _disList[0].monthTwo
addDIS3.value > 0 ? (addDIS3.value = addDIS3.value.toFixed(2)) : 0
}
addDSZ3.value = _dszList.reduce((previousValue: any, currentValue: { monthTwo: any }) => {
const sum = parseFloat(currentValue.monthTwo) + parseFloat(previousValue)
// return sum > 0 ? sum.toFixed(2) : 0
return sum
}, 0)
if (_dszList[0].monthTwo == _dszList[1].monthTwo && addDSZ3.value > 0) {
addDSZ3.value -= _dszList[0].monthTwo
addDSZ3.value > 0 ? (addDSZ3.value = addDSZ3.value.toFixed(2)) : 0
}
addDISH3.value = _dishList.reduce((previousValue: any, currentValue: { monthTwo: any }) => {
const sum = parseFloat(currentValue.monthTwo) + parseFloat(previousValue)
// return sum > 0 ? sum.toFixed(2) : 0
return sum
}, 0)
if (_dishList[0].monthTwo == _dishList[1].monthTwo && addDISH3.value > 0) {
addDISH3.value -= _dishList[0].monthTwo
addDISH3.value > 0 ? (addDISH3.value = addDISH3.value.toFixed(2)) : 0
}
if (isUpPwds.value) {
ElMessageBox.alert('为了您的帐号安全,此次登录必须更改密码', '重要提醒', {
confirmButtonText: 'OK',
showClose: false,
showCancelButton: false
}).then(() => {
push({ name: 'modifys' })
})
}
report({ moduleCode: 'App_Home' })
} catch (error) {}
})
const { push } = useRouter()
const route = useRoute()
const timeNow = useDateFormat(useNow(), 'YYYY-MM-DD')
const { chartRef: chartRef1, option: chartOption1 } = useChart1()
const { chartRef: chartRef2, option: chartOption2, state } = useChart21()
const { chartRef: chartRef22, option: chartOption22 } = useChart22()
const { chartRef: chartRef23, option: chartOption23 } = useChart23()
const { chartRef: chartRef3, option: chartOption3 } = useChart3()
const displayDiffValue = (diffValue: number) => {
// return diffValue + '%'
if (diffValue > 0) {
return `+${diffValue}%`
} else if (diffValue < 0) {
return `-${Math.abs(diffValue)}%`
} else {
// return `${formatNumber(diffValue)} %`
return `${diffValue}%`
}
}
async function setModule(codes: any, names: any) {
const moduleCode = codes
console.log(codes, names)
if (names == 'CD' && !useCdView.value) {
return message.info('没有访问权限!')
}
push({ name: names })
const { code } = await report({ moduleCode })
}
const selectData = ref('原材料')
const option = [
{
label: '全部数据',
value: 'quanbu'
},
{
label: '原材料',
value: 'yuancailiao'
},
{
label: '加工品',
value: 'jiagongping'
},
{
label: '机能部品',
value: 'jineng'
}
]
const thisSelect = (e) => {
console.log(e)
state.title = e
}
function formatNumber(num = 0) {
num = +num
const roundedNum: string = num.toFixed(2)
const [wholePart, decimalPart] = roundedNum.split('.')
const formattedDecimalPart = decimalPart.padEnd(2, '0')
return `${wholePart}.${formattedDecimalPart}`
}
</script>
<template>
<div class="top flex items-center text-20px">
<div class="flex-1 font-800 text-30px"></div>
<AppHeadUserInfo />
</div>
<div class="page-wrapper h-full flex-1 flex flex-col flex-wrap">
<div class="font-800 text-30px mt39px">
<!-- FY23年度调达本部方针创新实干勇毅前行以综合实力挑战变革提升存在感 -->
FY24年度公司方针提升全员价值直击一切困难
</div>
<div class="mt30px flex-1 flex flex-wrap justify-between">
<News></News>
<div class="card">
<div
class="card_title cursor-pointer hover:underline"
@click="setModule('App_Market', 'Market')"
>
市况汇率 每日更新
</div>
<div class="card_nav card_nav2 !top--3px !right--1px">
<div class="!text-14px w260px top--4px text-right leading-18px">
出处:市况-SMM/LME<br />
汇率-外汇管理局
</div>
</div>
<!-- <div class="card_sub-title">责任者:调达中心 Device变革T/原材料变革T</div> -->
<div class="card_content">
<!-- <VChart :option="chartOption1" autoresize /> -->
<div class="flex pl15px pr10px pt15px text-#898F9F-1 text-#152242">
<div class="">
<span class="icoT">市况</span>
<span class="ml10px text-14px">更新时间:{{ timeA }}</span>
<div class="h150px overflow-auto">
<table class="history w-full text-center mt18px text-16px border-spacing-0 w219px">
<thead
style="
background-color: #417bef;
color: #fff;
height: 42px;
width: 220px;
border: 1px solid #417bef;
"
>
<tr class="h41px">
<th>铜</th>
<th>最新</th>
<th>前日差</th>
</tr>
</thead>
<tbody v-if="culists">
<tr
class="h45px"
v-for="(it, index) in culists"
:key="index"
:class="index % 2 !== 0 ? 'bg-#f9f9f9' : ''"
>
<td class="text-14px">{{ it.channel }}</td>
<td class="text-14px">{{ it.negAmount }}</td>
<td class="text-14px" :class="it.diffValue < 0 ? 'text-#63BF8D' : 'text-red'">
{{ displayDiffValue(it.diffValue) }}
</td>
</tr>
</tbody>
</table>
</div>
<div class="h150px overflow-auto">
<table
class="history w-full text-center mt15px text-16px border-spacing-0 overflow-auto w219px"
>
<thead
style="
background-color: #417bef;
color: #fff;
height: 42px;
width: 220px;
border: 1px solid #417bef;
"
>
<tr class="h41px">
<th>铝</th>
<th>最新</th>
<th>前日差</th>
</tr>
</thead>
<tbody v-if="ailists">
<tr
class="h45px"
v-for="(it, index) in ailists"
:key="index"
:class="index % 2 !== 0 ? 'bg-#f9f9f9' : ''"
>
<td class="text-14px">{{ it.channel }}</td>
<td class="text-14px">{{ it.negAmount }}</td>
<td class="text-14px" :class="it.diffValue < 0 ? 'text-#63BF8D' : 'text-red'">
{{ displayDiffValue(it.diffValue) }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="ml10px">
<span class="icoT">汇率</span>
<span class="ml10px text-14px">更新时间:{{ timeB }}</span>
<div class="h282px pt18px">
<table class="history w-full text-center text-16px border-spacing-0 w219px">
<thead
style="
background-color: #417bef;
color: #fff;
height: 42px;
width: 220px;
border: 1px solid #417bef;
"
>
<tr class="h41px">
<th class="w75px">币种</th>
<th>最新</th>
<th class="w65px">前日差</th>
</tr>
</thead>
<tbody v-if="itemLists" class="h238px overflow-auto absolute">
<tr
class="h60px !text-14px"
v-for="(it, index) in itemLists"
:key="index"
:class="index % 2 !== 0 ? 'bg-#f9f9f9' : ''"
>
<td class="w75px text-center">
{{ it.currencyNameFrom }}-{{ it.currencyNameTo }}
</td>
<td class="w85px text-center">{{ it.negAmount }}</td>
<td
class="w65px text-center"
:class="it.diffValue < 0 ? 'text-#63BF8D' : 'text-red'"
>
{{ displayDiffValue(it.diffValue) }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="card">
<div
class="card_title cursor-pointer hover:underline"
@click="setModule('App_data_platform', 'CD')"
>
数据平台
</div>
<!-- <div class="card_sub-title">责任者:调达中心 企画变革T</div> -->
<div class="card_nav card_nav1">
<div
class="card_nav_item cursor-pointer hover:underline"
:class="activeCard5NavKey === i.key && 'active'"
v-for="i in Card5Navs"
:key="i.name"
@click="() => (activeCard5NavKey = i.key)"
>
{{ i.name }}
</div>
</div>
<div class="table-container">
<el-button
v-if="userCode"
type="primary"
class="button abs-top"
@click="push({ name: 'dataPlatform' })"
>数据管理</el-button
>
<div
class="block p-[10px] pr-0 absolute top-[4px] right-[36px] font-normal h-[20px] !text-[16px] text-[#000]"
>
更新日:{{ timeObj[activeCard5NavKey] }}
</div>
<table class="data-table" border v-if="activeCard5NavKey === 'DIS'">
<colgroup>
<col width="20%" />
<col width="20%" />
<col width="20%" />
<col width="20%" />
<col width="20%" />
</colgroup>
<tr class="header">
<th rowspan="2" colspan="2">拠点</th>
<td colspan="3">
<div class="tab-header">
<div class="tb-title">DIS</div>
<div class="tb-subtitle">发注金额:{{ dataDIS }}百万元</div>
</div>
</td>
</tr>
<tr class="header">
<td>年初予算</td>
<!-- <td>{{month_2}}月</td> -->
<td>改订</td>
<td>{{ +month_1 }}月</td>
</tr>
<tr>
<th colspan="2">合计</th>
<td>{{ formatNumber(addDIS1) }}%</td>
<td>{{ formatNumber(addDIS2) }}%</td>
<td>{{ formatNumber(addDIS3) }}%</td>
</tr>
<tr>
<th rowspan="2">C/D</th>
<th>交涉</th>
<td :rowspan="disList[0].budget == disList[1].budget ? '2' : ''">
{{ formatNumber(disList[0].budget) }}%
</td>
<td :rowspan="disList[0].monthOne == disList[1].monthOne ? '2' : ''">
{{ formatNumber(disList[0].monthOne) }}%
</td>
<td :rowspan="disList[0].monthTwo == disList[1].monthTwo ? '2' : ''">
{{ formatNumber(disList[0].monthTwo) }}%
</td>
</tr>
<tr>
<th>THEME</th>
<td v-if="disList[1].budget != disList[0].budget">
{{ formatNumber(disList[1].budget) }}%
</td>
<td v-if="disList[1].monthOne != disList[0].monthOne">
{{ formatNumber(disList[1].monthOne) }}%
</td>
<td v-if="disList[1].monthTwo != disList[0].monthTwo">
{{ formatNumber(disList[1].monthTwo) }}%
</td>
</tr>
<tr>
<th colspan="2">市况</th>
<td>{{ formatNumber(disList[2].budget) }}%</td>
<td>{{ formatNumber(disList[2].monthOne) }}%</td>
<td>{{ formatNumber(disList[2].monthTwo) }}%</td>
</tr>
<tr>
<th colspan="2">為替レート</th>
<td>{{ formatNumber(disList[3].budget) }}%</td>
<td>{{ formatNumber(disList[3].monthOne) }}%</td>
<td>{{ formatNumber(disList[3].monthTwo) }}%</td>
</tr>
</table>
<table class="data-table" border v-if="activeCard5NavKey === 'DSZ'">
<colgroup>
<col width="20%" />
<col width="20%" />
<col width="20%" />
<col width="20%" />
<col width="20%" />
</colgroup>
<tr class="header">
<th rowspan="2" colspan="2">抛点</th>
<td colspan="3">
<div class="tab-header">
<div class="tb-title">DSZ</div>
<div class="tb-subtitle">发注金额:{{ dataDSZ }}百万元</div>
</div>
</td>
</tr>
<tr class="header">
<td>年初予算</td>
<!-- <td>{{month_2}}月</td> -->
<td>改订</td>
<td>{{ +month_2 }}月</td>
</tr>
<tr>
<th colspan="2">合计</th>
<td>{{ formatNumber(addDSZ1) }}%</td>
<td>{{ formatNumber(addDSZ2) }}%</td>
<td>{{ formatNumber(addDSZ3) }}%</td>
</tr>
<tr>
<th rowspan="2">C/D</th>
<th>交涉</th>
<td :rowspan="dszList[0].budget == dszList[1].budget ? '2' : ''">
{{ formatNumber(dszList[0].budget) }}%
</td>
<td :rowspan="dszList[0].monthOne == dszList[1].monthOne ? '2' : ''">
{{ formatNumber(dszList[0].monthOne) }}%
</td>
<td :rowspan="dszList[0].monthTwo == dszList[1].monthTwo ? '2' : ''">
{{ formatNumber(dszList[0].monthTwo) }}%
</td>
</tr>
<tr>
<th>THEME</th>
<td v-if="dszList[1].budget != dszList[0].budget">
{{ formatNumber(dszList[1].budget) }}%
</td>
<td v-if="dszList[1].monthOne != dszList[0].monthOne">
{{ formatNumber(dszList[1].monthOne) }}%
</td>
<td v-if="dszList[1].monthTwo != dszList[0].monthTwo">
{{ formatNumber(dszList[1].monthTwo) }}%
</td>
</tr>
<tr>
<th colspan="2">市况</th>
<td>{{ formatNumber(dszList[2].budget) }}%</td>
<td>{{ formatNumber(dszList[2].monthOne) }}%</td>
<td>{{ formatNumber(dszList[2].monthTwo) }}%</td>
</tr>
<tr>
<th colspan="2">為替レート</th>
<td>{{ formatNumber(dszList[3].budget) }}%</td>
<td>{{ formatNumber(dszList[3].monthOne) }}%</td>
<td>{{ formatNumber(dszList[3].monthTwo) }}%</td>
</tr>
</table>
<table class="data-table" border v-if="activeCard5NavKey === 'DISH'">
<colgroup>
<col width="20%" />
<col width="20%" />
<col width="20%" />
<col width="20%" />
<col width="20%" />
</colgroup>
<tr class="header">
<th rowspan="2" colspan="2">抛点</th>
<td colspan="3">
<div class="tab-header">
<div class="tb-title">DISH</div>
<div class="tb-subtitle">发注金额:{{ dataDISH }}百万元</div>
</div>
</td>
</tr>
<tr class="header">
<td>年初予算</td>
<!-- <td>{{month_2}}月</td> -->
<td>改订</td>
<td>{{ +month_3 }}月</td>
</tr>
<tr>
<th colspan="2">合计</th>
<td>{{ formatNumber(addDISH1) }}%</td>
<td>{{ formatNumber(addDISH2) }}%</td>
<td>{{ formatNumber(addDISH3) }}%</td>
</tr>
<tr>
<th rowspan="2">C/D</th>
<th>交涉</th>
<td :rowspan="dishList[0].budget == dishList[1].budget ? '2' : ''">
{{ formatNumber(dishList[0].budget) }}%
</td>
<td :rowspan="dishList[0].monthOne == dishList[1].monthOne ? '2' : ''">
{{ formatNumber(dishList[0].monthOne) }}%
</td>
<td :rowspan="dishList[0].monthTwo == dishList[1].monthTwo ? '2' : ''">
{{ formatNumber(dishList[0].monthTwo) }}%
</td>
</tr>
<tr>
<th>THEME</th>
<td v-if="dishList[1].budget != dishList[0].budget">
{{ formatNumber(dishList[1].budget) }}%
</td>
<td v-if="dishList[1].monthOne != dishList[0].monthOne">
{{ formatNumber(dishList[1].monthOne) }}%
</td>
<td v-if="dishList[1].monthTwo != dishList[0].monthTwo">
{{ formatNumber(dishList[1].monthTwo) }}%
</td>
</tr>
<tr>
<th colspan="2">市况</th>
<td>{{ formatNumber(dishList[2].budget) }}%</td>
<td>{{ formatNumber(dishList[2].monthOne) }}%</td>
<td>{{ formatNumber(dishList[2].monthTwo) }}%</td>
</tr>
<tr>
<th colspan="2">為替レート</th>
<td>{{ formatNumber(dishList[3].budget) }}%</td>
<td>{{ formatNumber(dishList[3].monthOne) }}%</td>
<td>{{ formatNumber(dishList[3].monthTwo) }}%</td>
</tr>
</table>
<!-- <img src="@/assets/images/xiaogouzi1.jpg" class="w-full h-full cover" v-if="activeCard5NavKey === 'DSZ'"/>
<img src="@/assets/images/xiaogouzi2.jpg" class="w-full h-full cover" v-if="activeCard5NavKey === 'DISH'"/> -->
<!-- <img src="@/assets/images/xiaogouzi3.jpg" class="w-full h-full cover" v-if="activeCard5NavKey === 'DIS'"/> -->
</div>
<!-- <div class="card_content">
<VChart ref="chartRef3" :option="chartOption3" autoresize />
</div> -->
</div>
<div class="card" @click="setModule('App_BCP', 'BCP')">
<div class="card_title cursor-pointer hover:underline">调达BCP管理</div>
<div class="card_sub-title">责任者:调达部 加工品变革T</div>
<div class="card_content">
<img src="@/assets/images/img-11.png" class="w-full h-full object-cover" />
</div>
</div>
<div class="card relative">
<!-- <img src="@/assets/images/img-42.png" class="absolute top-10px right-0" /> -->
<div class="card_title cursor-pointer hover:underline" @click="setModule('App_CSR', 'CSR')">
SCM碳中和活动
</div>
<div class="card_sub-title" @click="setModule('App_CSR', 'CSR')">
责任者:开发调达部 调达机能研究T
</div>
<div class="card_content px20px" @click="setModule('App_CSR', 'CSR')">
<img src="../../assets/images/scmtzh@2x.png" class="w-full h-96% cover" />
<!-- <div class="flex text-center">
<div class="bg-#F4F8FF text-#000 h30px w-full pt5px font-bold">F25碳减排目标 <el-icon class="!text-#004DE1">
<CaretTop />
</el-icon>30%</div>
<div class="bg-#F4F8FF text-#000 h30px w-full pt5px font-bold">F23碳减排目标 <el-icon class="!text-#004DE1">
<CaretTop />
</el-icon>15%</div>
</div>
<div class="flex text-center">
<div class=" text-#677BB2 h30px w-full pt5px font-500">供方碳排放推移表</div>
<div class=" text-#677BB2 h30px w-full pt5px font-500 flex"><span>重点供方碳排放情况</span>
<n-select v-model:value="selectData" :options="option" class="w80px !text-12px h20px mt--4px" :show-checkmark="false" size="tiny"
@update:value="thisSelect" />
</div>
</div>
<div class="flex w-full h-full">
<div class="w150px h-full">
<VChart :option="chartOption1" />
</div>
<div class="w280px h275px overflow-y-auto">
<VChart :option="chartOption2" />
</div>
</div> -->
<!-- <div class="mt25px text-#142142"> -->
<!-- <img src="@/assets/images/tiad@2x.png" class="w100% h96%" /> -->
<!-- <div class="text-#002fa7 text-18px">大金中国调达本部紧扣大金集团2050愿景中CO2“零”排放目标展开调达碳中和活动</div>
<AppNewsBox class="mt10px" text="脱碳素供应链管理(原材料排放,部品加工·部品运输过程中的排放)
空调解决方案(部品碳足迹管理,贩促活动,案例情报共享)" date="2023-05-22" /> -->
<!-- </div> -->
<!-- <div class="mt25px text-#142142">
<div class="text-#002fa7 text-18px">人材育成</div>
<AppNewsBox class="mt10px" text="FY22年度集团新年方针:领先时代的变化开创崭新的未来变化开 创崭新的未来" date="2023-05-22" />
</div>
<div class="mt25px text-#142142">
<div class="text-#002fa7 text-18px">工作模式变革</div>
<AppNewsBox class="mt10px" text="FY22年度集团新年方针:领先时代的变化开创崭新的未来变化开 创崭新的未来" date="2023-05-22" />
</div> -->
</div>
</div>
<div class="card topics">
<div class="card_title cursor-pointer hover:underline">重点Theme取组</div>
<div class="card_content p20px pt10px">
<div
class="w-full h-full flex flex-wrap content-between justify-between text-18px font-bold"
>
<div class="item !h-188px cursor-pointer" @click="setModule('App_Quality', 'Quality')">
<div class="item_title hover:underline">品质</div>
<div class="item_sub-title">责任者:调达部 企画管理T</div>
<!-- <img src="@/assets/images/img-45.svg" class="item_img pb13px pr20px" /> -->
<img src="@/assets/images/img-41.png" class="item_img b !bottom--20px" />
</div>
<div class="item !h-188px cursor-pointer" @click="setModule('App_Lab', 'Diffspace')">
<div class="item_title hover:underline">AI差别化LAB</div>
<div class="item_sub-title">责任者:开发调达部</div>
<div class="item_sub-title">差别化研究T</div>
<!-- <img src="@/assets/images/img-43.png" class="item_img" /> -->
<img src="./images/LAB.pic.png" class="item_img w-200px right--10px" />
</div>
<div
class="item !w-full flex flex-col cursor-pointer"
@click="push({ name: 'StrategicPlanning' })"
>
<div class="item_title hover:underline">战略企划</div>
<div class="item_sub-title">责任者:调达本部 管理G</div>
<!-- <img src="./images/home-1.svg" /> -->
<div class="flex mt20px items-center justify-center">
<div class="bg-#0038BE w210px px15px py7px rounded-30px">
<img src="@/assets/images/biaoq2@2x.png" class="w25px h21px" />
重点Theme管理
</div>
<span class="text-#000 font-thin underline-text mx23px hover:underline-solid"
>开发调达部</span
>
<span class="text-#000 font-thin underline-text hover:underline-solid">调达部</span>
<!-- <VChart :option="chartOption2" autoresize /> -->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<style scoped lang="less">
.tab-header {
display: flex;
.tb-title {
margin: 0 auto;
}
.tb-subtitle {
margin-right: 8px;
font-size: 0.75em;
}
}
.table-container {
padding: 0 36px;
padding-top: 40px;
position: relative;
}
.data-table {
width: 100%;
color: #808696;
border-collapse: collapse;
line-height: 2.3rem;
text-align: center;
border-color: #e0e0e0;
background: white;
}
.table-container .abs-top {
position: absolute;
left: 36px;
top: 4px;
}
.data-table tr:nth-child(2n + 1) {
background: #f9f9f9;
}
.data-table th {
background: #f4f5ff;
color: #142142;
}
.data-table tr.header,
.data-table tr.header th {
background: #417bef;
color: white;
}
::-webkit-scrollbar {
width: 1px;
}
::v-deep .n-base-select .n-base-select-option {
font-size: 12px; /* 设置字体大小 */
}
.naive-select .n-select-dropdown {
font-size: 12px; /* 设置字体大小 */
}
.underline-text {
border-bottom: 1px solid black;
padding-bottom: 2px;
}
.icoT {
padding: 5px;
color: #fff;
background-color: #002aae;
border-radius: 5px;
}
.top {
position: absolute;
right: 30px;
top: -70px;
}
.page-wrapper {
.card {
// width: 480px;
// height: 428px;
width: 480px;
height: 395px;
border-radius: 18px;
overflow: hidden;
background-color: #fff;
// border: 1px solid #e7ebf5;
box-shadow: 1px 2px 12px rgba(14, 86, 221, 0.32);
position: relative;
display: flex;
flex-direction: column;
position: relative;
&::after {
content: ' ';
background-image: url('@/assets/images/bg-card.svg');
pointer-events: none;
display: block;
width: 100%;
height: 127px;
background-size: cover;
position: absolute;
left: 0;
top: -1px;
}
.card_title {
flex-shrink: 0;
font-size: 28px;
color: #142142;
padding: 20px;
padding-bottom: 0;
}
.card_sub-title {
color: rgba(128, 134, 150, 0.8);
font-size: 16px;
padding: 0 20px;
padding-bottom: 0;
margin-top: 10px;
}
.card_nav1 {
background-image: url('@/assets/images/bg-card-nav.svg');
}
.card_nav2 {
background-image: url('@/assets/images/youj@2x.png');
}
.card_nav {
position: absolute;
top: 0;
right: 0;
width: 276px;
height: 66px;
background-position: top right;
background-repeat: no-repeat;
background-size: contain;
font-size: 20px;
color: #fff;
display: flex;
justify-content: space-between;
align-items: flex-end;
padding-left: 38px;
padding-right: 22px;
padding-bottom: 20px;
.card_nav_item {
width: 80px;
height: 36px;
text-align: center;
padding-top: 8px;
cursor: pointer;
&.active {
color: #032fa0;
background-image: url('@/assets/images/bg-card-nav-item.svg');
background-position: bottom;
background-repeat: no-repeat;
background-size: contain;
}
}
}
.card_content {
flex: 1;
margin-top: 10px;
}
}
.topics {
.item {
border-radius: 8px;
width: 210px;
height: 155px;
box-shadow: inset 1.4px 1.4px 0px 0px rgba(255, 255, 255, 0.004);
overflow: hidden;
background-image: url('@/assets/images/bg-card4.svg');
background-position: -2px -2px;
background-repeat: no-repeat;
background-size: 215px 165px;
position: relative;
.item_title {
padding-left: 16px;
padding-top: 22px;
color: #002fa7;
position: relative;
// z-index: 9;
}
.item_sub-title {
color: rgba(128, 134, 150, 0.8);
font-size: 12px;
font-weight: normal;
padding: 0 16px;
padding-bottom: 0;
margin-top: 10px;
z-index: 9;
}
.item_img {
position: absolute;
bottom: -10px;
right: 0;
// z-index: 5;
transition: transform 0.3s;
&:hover {
transform: scale(1.2);
}
}
}
}
.news {
.card_content {
padding: 20px;
padding-top: 0;
}
.news_card {
// width: 442px;
height: 180px;
padding: 16px;
font-size: 14px;
background-repeat: no-repeat;
background-size: 100% 100%;
position: relative;
}
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -1,140 +1,135 @@
<template>
<div @mousemove="handleMouseMove">
<ul id="ul1">
<li v-for="index in numCards" :key="index" ref="cards">
<p class="pt10px pb10px text-15px">大金数据</p>
<span class="text-12px leading-15px">大金数据数据数据数据数据</span>
</li>
<div id="earth" class="earth"></div>
</ul>
</div>
<div @mousemove="handleMouseMove">
<ul id="ul1">
<li v-for="index in numCards" :key="index" ref="cards">
<p class="pt10px pb10px text-15px">大金数据</p>
<span class="text-12px leading-15px">大金数据数据数据数据数据</span>
</li>
<div id="earth" class="earth"></div>
</ul>
</div>
</template>
<script setup lang="ts">
const numCards = ref(9);
const mouseX = ref(0);
const mouseY = ref(0);
const isDragging = ref(false);
<script setup lang="ts">
const numCards = ref(9)
const mouseX = ref(0)
const mouseY = ref(0)
const isDragging = ref(false)
const handleMouseMove = (event) => {
const rect = event.currentTarget.getBoundingClientRect();
mouseX.value = event.clientX - rect.left;
mouseY.value = event.clientY - rect.top;
};
const rect = event.currentTarget?.getBoundingClientRect()
mouseX.value = event.clientX - rect.left
mouseY.value = event.clientY - rect.top
}
const updateRotation = () => {
const cardRefs = ref([]);
const earth = ref(null);
const cardRefs = ref([])
const earth = ref(null)
onMounted(() => {
cardRefs.value = document.querySelectorAll('#ul1 li');
earth.value = document.getElementById('earth');
cardRefs.value = document.querySelectorAll('#ul1 li')
earth.value = document.getElementById('earth')
setInterval(() => {
cardRefs.value.forEach((card, index) => {
const d = (360 / numCards.value) * index + mouseX.value / 10;
card.style.transform = `rotateY(${d}deg) translateZ(350px)`;
const d = (360 / numCards.value) * index + mouseX.value / 10
card.style.transform = `rotateY(${d}deg) translateZ(350px)`
if (Math.abs(d) < 30) {
card.style.zIndex = 2;
card.style.zIndex = 2
if (earth.value) {
earth.value.style.transform = 'translateZ(-400px)';
earth.value.style.transform = 'translateZ(-400px)'
}
} else {
card.style.zIndex = -1;
card.style.zIndex = -1
if (earth.value) {
earth.value.style.transform = 'translateZ(400px)';
earth.value.style.transform = 'translateZ(400px)'
}
}
});
}, 30);
});
};
})
}, 30)
})
}
const autoRotate = () => {
const interval = setInterval(() => {
if (!isDragging.value) {
//
rotationY.value += 1;
rotationY.value += 1
}
}, 30);
}, 30)
onMounted(() => {
clearInterval(interval);
});
};
clearInterval(interval)
})
}
updateRotation();
autoRotate();
updateRotation()
autoRotate()
</script>
<style lang="less">
* {
margin: 0;
padding: 0;
list-style: none;
margin: 0;
padding: 0;
list-style: none;
}
html {
overflow: hidden;
overflow: hidden;
}
body {
background: #000;
background: #000;
}
#ul1 {
position: relative;
width: 110px;
height: 75px;
margin: 190px auto;
background: none;
transform-style: preserve-3d;
transform: perspective(1320px) rotateX(-15deg) rotateY(0deg);
position: relative;
width: 110px;
height: 75px;
margin: 190px auto;
background: none;
transform-style: preserve-3d;
transform: perspective(1320px) rotateX(-15deg) rotateY(0deg);
}
#ul1 li {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
transition: 1s all ease;
transform: rotateY(0deg) translateZ(0px);
border-radius: 10px;
overflow: hidden;
background: rgba(14, 116, 238, 0.8);
color: rgb(255, 255, 255);
line-height: 10px;
text-align: center;
/* font-size: 30px; */
p{
font-size: 15px;
}
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
transition: 1s all ease;
transform: rotateY(0deg) translateZ(0px);
border-radius: 10px;
overflow: hidden;
background: rgba(14, 116, 238, 0.8);
color: rgb(255, 255, 255);
line-height: 10px;
text-align: center;
/* font-size: 30px; */
p {
font-size: 15px;
}
}
#ul1 li img {
width: 100%;
width: 100%;
}
#earth {
position: absolute;
top: 2%;
left: 50%;
width: 260px;
height: 260px;
margin-top: -222px;
margin-left: -130px;
border-radius: 50%;
background-image: url('./images/diqiu.png');
background-size: cover;
transform-style: preserve-3d;
transform: translateZ(400px);
z-index: 1;
transition: transform 0.5s ease;
position: absolute;
top: 2%;
left: 50%;
width: 260px;
height: 260px;
margin-top: -222px;
margin-left: -130px;
border-radius: 50%;
background-image: url('./images/diqiu.png');
background-size: cover;
transform-style: preserve-3d;
transform: translateZ(400px);
z-index: 1;
transition: transform 0.5s ease;
}
</style>

View File

@ -1,13 +1,14 @@
<template>
<div @mousemove="handleMouseMove">
<ul id="ul1">
<li class="ation-li" v-for="(item, index) in props.dataE" :key="index" ref="cards">
<div class="pt10px pb10px text-15px title">{{item.title}}</div>
<div class="text-12px leading-15px sub-title" @click="downloadHandle(item)">{{item.content}}</div>
</li>
<div id="earth" class="earth"></div>
</ul>
<ul id="ul1">
<li class="ation-li" v-for="(item, index) in props.dataE" :key="index" ref="cards">
<div class="pt10px pb10px text-15px title">{{ item.title }}</div>
<div class="text-12px leading-15px sub-title" @click="downloadHandle(item)">
{{ item.content }}
</div>
</li>
<div id="earth" class="earth"></div>
</ul>
</div>
</template>
@ -19,86 +20,80 @@ const downloadHandle = (item) => {
emit('downloadHandle', item, 5)
}
const props = defineProps({//
dataE:{
type:Array,//
default:[],//
}
const props = defineProps({
//
dataE: {
type: Array, //
default: [] //
}
})
const numCards = ref(10);
const mouseX = ref(0);
const mouseY = ref(0);
const isDragging = ref(false);
const numCards = ref(10)
const mouseX = ref(0)
const mouseY = ref(0)
const isDragging = ref(false)
const handleMouseMove = (event) => {
const rect = event.currentTarget.getBoundingClientRect();
mouseX.value = event.clientX - rect.left;
mouseY.value = event.clientY - rect.top;
};
const rect = event.currentTarget?.getBoundingClientRect()
mouseX.value = event.clientX - rect.left
mouseY.value = event.clientY - rect.top
}
watch(
() => props.dataE,
(newValue, oldValue) => {
nextTick(() => {
updateRotation();
updateRotation()
// autoRotate();
})
}
)
const updateRotation = () => {
const cardRefs = ref([]);
const earth = ref(null);
cardRefs.value = document.querySelectorAll('#ul1 li');
earth.value = document.getElementById('earth');
const cardRefs = ref([])
const earth = ref(null)
cardRefs.value = document.querySelectorAll('#ul1 li')
earth.value = document.getElementById('earth')
console.log(cardRefs, 1111)
setInterval(() => {
numCards.value = cardRefs.value.length;
numCards.value = cardRefs.value.length
cardRefs.value.forEach((card, index) => {
const d = (360 / numCards.value) * index + mouseX.value / 10;
let radian = d * Math.PI / 180;
let opacity = (Math.cos(radian) + 1) / 2;
card.style.transform = `rotateY(${d}deg) translateZ(280px) rotateY(${-d}deg)`;
card.style.opacity = opacity * opacity;
const d = (360 / numCards.value) * index + mouseX.value / 10
let radian = (d * Math.PI) / 180
let opacity = (Math.cos(radian) + 1) / 2
card.style.transform = `rotateY(${d}deg) translateZ(280px) rotateY(${-d}deg)`
card.style.opacity = opacity * opacity
if (Math.abs(d) < 30) {
card.style.zIndex = 2;
card.style.zIndex = 2
if (earth.value) {
earth.value.style.transform = 'translateZ(-400px)';
earth.value.style.transform = 'translateZ(-400px)'
}
} else {
card.style.zIndex = -1;
card.style.zIndex = -1
if (earth.value) {
earth.value.style.transform = 'translateZ(400px)';
earth.value.style.transform = 'translateZ(400px)'
}
}
});
}, 30);
};
})
}, 30)
}
const autoRotate = () => {
const interval = setInterval(() => {
if (!isDragging.value) {
//
mouseY.value += 1;
mouseY.value += 1
}
}, 30);
}, 30)
onMounted(() => {
clearInterval(interval);
});
};
clearInterval(interval)
})
}
</script>
<style lang="less">
* {
margin: 0;
@ -135,15 +130,14 @@ body {
border-radius: 10px;
overflow: hidden;
// background: rgba(14, 116, 238, 0.8);
background-image: url("./images/biaoq.png");
background-image: url('./images/biaoq.png');
color: rgb(255, 255, 255);
line-height: 10px;
text-align: center;
padding: 8px 8px 40px;
/* font-size: 30px; */
p{
font-size: 15px;
p {
font-size: 15px;
}
}
@ -176,7 +170,7 @@ body {
color: white;
}
.sub-title {
color: #00E4FF;
color: #00e4ff;
text-align: start;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

479
src/views/home/cd/CD-bak1.vue Executable file
View File

@ -0,0 +1,479 @@
<!-- C/D数据 -->
<script setup lang="ts">
import { hisYearData, curYearData, useChart3, defineCompont } from './CdData'
import { treeList } from '@/api/daikin/base'
import HomeHead from '@/views/home/components/HomeHead.vue'
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import CDSide from './CDSide.vue'
import { NForm, NFormItem, useMessage, NSelect, NButton } from 'naive-ui'
import develop from '../develop.vue'
import type { FormInst } from 'naive-ui'
const { push } = useRouter()
const message = useMessage()
const radioss = ref(2020)
const { chartRef: chartRef1, option: chartOption1 } = curYearData()
const { chartRef: chartRef2, option: chartOption2, state } = hisYearData()
const { chartRef: chart1, option: chartOp1 } = useChart3()
const { clickData, toYearData, hisData } = defineCompont()
const treeData = ref<any>()
async function getData() {
const { data } = await treeList()
const dataList = transformData(data)
console.log(dataList)
treeData.value = dataList
}
function transformData(data, parentKey = '') {
let keyIndex = 1
return data.map((item) => {
const key = parentKey ? `${parentKey}-${keyIndex}` : `${item.id}`
keyIndex++
const transformedItem = {
label: item.name,
key: key,
level: parentKey ? parentKey.split('-').length + 1 : 1,
id: item.id
}
const treeList = transformTreeList(item.treeList, key)
if (treeList.length > 0) {
transformedItem.treeList = treeList
}
return transformedItem
})
}
function transformTreeList(treeList, parentKey) {
if (!treeList || treeList.length === 0) {
return []
}
let keyIndex = 1
return treeList.map((item) => {
const key = `${parentKey.split('-').length + 1}-${keyIndex}`
keyIndex++
const transformedItem = {
label: item.name,
key: key,
level: parentKey.split('-').length + 1,
id: item.id
}
const childTreeList = transformTreeList(item.treeList, key)
if (childTreeList.length > 0) {
transformedItem.treeList = childTreeList
}
return transformedItem
})
}
let formValue = ref({
name: '',
age: '',
phone: '',
phone1: ''
})
const formRef = ref<FormInst | null>(null)
const handleValidateClick = (e: MouseEvent) => {
e.preventDefault()
formRef.value?.validate((errors) => {
if (!errors) {
// message.success('Valid')
} else {
console.log(errors)
// message.error('Invalid')
}
})
}
let options = [
{
label: '据点总体',
value: 'song0'
},
{
label: 'DIS',
value: 'song1'
}
]
const checkedValueRef = ref<string | null>(null)
const handleChange = (e: Event) => {
state.cateId = 1
state.yearTime = e
console.log(e)
}
//
const handleChild = (id: any) => {
// console.log(data)
clickData.id = id
}
getData()
</script>
<template>
<!-- <develop/> -->
<HomeHead class="top"> </HomeHead>
<div class="h-full relative flex flex-col">
<div class="font-600 text-36px mt29px">C/D数据11</div>
<div class="q-wrapper flex-1 h957.9px mt30px text-#142142 flex flex-col gap-22px bg-#fff">
<div class="data1 flex gap-26px">
<div class="cd_plan flex-1 pl32px pr33px pt25px pb10px">
<div class="title ml19px font-bold text-24px">FY23 中国域各据点 C/D进度</div>
<div class="text-20px mt21px mb17px font-600">发注金额</div>
<div class="">
<table
style="border: 1px solid #ededed"
class="w-full text-center h295px border-spacing-0 text-16px fazhu"
>
<thead style="background-color: #417bef; color: #fff">
<tr class="h41px">
<th rowspan="2" colspan="2">据点</th>
<th colspan="2">据点</th>
<th colspan="2">苏州</th>
<th colspan="2">惠州</th>
</tr>
<tr class="h41px">
<th>FY23</th>
<th>FY22</th>
<th>FY23</th>
<th>FY22</th>
<th>FY23</th>
<th>FY22</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" class="text-#142142">合计</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
</tr>
<tr>
<td rowspan="2" class="text-#142142">C/D</td>
<td class="text-#142142">交涉</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
</tr>
<tr>
<td class="text-#142142">THEME</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
</tr>
<tr>
<td colspan="2" class="text-#142142">市况</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
</tr>
<tr>
<td colspan="2" class="text-#142142">汇率</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
<td>55.40%</td>
</tr>
</tbody>
</table>
</div>
<div class="flex h55px">
<n-form ref="formRef" inline :label-width="55" :model="formValue" class="!items-center">
<n-form-item path="name">
<n-select
style="width: 148px"
v-model:value="formValue.name"
placeholder="请选择"
:options="options"
/>
</n-form-item>
<n-form-item path="age">
<n-select
style="width: 148px"
v-model:value="formValue.age"
placeholder="请选择"
:options="options"
/>
</n-form-item>
<n-form-item path="phone">
<n-select
style="width: 148px"
v-model:value="formValue.phone"
placeholder="请选择"
:options="options"
/>
</n-form-item>
<n-form-item path="phone">
<n-select
style="width: 148px"
v-model:value="formValue.phone1"
placeholder="请选择"
:options="options"
/>
</n-form-item>
<n-form-item>
<n-button
style="background-color: #417bef; color: #fff"
attr-type="button"
@click="handleValidateClick"
>
检索
</n-button>
</n-form-item>
</n-form>
</div>
</div>
<div class="amount flex-1 pl32px pr33px pt27px pb0px">
<div class="flex gap-49px">
<div class="flex-1">
<div class="title ml19px font-bold text-24px">发注金额推移</div>
<div class="w330px h199px mt22px">
<img src="./images/fazhuje.png" alt="" />
</div>
</div>
<div class="flex-1">
<div class="title ml19px font-bold text-24px">CD堆积</div>
<div class="w330px h199px mt22px">
<img src="./images/cddj.png" alt="" />
</div>
</div>
<div class="flex-1">
<div class="title ml19px font-bold text-24px">发注金额推移</div>
<div class="w100% h199px mt22px">
<VChart ref="chart1" :option="chartOp1" autoresize />
</div>
<div class="title ml19px font-bold text-24px !absolute top-0 left-50%">CD堆积</div>
</div>
</div>
<div class="h152px mt20px" style="border: 1px solid #d3d3d3">
<div class="mt13px ml17px text-16px font-bold">年度重点</div>
<div class="h112px ml17px mt10px mr15px text-14px lh-22px overflow-y-auto">
年度重点Theme年度重点Theme年度重点Theme年度重点Theme年度重点Theme年度重点The
年度重点Theme年度重点Theme年度重点Theme年度重点Theme年度重点Theme年度重点The
年度重点Theme年度重点Theme年度重点Theme年度重点Theme年度重点Theme年度重点The
年度重点Theme年度重点Theme年度重点Theme年度重点Theme年度重点Theme年度重点The
年度重点Theme年度重点Theme年度重点Theme年度重点Theme年度重点Theme年度重
</div>
</div>
</div>
</div>
<div class="data2 flex flex-col">
<div class="flex min-h280px">
<div class="w148px">
<div class="title ml19px font-bold text-24px">按业绩</div>
<div class="max-h-236px overflow-y-auto mt100px">
<CDSide :treeData="treeData" @clickChliden="handleChild"></CDSide>
</div>
</div>
<div class="ml24px w485px">
<div class="ml19px font-bold text-24px">当年度</div>
<table
class="dangnian w485px text-center mt23px text-18px border-spacing-0 overflow-auto min-h-100px"
>
<thead style="background-color: #417bef; color: #fff; height: 42px">
<tr class="h41px">
<th colspan="4">FY2023</th>
</tr>
<tr class="h35px">
<th>供方</th>
<th>发注金额</th>
<th>交涉</th>
<th>Theme</th>
</tr>
</thead>
<tbody>
<tr v-for="i in toYearData" key="i" class="!h35px text-16px">
<td>{{ i.supplierName }}</td>
<td>{{ i.publishAmount }}</td>
<td>{{ i.negAmount }}</td>
<td>{{ i.themeRate }}%</td>
</tr>
</tbody>
</table>
</div>
<div class="ml89px flex-1">
<div class="title ml19px font-bold text-24px">历史数据</div>
<div class="flex">
<table
class="history w-full text-center mt23px text-18px border-spacing-0 overflow-auto"
>
<thead style="background-color: #417bef; color: #fff; height: 42px">
<tr class="h41px">
<th colspan="3">FY2023</th>
</tr>
<tr class="h41px">
<th>发注</th>
<th>交涉</th>
<th>Theme</th>
</tr>
</thead>
<tbody>
<tr v-for="i in hisData['2023']" key="i" class="!h35px text-16px">
<td>{{ i.publishAmount }}</td>
<td>{{ i.negAmount }}</td>
<td>{{ i.themeRate }}%</td>
</tr>
</tbody>
</table>
<table
class="history w-full text-center mt23px text-18px border-spacing-0 overflow-auto"
>
<thead style="background-color: #417bef; color: #fff; height: 42px">
<tr class="h41px">
<th colspan="3">FY2022</th>
</tr>
<tr class="h41px">
<th>发注</th>
<th>交涉</th>
<th>Theme</th>
</tr>
</thead>
<tbody>
<tr v-for="i in hisData['2022']" key="i" class="!h35px text-16px">
<td>{{ i.publishAmount }}</td>
<td>{{ i.negAmount }}</td>
<td>{{ i.themeRate }}%</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="flex gap-101px mt29px">
<div class="w634px h243px">
<VChart ref="chartRef1" :option="chartOption1" autoresize />
</div>
<div class="w634px h243px">
<VChart ref="chartRef2" :option="chartOption2" autoresize />
<div class="w634px pl30px h30px">
<el-radio-group v-model="radioss" @change="handleChange">
<el-radio :label="2020">FY2020</el-radio>
<el-radio :label="2021"> FY2021</el-radio>
<el-radio :label="2022">FY2022</el-radio>
</el-radio-group>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class="absolute flex flex-col w-full h-full z-200 top-0 left-0 text-center bg-red justify-center items-center"
style="background-color: rgba(255, 255, 255, 0.8)"
>
<img src="@/assets/images/chah.png" />
<br />
<div class="text-#5683DB text-36px">做成中,敬请期待</div>
</div>
</template>
<style scoped lang="less">
.top {
position: absolute;
right: 30px;
top: -92px;
}
.fazhu {
td {
border: 1px solid #e0e0e0;
color: #808696;
}
}
.dangnian {
td {
border: 1px solid #e0e0e0;
color: #808696;
}
}
.history {
td {
border: 1px solid #e0e0e0;
color: #808696;
}
}
.menu {
position: absolute;
background: #fff;
border: 1px solid #333;
}
.menu li {
list-style: none;
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.5s;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
::-webkit-scrollbar {
width: 1px;
}
.q-wrapper {
overflow-y: scroll;
border-radius: 20px;
.cd_plan,
.amount,
.data2 {
border: 1px solid #e7ebf5;
border-radius: 18px;
box-shadow: inset 1px 2px 12px rgba(14, 86, 221, 0.32);
}
.data2 {
// height: 600.9px;
padding: 28px;
}
.title {
position: relative;
&::before {
content: '';
width: 8px;
height: 30px;
background-color: #003ab5;
position: absolute;
left: -15px;
top: -3px;
}
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,300 @@
import { color, type EChartsOption } from 'echarts'
//数字转千分位
export function formatNum(num: any) {
const n = String(num.toFixed(0)).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,')
return n
}
export function totalPieCharData(arr: any = [], colorList: any = {}) {
// const color: any = []
// const data = arr.map((item: any) => {
// color.push(colorList[item.moduleCode])
// return {
// name: item.moduleName,
// value: item.visitCount,
// _code: item.moduleCode
// }
// })
const option: EChartsOption = {
tooltip: {
// formatter: '{b} : {c}百万 ({d}%)',
// formatter: '{b} : {c} ({d}%)',
formatter: function (params: any) {
return (
params.data.name +
' : ' +
formatNum(params.data.value) +
'\n' +
'(' +
params.percent.toFixed(0) +
'%' +
')'
)
},
trigger: 'item'
},
legend: {
show: false,
// top: '5%',
left: 'center',
textStyle: {
fontSize: 12,
color: '#fff'
}
},
graphic: {
type: 'text',
left: 'center',
top: 'center',
style: {
text:
'总计' + //圆饼中心显示数据,这里是显示得总数
'\n',
fill: '#fff',
fontSize: 14,
lineHeight: 20,
width: 30,
height: 30,
textAlign: 'center'
}
},
grid: {
containLabel: true
},
series: [
{
// name: 'Access',
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: false,
label: {
show: true,
color: '#fff',
fontSize: 12,
// formatter: '{b} ({d}%)'
formatter: function (params: any) {
return params.data.name + ': ' + params.percent.toFixed(0) + '%'
}
// position: 'center'
},
// emphasis: {
// label: {
// show: true,
// fontSize: 40,
// fontWeight: 'bold',
// color: '#fff'
// }
// },
// labelLine: {
// show: true
// },
data: []
}
]
}
return option
}
export function totalBarCharData(params: any = {}) {
const option = {
tooltip: {
trigger: 'axis'
// axisPointer: {
// type: 'cross',
// crossStyle: {
// color: '#999'
// }
// }
},
legend: {
// type: 'scroll',
data: ['Evaporation', 'Precipitation', 'Temperature'],
textStyle: {
fontSize: 12,
color: '#fff'
}
},
grid: {
left: '7%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
// data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
data: [],
axisPointer: {
type: 'shadow'
},
axisLabel: {
color: '#fff'
}
}
],
// graphic: {
// type: 'text',
// left: '0',
// top: 'center',
// rotation: 90,
// style: {
// text: '千元',
// fill: '#fff',
// fontSize: 14,
// textAlign: 'center'
// }
// },
yAxis: [
{
type: 'value',
name: '千元',
// min: 0,
// max: 250,
// interval: 50,
axisLabel: {
formatter: '{value}',
color: '#fff'
},
nameTextStyle: {
color: '#fff',
align: 'right',
padding: [0, 8, 0, 0]
},
// nameRotate: 90,
// nameTruncate: {
// maxWidth: 80,
// ellipsis: '...'
// },
// nameLocation: 'left',
// nameGap: 50,
axisLine: {
show: false,
lineStyle: {
color: '#1f78af',
width: 2 //y轴宽度这里是为了突出显示加上的
},
onZero: false
}
},
{
type: 'value',
// name: 'Temperature',
// min: 0,
// max: 25,
// interval: 5,
axisLabel: {
formatter: '{value}',
color: '#fff'
}
}
],
series: []
}
return option
}
export function disBarCharData(params: any = {}) {
const option = {
minBusSeeds: '',
tooltip: {
trigger: 'axis',
axisPointer: {
// Use axis to trigger tooltip
type: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow'
}
// position: function (pos, params, el, elRect, size) {
// const obj: any = {
// top: -10
// }
// obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 30
// return obj
// }
},
legend: {
left: 'center',
right: 'center',
type: 'scroll',
pageIconInactiveColor: '#aaa',
pageIconColor: '#fff',
selector: [
// {
// // 全选
// type: 'all',
// // 可以是任意你喜欢的标题
// title: '全选'
// }
// {
// // 反选
// type: 'inverse',
// // 可以是任意你喜欢的标题
// title: '反选'
// }
],
selectorLabel: {
backgroundColor: '#fff',
color: '#000'
},
pageTextStyle: {
color: '#fff'
},
data: [],
textStyle: {
fontSize: 12,
color: '#fff'
}
},
grid: {
left: '6%',
right: '4%',
bottom: '3%',
containLabel: true
},
yAxis: {
type: 'value',
name: '千元',
axisLabel: {
color: '#fff'
},
nameTextStyle: {
color: '#fff',
align: 'right',
padding: [0, 8, 0, 0]
}
// nameRotate: 90,
// nameTruncate: {
// maxWidth: 80,
// ellipsis: '...'
// },
// nameLocation: 'end'
// nameGap: 50
},
xAxis: {
type: 'category',
// data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
data: [],
axisLabel: {
color: '#fff'
}
},
series: []
// series: [
// {
// name: 'Direct',
// type: 'bar',
// stack: 'total',
// label: {
// show: true
// },
// emphasis: {
// focus: 'series'
// },
// data: [320, 302, 301, 334, 390, 330, 320]
// },
// ]
}
return option
}

BIN
src/views/home/cd/img/1.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 KiB

BIN
src/views/home/cd/img/2.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 KiB

BIN
src/views/home/cd/img/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 KiB

BIN
src/views/home/cd/img/h.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 KiB

BIN
src/views/home/cd/img/y.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
src/views/home/cd/img/you.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
src/views/home/cd/img/z.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
src/views/home/cd/img/zt.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

BIN
src/views/home/cd/img/zuo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -104,9 +104,17 @@ const codePath: any = {
modulePath: '/DataBase'
}
}
const toDetail2 = (n: any) => {
const toDetail2 = (n: any, flag: boolean = false) => {
console.log(n)
if (n.id === 0) return
if (flag) {
if (n.isSelect === 1) {
push(`/intelligence/${n.type == 2 ? 'within' : 'outside'}/` + n.id)
} else {
message.info('您没有权限查看!')
}
return
}
// if (n.isSelect === 1) {
if (n.moduleCode === 'App_Database') {
return push('/DataBase?id=' + n.cateId)
@ -187,11 +195,11 @@ fetchNewDataList()
<div
class="text-black p-20px text-28px w-1/3 transition-all"
:class="[{ 'text-#fff': curTab == 1 }]"
@click="curTab = 0"
@mouseenter="curTab = 0"
>
最近更新
</div>
<div class="card_title !pt-10px !pl-30px flex-1 !pb-10px" @click="curTab = 1">
<div class="card_title !pt-10px !pl-30px flex-1 !pb-10px" @mouseenter="curTab = 1">
<div class="flex justify-between items-center">
<p
class="text-22px cursor-pointer hover:underline transition-all"
@ -377,7 +385,7 @@ fetchNewDataList()
<div class="mt-10px">
<div class="text-#142142 truncate text-16px">
<a
@click="toDetail2(i)"
@click="toDetail2(i, true)"
:href="i.url"
class="no-underline text-#142142 cursor-pointer hover:underline"
>{{ i.title }}</a

View File

@ -15,7 +15,9 @@ const store = useUserStore()
const { push } = useRouter()
const route = useRoute()
const userCode = ['admin', 'csr_dandang', 'tech_service'].includes(store.user.roleCode)
const userCode = ['admin', 'csr_dandang', 'tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
const Navs = [
{ name: '集团*部门方针' },
{ name: '年度活动日程表' },

View File

@ -10,7 +10,9 @@ import ModifyB from './modifyB.vue'
import { message } from '@/utils/message';
import { useUserStore } from '@/stores/modules/user'
const store = useUserStore()
const userCode = ['admin','csr_dandang','tech_service'].includes(store.user.roleCode)
const userCode = ['admin','csr_dandang','tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
const { chartRef, option } = charData()
const { chartRef: chartRefP1, option: optionP1 } = pieData1()

View File

@ -16,286 +16,267 @@ const store = useUserStore()
const { push } = useRouter()
const message = useMessage()
const userCode = ['admin', 'csr_dandang', 'tech_service'].includes(
store.user.roleCode
const userCode = ['admin', 'csr_dandang', 'tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
const swipeRef = ref<any>(null)
const dataList = ref([])
const swipeActiveIndex = ref(0)
function handleIndex(x: any) {
swipeActiveIndex.value = x.realIndex
swipeActiveIndex.value = x.realIndex
}
const modules = [Autoplay, Pagination, Navigation, A11y]
const setSwiperRef = (swiper: any) => {
swipeRef.value = swiper
swipeRef.value = swiper
}
// 2
const swipeSubRef = ref<any>(null)
const dataList2 = ref([])
const swipeActiveIndex2 = ref(0)
function handleIndex2(x: any) {
swipeActiveIndex2.value = x.realIndex
swipeActiveIndex2.value = x.realIndex
}
const modules2 = [Autoplay, Pagination, Navigation, A11y]
const setSwiperRef2 = (swiper: any) => {
swipeSubRef.value = swiper
swipeSubRef.value = swiper
}
const pageInfo = reactive({
currentPage: 1,
pageSize: 100,
total: 10
currentPage: 1,
pageSize: 100,
total: 10
})
const swiperList = ref()
onMounted(async () => {
dataList.value = []
msgScoll.value?.addEventListener('scroll', handleVisitsScoll)
// Solution
const { rows } = await getFootprintList({
pageNum: pageInfo.currentPage,
pageSize: pageInfo.pageSize,
moduleId: '1'
})
if (rows && rows != 'null' && rows.length > 0) {
// const newData = rows.flatMap((item) => {
// if (item.imgUrl && item.imgUrl.length > 0) {
// return item.imgUrl.map((img) => {
// return {
// ...item,
// imgPath: img.url,
// };
// });
// }
swiperList.value = rows
// if(rows.length>5 || rows.length < 3){
// }else{
// swiperList.value = [...rows,...rows]
// }
}
//
getZu(1)
dataList.value = []
msgScoll.value?.addEventListener('scroll', handleVisitsScoll)
// Solution
const { rows } = await getFootprintList({
pageNum: pageInfo.currentPage,
pageSize: pageInfo.pageSize,
moduleId: '1'
})
if (rows && rows != 'null' && rows.length > 0) {
// const newData = rows.flatMap((item) => {
// if (item.imgUrl && item.imgUrl.length > 0) {
// return item.imgUrl.map((img) => {
// return {
// ...item,
// imgPath: img.url,
// };
// });
// }
swiperList.value = rows
// if(rows.length>5 || rows.length < 3){
// }else{
// swiperList.value = [...rows,...rows]
// }
}
//
getZu(1)
})
const shomks = () => {
// push('csr/modifyCsr2')
push({ name: 'modifyCsr2' })
// push('csr/modifyCsr2')
push({ name: 'modifyCsr2' })
}
const srcType = ref()
const openUrl = async (url) => {
if (!url) {
message.info('没有可预览文件!')
return
}
srcType.value = getLastSubstring(url)
if (
['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'pdf'].includes(srcType.value)
) {
// src.value = filePath
// pdfShow.value = true
url = 'https://view.xdocin.com/view?src=' + url
const screenWidth = window.screen.width
const screenHeight = window.screen.height
window.open(
url,
'',
'width=' +
screenWidth +
',height=' +
screenHeight +
',top=' +
0 +
',left=' +
0
)
} else {
message.error(
"文件格式不是 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'"
)
}
if (!url) {
message.info('没有可预览文件!')
return
}
srcType.value = getLastSubstring(url)
if (['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'pdf'].includes(srcType.value)) {
// src.value = filePath
// pdfShow.value = true
url = 'https://view.xdocin.com/view?src=' + url
const screenWidth = window.screen.width
const screenHeight = window.screen.height
window.open(
url,
'',
'width=' + screenWidth + ',height=' + screenHeight + ',top=' + 0 + ',left=' + 0
)
} else {
message.error("文件格式不是 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'")
}
}
function getLastSubstring(str: string): string {
const lastIndex = str.lastIndexOf('.')
if (lastIndex !== -1) {
return str.substring(lastIndex + 1)
} else {
return ''
}
const lastIndex = str.lastIndexOf('.')
if (lastIndex !== -1) {
return str.substring(lastIndex + 1)
} else {
return ''
}
}
const toDetail = (obj) => {
console.log(obj)
if (obj.isSelect === 2) {
message.info('没有访问权限')
return
} else {
obj.filePath?.[0]?.url
? openUrl(obj.filePath[0].url)
: message.info('没有可预览文件!')
}
console.log(obj)
if (obj.isSelect === 2) {
message.info('没有访问权限')
return
} else {
obj.filePath?.[0]?.url ? openUrl(obj.filePath[0].url) : message.info('没有可预览文件!')
}
}
async function down(data: {
it: {
response: { url: any; originalFilename: any }
url: any
newFileName: any
}
it: {
response: { url: any; originalFilename: any }
url: any
newFileName: any
}
}) {
// console.log(data)
let url, name
if (data.it && data.it.response) {
url = data.it.response.url
name = data.it.response.originalFilename
} else {
url = data.it.url
name = data.it.newFileName
}
if (!url) {
message.error('没有可预览文件!')
return
}
// downloadFiles(url, name)
openUrl(url)
// console.log(data)
let url, name
if (data.it && data.it.response) {
url = data.it.response.url
name = data.it.response.originalFilename
} else {
url = data.it.url
name = data.it.newFileName
}
if (!url) {
message.error('没有可预览文件!')
return
}
// downloadFiles(url, name)
openUrl(url)
}
const dataInfo = reactive({
treeSource: 3,
type: 0,
pageSize: 10
treeSource: 3,
type: 0,
pageSize: 10
})
let maxMsgLingth = 1
let pageNum = 1
const getZu = async (pageNum) => {
const { treeSource, type, pageSize } = dataInfo
const { rows, total } = await getFootprintList({
pageNum,
pageSize,
moduleId: '2'
})
const { treeSource, type, pageSize } = dataInfo
const { rows, total } = await getFootprintList({
pageNum,
pageSize,
moduleId: '2'
})
// if (type === 0) {
// dataList.value = rows
// } else {
// }
dataList.value.push(...rows)
maxMsgLingth = total / pageSize
console.log(dataList.value, type)
// if (type === 0) {
// dataList.value = rows
// } else {
// }
dataList.value.push(...rows)
maxMsgLingth = total / pageSize
console.log(dataList.value, type)
}
const msgScoll = ref<HTMLElement | null>(null)
const handleVisitsScoll = () => {
// if(pageNum >= 1) return
const container = msgScoll.value
if (container) {
const isAtBottom =
container.scrollHeight - container.scrollTop === container.clientHeight
if (isAtBottom) {
if (pageNum < maxMsgLingth) {
++pageNum
getZu(pageNum)
}
}
}
// if(pageNum >= 1) return
const container = msgScoll.value
if (container) {
const isAtBottom = container.scrollHeight - container.scrollTop === container.clientHeight
if (isAtBottom) {
if (pageNum < maxMsgLingth) {
++pageNum
getZu(pageNum)
}
}
}
}
const scroll = ({ scrollTop }: any) => {
const isAtBottom = scrollTop >= 400
if (isAtBottom) {
if (pageNum < maxMsgLingth) {
++pageNum
getZu(pageNum)
}
}
const isAtBottom = scrollTop >= 400
if (isAtBottom) {
if (pageNum < maxMsgLingth) {
++pageNum
getZu(pageNum)
}
}
}
</script>
<template>
<div class="w-full h-full box rounded-18px overflow-hidden">
<!-- <AppBlock class="w-full ">
<div class="w-full h-full box rounded-18px overflow-hidden">
<!-- <AppBlock class="w-full ">
<img src="./images/goudongxi.png" class="w-full h-full" />
</AppBlock> -->
<div class="w-full h-500px mb-10px bg-#fff">
<div
class="text-center text-#142142 text-26px py25px font-extrabold"
style="border-bottom: solid 1px #f4f4f4"
>
PLUS活动相关
</div>
<el-button v-if="userCode" type="primary" class="button" @click="shomks"
>管理</el-button
>
<div class="text-#142142 text-20px font-extrabold flex p20px">
<!-- <div class=""></div> -->
<div class="w-70% text-24px font-bold p20px pb-0px">
<!-- 空调节能solution活动 -->
PLUS活动
</div>
<div class="w-full h-500px mb-10px bg-#fff">
<div
class="text-center text-#142142 text-26px py25px font-extrabold"
style="border-bottom: solid 1px #f4f4f4"
>
PLUS活动相关
</div>
<el-button v-if="userCode" type="primary" class="button" @click="shomks"></el-button>
<div class="text-#142142 text-20px font-extrabold flex p20px">
<!-- <div class=""></div> -->
<div class="w-70% text-24px font-bold p20px pb-0px">
<!-- 空调节能solution活动 -->
PLUS活动
</div>
<div class="w-30%" style="text-align: -webkit-right">
<div
@click="push({ name: 'modifyCsrList' })"
class="w-145px px15px text-#fff !rd-22px !bg-gradient-to-r !from-#34a6d9/90 !to-#23d1c6/70 p10px"
>
查看更多<img
src="../../../assets/images/ckgduo@2x.png"
class="w25px ml-10px mt--5px"
/>
</div>
</div>
</div>
<AppBlock class="w-full h325px box !b-0" style="box-shadow: none">
<div class="w1200px px68px relative">
<div class="swipe-nav nav-prev">
<NIcon size="40" color="#537deb">
<ChevronBack />
</NIcon>
</div>
<div class="swipe-nav nav-next">
<NIcon size="40" color="#537deb">
<ChevronForward />
</NIcon>
</div>
<!-- :slides-per-group="3" -->
<!-- :autoplay="{delay: 3000, disableOnInteraction: false, pauseOnMouseEnter: true,stopOnLastSlide: false}" -->
<Swiper
ref="swipeRef"
@swiper="setSwiperRef"
class="h325px"
:slides-per-view="3"
:slides-per-group="1"
:loopAdditionalSlides="3"
:speed="500"
:space-between="8"
:modules="modules"
:scrollbar="{ draggable: false }"
:loop="true"
:navigation="{
nextEl: '.nav-next',
prevEl: '.nav-prev'
}"
>
<template v-for="(i, index) in swiperList" :key="index">
<SwiperSlide>
<div
class="w340px h300px overflow-hidden bg-#F6F8FF mt10px relative rd-25px"
style="box-shadow: 0px 7px 12px 0px #e7e7e7"
>
<div
class="flex items-center !bg-gradient-to-r !from-#5C87F5/90 !to-#466CCD/70 text-#fff font-[500] font-bold px20px py15px text-18px truncates"
>
<img
v-if="isNotOneWeekAgo(i.createTime)"
src="@/assets/images/NEW.gif"
class="h-20px"
alt=""
/>
活动{{ index + 1 }}:
<span>{{ i.title }}</span>
<div class="w-30%" style="text-align: -webkit-right">
<div
@click="push({ name: 'modifyCsrList' })"
class="w-145px px15px text-#fff !rd-22px !bg-gradient-to-r !from-#34a6d9/90 !to-#23d1c6/70 p10px"
>
查看更多<img src="../../../assets/images/ckgduo@2x.png" class="w25px ml-10px mt--5px" />
</div>
</div>
</div>
<AppBlock class="w-full h325px box !b-0" style="box-shadow: none">
<div class="w1200px px68px relative">
<div class="swipe-nav nav-prev">
<NIcon size="40" color="#537deb">
<ChevronBack />
</NIcon>
</div>
<div class="swipe-nav nav-next">
<NIcon size="40" color="#537deb">
<ChevronForward />
</NIcon>
</div>
<!-- :slides-per-group="3" -->
<!-- :autoplay="{delay: 3000, disableOnInteraction: false, pauseOnMouseEnter: true,stopOnLastSlide: false}" -->
<Swiper
ref="swipeRef"
@swiper="setSwiperRef"
class="h325px"
:slides-per-view="3"
:slides-per-group="1"
:loopAdditionalSlides="3"
:speed="500"
:space-between="8"
:modules="modules"
:scrollbar="{ draggable: false }"
:loop="true"
:navigation="{
nextEl: '.nav-next',
prevEl: '.nav-prev'
}"
>
<template v-for="(i, index) in swiperList" :key="index">
<SwiperSlide>
<div
class="w340px h300px overflow-hidden bg-#F6F8FF mt10px relative rd-25px"
style="box-shadow: 0px 7px 12px 0px #e7e7e7"
>
<div
class="flex items-center !bg-gradient-to-r !from-#5C87F5/90 !to-#466CCD/70 text-#fff font-[500] font-bold px20px py15px text-18px truncates"
>
<img
v-if="isNotOneWeekAgo(i.createTime)"
src="@/assets/images/NEW.gif"
class="h-20px"
alt=""
/>
活动{{ index + 1 }}:
<span>{{ i.title }}</span>
<!-- <span class="float-right"><el-icon>
<!-- <span class="float-right"><el-icon>
<ArrowRightBold />
</el-icon></span> -->
</div>
</div>
<div class="overflow-hidden w-full h-206px z-10">
<!-- <el-carousel
<div class="overflow-hidden w-full h-206px z-10">
<!-- <el-carousel
autoplay
indicator-position="none"
arrow="never"
@ -312,70 +293,60 @@ const scroll = ({ scrollTop }: any) => {
/>
</el-carousel-item>
</el-carousel> -->
<n-carousel
draggable
autoplay
trigger="hover"
mousewheel
effect="fade"
:interval="5000"
:loop="true"
class="overflow-hidden box-border"
>
<div
class="w-full h-200px overflow-hidden p10px"
v-if="i.imgUrl"
v-for="ite in i.imgUrl"
>
<img
:src="ite.url"
class="w-full max-h-200px image-container overflow-hidden"
/>
</div>
</n-carousel>
</div>
<n-carousel
draggable
autoplay
trigger="hover"
mousewheel
effect="fade"
:interval="5000"
:loop="true"
class="overflow-hidden box-border"
>
<div
class="w-full h-200px overflow-hidden p10px"
v-if="i.imgUrl"
v-for="ite in i.imgUrl"
>
<img
:src="ite.url"
class="w-full max-h-200px image-container overflow-hidden"
/>
</div>
</n-carousel>
</div>
<!-- <img :src="i.imgPath" class="p10px w-full max-h-180px rd-10px" @click="toDetail(i)" /> -->
<!-- <img :src="i.imgPath" class="p10px w-full max-h-180px rd-10px" @click="toDetail(i)" /> -->
<div
class="absolute left-0 right-0 bottom-14px text-#000 text-18px text-left px16px py6px z-100 transition-none"
>
<div class="max-w500px text-16px flex flex-col">
<div class="flex items-center max-w-[84%]">
<img
src="../../../assets/images/lvbiao@2x.png"
class="mr-5px"
/>
<n-popover trigger="hover" placement="top-start">
<template #trigger>
<span
class="truncate text-18px !min-w-[auto]"
@click="toDetail(i)"
>
{{ i.filePath[0]?.originalFileName }}
</span>
</template>
<div class="text-18px leading-40px">
{{ i.filePath[0]?.originalFileName }}
</div>
</n-popover>
</div>
<div
v-if="i.filePath.length >= 1"
title="查看更多"
@click="toDetail(i)"
class="absolute cursor-pointer right--14px top-0px w60px pt-3px flex items-center ml-auto text-right"
style="
color: #4d7ee8;
text-align: center;
font-size: 16px;
"
>
更多<el-icon>
<DArrowRight class="" />
</el-icon>
</div>
<!-- <el-dropdown max-height="100px" @command="down">
<div
class="absolute left-0 right-0 bottom-14px text-#000 text-18px text-left px16px py6px z-100 transition-none"
>
<div class="max-w500px text-16px flex flex-col">
<div class="flex items-center max-w-[84%]">
<img src="../../../assets/images/lvbiao@2x.png" class="mr-5px" />
<n-popover trigger="hover" placement="top-start">
<template #trigger>
<span class="truncate text-18px !min-w-[auto]" @click="toDetail(i)">
{{ i.filePath[0]?.originalFileName }}
</span>
</template>
<div class="text-18px leading-40px">
{{ i.filePath[0]?.originalFileName }}
</div>
</n-popover>
</div>
<div
v-if="i.filePath.length >= 1"
title="查看更多"
@click="toDetail(i)"
class="absolute cursor-pointer right--14px top-0px w60px pt-3px flex items-center ml-auto text-right"
style="color: #4d7ee8; text-align: center; font-size: 16px"
>
更多<el-icon>
<DArrowRight class="" />
</el-icon>
</div>
<!-- <el-dropdown max-height="100px" @command="down">
<el-icon size="25">
<CaretBottom />
</el-icon>
@ -390,22 +361,22 @@ const scroll = ({ scrollTop }: any) => {
</el-dropdown-menu>
</template>
</el-dropdown> -->
</div>
</div>
</div>
</SwiperSlide>
</template>
</Swiper>
</div>
</AppBlock>
</div>
<div class="w-49% h-375px float-left bg-#fff">
<div class="text-24px font-bold p20px" @click="push({ name: 'CSRList' })">
<!-- 碳足迹报告 -->
相关活动报告
</div>
<!-- <div title="查看更多" class="absolute right-25px top-5px w80px h50px flex justify-center items-center cursor-pointer" style="background: #0539A3;line-height: 50px;color: #00C2EE;text-align: center;" @click="jumpContentHandler('BCP简报', 2)"> -->
<!-- <div
</div>
</div>
</div>
</SwiperSlide>
</template>
</Swiper>
</div>
</AppBlock>
</div>
<div class="w-49% h-375px float-left bg-#fff">
<div class="text-24px font-bold p20px" @click="push({ name: 'CSRList' })">
<!-- 碳足迹报告 -->
相关活动报告
</div>
<!-- <div title="查看更多" class="absolute right-25px top-5px w80px h50px flex justify-center items-center cursor-pointer" style="background: #0539A3;line-height: 50px;color: #00C2EE;text-align: center;" @click="jumpContentHandler('BCP简报', 2)"> -->
<!-- <div
title="查看更多"
class="absolute right-25px top-5px w80px h50px flex justify-center items-center cursor-pointer"
style="
@ -420,159 +391,145 @@ const scroll = ({ scrollTop }: any) => {
<DArrowRight class="" />
</el-icon>
</div> -->
<span
style="
border: #417bef 1px solid;
color: #417bef;
border-radius: 5px;
height: 30px;
"
class="absolute right-25px top-16px w80px h50px flex justify-center items-center cursor-pointer"
@click="push({ name: 'CSRList' })"
>更多<el-icon> <DArrowRight class="" /> </el-icon
></span>
<!-- <div ref="msgScoll" class="px20px h280px cent_box overflow-y-scroll "> -->
<!-- <div
<span
style="border: #417bef 1px solid; color: #417bef; border-radius: 5px; height: 30px"
class="absolute right-25px top-16px w80px h50px flex justify-center items-center cursor-pointer"
@click="push({ name: 'CSRList' })"
>更多<el-icon> <DArrowRight class="" /> </el-icon
></span>
<!-- <div ref="msgScoll" class="px20px h280px cent_box overflow-y-scroll "> -->
<!-- <div
ref="msgScoll"
class="px20px h280px cent_box overflow-y-scroll"
> -->
<el-scrollbar
class="px20px"
ref=""
height="280px"
always
@scroll="scroll"
>
<!-- <div class="text-#808696 bg-#F4F8FF py10px rd-5px mt10px" v-for="(i, key) in dataList" :key="i"> -->
<div
class="text-#808696 bg-#F4F8FF py10px rd-5px mt10px"
v-for="(i, key) in dataList"
:key="i"
>
<div class="truncate2 flex items-center" @click="toDetail(i)">
<span
class="text-#fff bg-#407DF1 px5px text-18px rounded-20px mr-5px inlineFlex"
>{{ ++key }}</span
>
<span class="text-18px mr-2">{{ i.title }}</span>
<img
v-if="isNotOneWeekAgo(i.createTime)"
src="@/assets/images/NEW.gif"
class="h-20px"
alt=""
/>
</div>
<span class="absolute right-10px top-24px text-18px">{{
i.createTime
}}</span>
</div>
</el-scrollbar>
<!-- </div> -->
</div>
<div class="w-50% h-375px bg-#fff float-left ml-1%">
<div class="text-24px font-bold p20px">碳足迹平台</div>
<div
class="absolute flex flex-col w-full h-full z-200 top-0 left-0 text-center bg-red justify-center items-center"
style="background-color: rgba(255, 255, 255, 0.8)"
>
<img src="@/assets/images/chah.png" />
<br />
<div class="text-#5683DB text-36px">做成中,敬请期待</div>
</div>
</div>
</div>
<el-scrollbar class="px20px" ref="" height="280px" always @scroll="scroll">
<!-- <div class="text-#808696 bg-#F4F8FF py10px rd-5px mt10px" v-for="(i, key) in dataList" :key="i"> -->
<div
class="text-#808696 bg-#F4F8FF py10px rd-5px mt10px"
v-for="(i, key) in dataList"
:key="i"
>
<div class="truncate2 flex items-center" @click="toDetail(i)">
<span class="text-#fff bg-#407DF1 px5px text-18px rounded-20px mr-5px inlineFlex">{{
++key
}}</span>
<span class="text-18px mr-2">{{ i.title }}</span>
<img
v-if="isNotOneWeekAgo(i.createTime)"
src="@/assets/images/NEW.gif"
class="h-20px"
alt=""
/>
</div>
<span class="absolute right-10px top-24px text-18px">{{ i.createTime }}</span>
</div>
</el-scrollbar>
<!-- </div> -->
</div>
<div class="w-50% h-375px bg-#fff float-left ml-1%">
<div class="text-24px font-bold p20px">碳足迹平台</div>
<div
class="absolute flex flex-col w-full h-full z-200 top-0 left-0 text-center bg-red justify-center items-center"
style="background-color: rgba(255, 255, 255, 0.8)"
>
<img src="@/assets/images/chah.png" />
<br />
<div class="text-#5683DB text-36px">做成中,敬请期待</div>
</div>
</div>
</div>
</template>
<style scoped lang="less">
/* 修正后的代码 */
::-webkit-scrollbar {
width: 5px;
height: 10px;
width: 5px;
height: 10px;
}
::-webkit-scrollbar-track {
background-color: #f5f5f5;
background-color: #f5f5f5;
}
::-webkit-scrollbar-thumb {
background-color: #ccc;
border-radius: 5px;
height: 50px; /* 添加高度 */
background-color: #ccc;
border-radius: 5px;
height: 50px; /* 添加高度 */
}
.image-container {
transition: filter 0.3s ease; /* 添加图像加载时的过渡效果 */
transition: filter 0.3s ease; /* 添加图像加载时的过渡效果 */
}
.truncate {
display: block;
max-width: 260px;
min-width: 260px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
max-width: 260px;
min-width: 260px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.truncates {
display: block;
max-width: 340px;
min-width: 340px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
max-width: 340px;
min-width: 340px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.button {
position: absolute;
top: 20px;
right: 20px;
z-index: 500;
position: absolute;
top: 20px;
right: 20px;
z-index: 500;
}
.carousel-img {
margin: 0 auto;
width: 100%;
height: 100%;
object-fit: cover;
margin: 0 auto;
width: 100%;
height: 100%;
object-fit: cover;
}
.truncate2 {
max-width: 78%;
overflow: hidden;
padding: 5px 10px;
line-height: 30px;
text-overflow: ellipsis;
white-space: nowrap;
color: #000;
cursor: pointer;
max-width: 78%;
overflow: hidden;
padding: 5px 10px;
line-height: 30px;
text-overflow: ellipsis;
white-space: nowrap;
color: #000;
cursor: pointer;
a {
text-decoration: none;
}
a {
text-decoration: none;
}
}
.swipe-nav {
// absolute left-10px w36px h46px flex items-center justify-center
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 36px;
height: 46px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid #537deb;
border-radius: 4px;
cursor: pointer;
// absolute left-10px w36px h46px flex items-center justify-center
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 36px;
height: 46px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid #537deb;
border-radius: 4px;
cursor: pointer;
&.nav-prev {
left: 16px;
}
&.nav-prev {
left: 16px;
}
&.nav-next {
right: 16px;
}
&.nav-next {
right: 16px;
}
}
.carousel-img {
width: 100%;
height: 240px;
object-fit: cover;
width: 100%;
height: 240px;
object-fit: cover;
}
</style>

View File

@ -13,7 +13,7 @@ const query = ref<any>({
})
const year = new Date().getFullYear()
const month = new Date().getMonth()
const jpMonth = (month < 3 ? year - 1 : year) + ''
const jpMonth = (month < 4 ? year - 1 : year) + ''
query.value.year = jpMonth
const calendar = [4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3]
const calendarShow = new Date().getMonth() + 1
@ -43,8 +43,11 @@ const getCsrSupplier = () => {
try {
csrSupplier.value = resData.length
? resData.map((key) => {
const obj = data[key] || {}
const month = String(key).split('-')?.[1] || ''
const arr = String(key).split('-')
const month = arr?.[1] || ''
// const year = arr?.[0] || ''
const obj =
data[+month < 4 ? +req.year + 1 + '-' + month : req.year + '-' + month] || {}
Object.assign(csrSupplierObj.value[month], obj)
return {
key,
@ -66,20 +69,26 @@ const getCsrSupplier = () => {
}
const csrSupplierList = ref<any>([])
// const selMonth = ref((new Date().getMonth() + 1).toString())
const selMonth = ref('')
const getCsrSupplierList = (index?: any) => {
const month = index || index === 0 ? query.value.year + '-' + months[index] : ''
const _m = +months[index]
const month =
index || index === 0
? (_m < 4 ? +query.value.year + 1 : query.value.year) + '-' + months[index]
: ''
csrSupplierList.value = []
selMonth.value = ''
const req = { pageNum: 1, pageSize: 10, ...query.value, month }
req.year = _m < 4 ? +req.year + 1 : req.year
req.supplierName
? fetchCsrSupplierList(req).then((res: any) => {
csrSupplierList.value = (res.rows || []).filter((item: any) => item.submitunCount > 0)
})
: fetchCsrSupplierTopList(req).then((res: any) => {
: fetchCsrSupplierTopList({ ...req }).then((res: any) => {
csrSupplierList.value = (res.rows || []).filter((item: any) => item.submitunCount > 0)
})
selMonth.value = month ? +months[index] + '月' : ''
selMonth.value = month ? months[index] : ''
}
const getCsrSupplierTaskInfo = () => {
@ -173,19 +182,17 @@ getCsrSupplierTaskInfo()
<el-col :span="8" v-for="(it, i) in months" :key="i">
<div
v-show="!loading"
:class="i <= nowIndexMonth && query.year == jpMonth ? 'times' : 'time'"
:class="csrSupplierObj[it]?.submitedCount !== undefined ? 'times' : 'time'"
@click="handleMonth(i)"
>
<div
v-if="i > nowIndexMonth || query.year != jpMonth"
v-if="csrSupplierObj[it]?.submitedCount === undefined"
class="text-#d3d2d2 text-18px font-bold absolute left-40% top-45%"
>
<span class="text-60px">{{ +it }}</span
>
</div>
<template
v-if="i <= nowIndexMonth && (query.year == jpMonth || !!csrSupplierObj[it])"
>
<template v-if="csrSupplierObj[it]?.submitedCount !== undefined">
<div class="text-#fff text-18px font-bold absolute left-40% top-24px">
<span class="text-24px">{{ +it }}</span
>
@ -325,7 +332,11 @@ getCsrSupplierTaskInfo()
</div>
</div>
<div class="cards">
<div class="cards_title relative">未提交供应商明细({{ query.year }}{{ selMonth }})</div>
<div class="cards_title relative">
未提交供应商明细({{ selMonth && +selMonth < 4 ? +query.year + 1 : query.year }}{{
selMonth
}}{{ selMonth ? '月' : '' }})
</div>
<div class="absolute top-24px !text-18px right-20px pt30px text-#4E7EE8">
<span class="text-#ababab">更新时间{{ updateTime }}</span>
</div>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,16 @@
<script setup lang="ts">
import DataBaseHead from '@/views/home/components/DataBaseHead.vue'
import {
cateAdd,
cateUpdate,
treeDbList,
cateInfo,
cateDel,
cateFileUpdate,
cateFileDel,
cateFileList,
download,
fetchdbAuthGetInfo
cateAdd,
cateUpdate,
treeDbList,
cateInfo,
cateDel,
cateFileUpdate,
cateFileDel,
cateFileList,
download,
fetchdbAuthGetInfo
} from '@/api/daikin/base'
import { useUserStore } from '@/stores/modules/user'
import { useMessage, NModal, NPopover } from 'naive-ui'
@ -19,7 +19,7 @@ import { isNotOneWeekAgo } from '@/utils'
const store: any = useUserStore()
const message = useMessage()
const userCode = ['admin', 'database_dandang'].includes(store.user.roleCode)
const userCode = ['admin', 'database_dandang'].some((item) => store.user.roleCode?.includes(item))
const isDbReview = store.user?.isDbReview === 1
const isDbUpload = store.user?.isDbUpload === 1
const user: any = store.user
@ -28,32 +28,32 @@ const { push } = useRouter()
const title = ref('大金集团经营理念')
const prop = defineProps({
cateId: Number,
title: String
cateId: Number,
title: String
})
const pageInfo = reactive({
currentPage: 1,
pageSize: 13,
total: 10
currentPage: 1,
pageSize: 13,
total: 10
})
watchEffect(() => {
prop.cateId
prop.title
title.value = prop.title
getTree()
// getAuth()
prop.cateId
prop.title
title.value = prop.title
getTree()
// getAuth()
})
const tableData = ref()
async function getTree() {
const { currentPage, pageSize } = pageInfo
if (!prop.cateId) return
const { rows, total } = await cateFileList({
cateId: prop.cateId,
pageNum: currentPage,
pageSize
})
pageInfo.total = total
tableData.value = rows
const { currentPage, pageSize } = pageInfo
if (!prop.cateId) return
const { rows, total } = await cateFileList({
cateId: prop.cateId,
pageNum: currentPage,
pageSize
})
pageInfo.total = total
tableData.value = rows
}
// async function downloads(row) {
// console.log(row)
@ -81,39 +81,39 @@ async function getTree() {
const arr = [1706, 1416, 1415, 1414, 1413, 1412, 1411, 1410, 1386, 1388, 1391]
async function downloads(row: any) {
// console.log('xiazai', row)
const { isSelect, filePath, id, fileCommon } = row
if (isSelect === 2) {
message.info('没有访问权限')
return
}
if (arr.includes(id) || (fileCommon?.fileSize || 0) > 25 * 1024 * 1024) {
try {
message.info('正在下载中,请稍等~')
downloadFile(filePath)
} catch (error) {}
}
// window.open(
// 'https://view.officeapps.live.com/op/view.aspx?src=' +
// encodeURIComponent(filePath)
// )
filePath && window.open(filePath)
// console.log('xiazai', row)
const { isSelect, filePath, id, fileCommon } = row
if (isSelect === 2) {
message.info('没有访问权限')
return
}
if (arr.includes(id) || (fileCommon?.fileSize || 0) > 25 * 1024 * 1024) {
try {
message.info('正在下载中,请稍等~')
downloadFile(filePath)
} catch (error) {}
}
// window.open(
// 'https://view.officeapps.live.com/op/view.aspx?src=' +
// encodeURIComponent(filePath)
// )
filePath && window.open(filePath)
}
const lazyState = computed(() => [pageInfo.currentPage])
watch(
() => unref(lazyState),
async (v) => {
getTree()
},
{ immediate: true, deep: true }
() => unref(lazyState),
async (v) => {
getTree()
},
{ immediate: true, deep: true }
)
const handleSizeChange = (e) => {
console.log(e)
console.log(e)
}
const handleCurrentChange = (e) => {
console.log(e)
console.log(e)
}
//
const srcType = ref()
@ -121,99 +121,88 @@ const src = ref()
const pdfShow = ref(false)
const showModalRef2 = ref(false)
const openUrl = async (it) => {
console.log(it, 2222)
let { filePath, isSelect } = it
if (isSelect === 2) {
message.info('没有访问权限')
return
}
if (!filePath) {
message.info('没有可预览文件!')
return
}
srcType.value = getLastSubstring(filePath)
if (
['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'pdf'].includes(srcType.value)
) {
// src.value = filePath
// pdfShow.value = true
filePath = 'https://view.xdocin.com/view?src=' + filePath
const screenWidth = window.screen.width
const screenHeight = window.screen.height
window.open(
filePath,
'',
'width=' +
screenWidth +
',height=' +
screenHeight +
',top=' +
0 +
',left=' +
0
)
} else {
message.error(
"文件格式不是 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'"
)
}
console.log(it, 2222)
let { filePath, isSelect } = it
if (isSelect === 2) {
message.info('没有访问权限')
return
}
if (!filePath) {
message.info('没有可预览文件!')
return
}
srcType.value = getLastSubstring(filePath)
if (['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'pdf'].includes(srcType.value)) {
// src.value = filePath
// pdfShow.value = true
filePath = 'https://view.xdocin.com/view?src=' + filePath
const screenWidth = window.screen.width
const screenHeight = window.screen.height
window.open(
filePath,
'',
'width=' + screenWidth + ',height=' + screenHeight + ',top=' + 0 + ',left=' + 0
)
} else {
message.error("文件格式不是 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'")
}
}
function getLastSubstring(str: string): string {
const lastIndex = str.lastIndexOf('.')
if (lastIndex !== -1) {
return str.substring(lastIndex + 1)
} else {
return ''
}
const lastIndex = str.lastIndexOf('.')
if (lastIndex !== -1) {
return str.substring(lastIndex + 1)
} else {
return ''
}
}
function downloadFile(url: any) {
fetch(url)
.then((response) => response.blob())
.then((blob) => {
const downloadUrl = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = downloadUrl
link.download = getFileNameFromUrl(url)
link.click()
})
fetch(url)
.then((response) => response.blob())
.then((blob) => {
const downloadUrl = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = downloadUrl
link.download = getFileNameFromUrl(url)
link.click()
})
}
function getFileName(url: string) {
let lastSplashIndex = url.lastIndexOf('/')
let lastDotIndex = url.lastIndexOf('.')
return url.slice(lastSplashIndex + 1, lastDotIndex)
let lastSplashIndex = url.lastIndexOf('/')
let lastDotIndex = url.lastIndexOf('.')
return url.slice(lastSplashIndex + 1, lastDotIndex)
}
function getFileNameFromUrl(url: string) {
const lastSlashIndex = url.lastIndexOf('/')
if (lastSlashIndex !== -1) {
return url.substring(lastSlashIndex + 1)
} else {
return 'Invalid URL'
}
const lastSlashIndex = url.lastIndexOf('/')
if (lastSlashIndex !== -1) {
return url.substring(lastSlashIndex + 1)
} else {
return 'Invalid URL'
}
}
//
const hasUpload = ref(false)
const hasReview = ref(false)
async function getAuth() {
if (!prop.cateId) return
const { data: uploadUser = [] } = await fetchdbAuthGetInfo({
cateId: prop.cateId,
type: 1
})
hasUpload.value = uploadUser.findIndex((x: any) => x.userId === user?.id) > -1
const { data: reviewUser = [] } = await fetchdbAuthGetInfo({
cateId: prop.cateId,
type: 2
})
hasReview.value = reviewUser.findIndex((x: any) => x.userId === user?.id) > -1
if (!prop.cateId) return
const { data: uploadUser = [] } = await fetchdbAuthGetInfo({
cateId: prop.cateId,
type: 1
})
hasUpload.value = uploadUser.findIndex((x: any) => x.userId === user?.id) > -1
const { data: reviewUser = [] } = await fetchdbAuthGetInfo({
cateId: prop.cateId,
type: 2
})
hasReview.value = reviewUser.findIndex((x: any) => x.userId === user?.id) > -1
}
</script>
<template>
<DataBaseHead />
<div class="w-full h-1px bg-#507FFD mt50px rd-b-20px"></div>
<div class="w-full h-95%">
<!-- <div class="px30px flex text-center py40px">
<DataBaseHead />
<div class="w-full h-1px bg-#507FFD mt50px rd-b-20px"></div>
<div class="w-full h-95%">
<!-- <div class="px30px flex text-center py40px">
<div class="bg-#6C93F8 text-#fff px20px pt18px pb-15px w-180px rd-10px mr-15px">
<img src="@/assets/images/xinxi@2x.png" class="w30px mr-5px mt--3px" /><span>公司经营信息</span>
</div>
@ -232,156 +221,122 @@ async function getAuth() {
</div> -->
<div class="bg-#fff rd-15px px30px pt30px w-full h930px">
<div
class="rd-15px w-full h870px"
style="box-shadow: 1px 2px 26px -3px #cdcccc"
>
<div
class="h80px rd-t-15px bg-#4877FB leading-80px text-#fff text-20px"
>
<img
src="@/assets/images/Shape7@2x.png"
class="w50px ml-30px mr10px mt--20px"
/>
{{ title }}
<div class="float-right top-0 right-30px">
<el-button
class="mr-30px"
v-if="isDbReview || isDbUpload || userCode"
type="warning"
@click="push({ path: '/DataBase/review' })"
>
审批流程
</el-button>
<el-button
v-if="isDbReview || isDbUpload || userCode"
type="primary"
@click="push('/DataBase/Modify')"
>内容管理</el-button
>
</div>
</div>
<div class="p30px relative h790px">
<!-- lujinli -->
<!-- <table class="history w-full text-center text-16px border-spacing-0 "> -->
<table class="history w-full text-center text-18px border-spacing-0">
<thead
style="
background-color: #e7edff;
color: #000;
height: 50px;
width: 220px;
border: 1px solid #417bef;
"
>
<tr class="text-20px leading-50px">
<th width="20%">
<img
src="@/assets/images/baiot@2x.png"
class="w35px mt--7px mr-5px"
/>
</th>
<th width="20%">
<img
src="@/assets/images/scbmm@2x.png"
class="w35px mt--7px mr-5px"
/>
</th>
<th width="20%">
<img
src="@/assets/images/scbmm@2x.png"
class="w35px mt--7px mr-5px"
/>
</th>
<th width="20%">
<img
src="@/assets/images/riqii@2x.png"
class="w35px mt--7px mr-5px"
/>
</th>
<th width="20% text-center">操作</th>
</tr>
</thead>
<tbody class="h650px overflow-auto absolute w-full">
<tr class="w-full flex leading-50px" v-for="it in tableData">
<td
class="w20% h50px cursor-pointer overflow-hidden text-left pl25px truncate text-#000"
>
<div class="flex items-center truncate">
<img
v-if="isNotOneWeekAgo(it.createTime)"
src="@/assets/images/NEW.gif"
class="!h-20px !w-auto mr-2"
alt=""
/>
<span :title="it.title"> {{ it.title }}</span>
</div>
</td>
<td class="w20% h50px">{{ it.deptName }}</td>
<td class="w20% h50px">{{ it.parentDeptName }}</td>
<td class="w20% h50px">{{ it.createTime }}</td>
<td class="w20% h50px">
<!-- <el-button style="color: #000;" @click="openUrl(it)"></el-button> -->
<!-- <el-button style="color: #000;" @click="downloads(it)"></el-button> -->
<n-popover
trigger="hover"
placement="top-start"
v-if="
arr.includes(it.id) ||
(it.fileCommon?.fileSize || 0) > 25 * 1024 * 1024
"
>
<template #trigger>
<el-button style="color: #000" @click="downloads(it)"
>查看</el-button
>
</template>
<span
>该文件超过25MB无法进行预览请点击 查看
进行下载</span
>
</n-popover>
<el-button v-else style="color: #000" @click="downloads(it)"
>查看</el-button
>
</td>
</tr>
</tbody>
</table>
<div class="float-right absolute bottom-20px right-30px">
<el-pagination
v-model:current-page="pageInfo.currentPage"
v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, jumper"
:total="pageInfo.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
</div>
</div>
</div>
<n-modal v-model:show="pdfShow">
<div class="w100% h100%">
<el-icon
color="#fff"
size="26px"
@click="pdfShow = false"
class="absolute left-92% bg-#F43"
><Close
/></el-icon>
<Amtion :data="src" :datas="srcType" />
</div>
</n-modal>
<div class="bg-#fff rd-15px px30px pt30px w-full h930px">
<div class="rd-15px w-full h870px" style="box-shadow: 1px 2px 26px -3px #cdcccc">
<div class="h80px rd-t-15px bg-#4877FB leading-80px text-#fff text-20px">
<img src="@/assets/images/Shape7@2x.png" class="w50px ml-30px mr10px mt--20px" />
{{ title }}
<div class="float-right top-0 right-30px">
<el-button
class="mr-30px"
v-if="isDbReview || isDbUpload || userCode"
type="warning"
@click="push({ path: '/DataBase/review' })"
>
审批流程
</el-button>
<el-button
v-if="isDbReview || isDbUpload || userCode"
type="primary"
@click="push('/DataBase/Modify')"
>内容管理</el-button
>
</div>
</div>
<div class="p30px relative h790px">
<!-- lujinli -->
<!-- <table class="history w-full text-center text-16px border-spacing-0 "> -->
<table class="history w-full text-center text-18px border-spacing-0">
<thead
style="
background-color: #e7edff;
color: #000;
height: 50px;
width: 220px;
border: 1px solid #417bef;
"
>
<tr class="text-20px leading-50px">
<th width="20%">
<img src="@/assets/images/baiot@2x.png" class="w35px mt--7px mr-5px" />标题
</th>
<th width="20%">
<img src="@/assets/images/scbmm@2x.png" class="w35px mt--7px mr-5px" />上传科室
</th>
<th width="20%">
<img src="@/assets/images/scbmm@2x.png" class="w35px mt--7px mr-5px" />上传部门
</th>
<th width="20%">
<img src="@/assets/images/riqii@2x.png" class="w35px mt--7px mr-5px" />上传日期
</th>
<th width="20% text-center">操作</th>
</tr>
</thead>
<tbody class="h650px overflow-auto absolute w-full">
<tr class="w-full flex leading-50px" v-for="it in tableData">
<td
class="w20% h50px cursor-pointer overflow-hidden text-left pl25px truncate text-#000"
>
<div class="flex items-center truncate">
<img
v-if="isNotOneWeekAgo(it.createTime)"
src="@/assets/images/NEW.gif"
class="!h-20px !w-auto mr-2"
alt=""
/>
<span :title="it.title"> {{ it.title }}</span>
</div>
</td>
<td class="w20% h50px">{{ it.deptName }}</td>
<td class="w20% h50px">{{ it.parentDeptName }}</td>
<td class="w20% h50px">{{ it.createTime }}</td>
<td class="w20% h50px">
<!-- <el-button style="color: #000;" @click="openUrl(it)"></el-button> -->
<!-- <el-button style="color: #000;" @click="downloads(it)"></el-button> -->
<n-popover
trigger="hover"
placement="top-start"
v-if="arr.includes(it.id) || (it.fileCommon?.fileSize || 0) > 25 * 1024 * 1024"
>
<template #trigger>
<el-button style="color: #000" @click="downloads(it)"></el-button>
</template>
<span>该文件超过25MB无法进行预览请点击 查看 进行下载</span>
</n-popover>
<el-button v-else style="color: #000" @click="downloads(it)"></el-button>
</td>
</tr>
</tbody>
</table>
<div class="float-right absolute bottom-20px right-30px">
<el-pagination
v-model:current-page="pageInfo.currentPage"
v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, jumper"
:total="pageInfo.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
</div>
</div>
</div>
<n-modal v-model:show="pdfShow">
<div class="w100% h100%">
<el-icon color="#fff" size="26px" @click="pdfShow = false" class="absolute left-92% bg-#F43"
><Close
/></el-icon>
<Amtion :data="src" :datas="srcType" />
</div>
</n-modal>
</template>
<style>
.truncate {
display: block;
/* max-width: 226px; */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
/* max-width: 226px; */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,69 +2,75 @@
import HomeHead from '@/views/home/components/HomeHead.vue'
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import { NModal, useMessage } from 'naive-ui'
import { getCateList, editCateItem,getCateItemList,deleteCateItem ,getLabActList} from '@/api/daikin/base'
import {
getCateList,
editCateItem,
getCateItemList,
deleteCateItem,
getLabActList
} from '@/api/daikin/base'
import { useUserStore } from '@/stores/modules/user'
import { useDate } from '@/views/home/hooks/useDate'
import { useMyStore } from '@/stores/modules/mystor'
const myStore = useMyStore();
const myStore = useMyStore()
const message = useMessage()
const store = useUserStore()
const header = { 'token': store.user.token }
const userCode = ['admin', 'theme_dandang', 'tech_service'].includes(store.user.roleCode)
const userCode = ['admin', 'theme_dandang', 'tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
const { day, week } = useDate()
const route = useRoute()
const { push } = useRouter()
const dataA = ref([])
const shomkA = ref(false)
const actMidIsSelects=ref()
const actMidIsSelects = ref()
const activeName = ref()
const tabsList = ref()
const cateIds = ref()
const starId = ref()
const state = reactive<any>({
pageNum: 1,
cateId:route.params.id!==':id'?route.params.id:starId.value,
})
pageNum: 1,
cateId: route.params.id !== ':id' ? route.params.id : starId.value
})
onMounted(async () => {
const { data } = await getLabActList()
actMidIsSelects.value = data.actMidIsSelect
const indexId = myStore.data
const indexId = myStore.data
console.log(indexId)
const { data: dataBot } = await getCateList({indexId})
const { data: dataBot } = await getCateList({ indexId })
tabsList.value = dataBot
if(dataBot.length>0){
if (dataBot.length > 0) {
starId.value = dataBot[0].id
}
console.log(starId.value)
cateIds.value = route.params.id
activeName.value = route.params.id!==':id'?route.params.id:starId.value+''
activeName.value = route.params.id !== ':id' ? route.params.id : starId.value + ''
})
async function getItemList() {
const {rows} =await getCateItemList(state)
const { rows } = await getCateItemList(state)
dataA.value = rows
}
const ss = computed(() => [state.pageNum, state.cateId])
watch(() => unref(ss),
async (v) => {
getItemList()
},
{ immediate: true, deep: true },
)
watch(
() => unref(ss),
async (v) => {
getItemList()
},
{ immediate: true, deep: true }
)
const handleClick = (tab: TabsPaneContext, event: Event) => {
state.cateId = tab.props.label
cateIds.value = tab.props.label
cateIds.value = tab.props.label
starId.value = tab.props.label
console.log(tab.props.label)
}
@ -76,89 +82,92 @@ const editA = ref({
fileList: []
})
async function onSubmit(row: { id: number; url: any; title: string; time: string; dowhat: string; files: never[]; fileList: never[] }) {
async function onSubmit(row: {
id: number
url: any
title: string
time: string
dowhat: string
files: never[]
fileList: never[]
}) {
console.log(row)
const { id, title, fileList } = row
const cateId = cateIds.value===':id'?activeName.value:cateIds.value
const cateId = cateIds.value === ':id' ? activeName.value : cateIds.value
let filePath
console.log(cateId)
if (fileList && fileList.length > 0) {
filePath = fileList.map(file => {
if(file.response){
return file.response.url
}
else{
return file.url
}
}).join(',')
filePath = fileList
.map((file) => {
if (file.response) {
return file.response.url
} else {
return file.url
}
})
.join(',')
}
console.log({id,title,cateId,filePath})
if(cateId&&cateId=='undefined'){
message.error("请先添加类别!")
console.log({ id, title, cateId, filePath })
if (cateId && cateId == 'undefined') {
message.error('请先添加类别!')
return
}
const { code, msg } = await editCateItem({ id, title, cateId, filePath })
if (code === 200) { message.success("添加成功!") }
else { message.error(msg) }
window.location.reload();
if (code === 200) {
message.success('添加成功!')
} else {
message.error(msg)
}
window.location.reload()
shomkA.value = false
}
const handleEdit = (row: any) => {
console.log(row)
row.fileList = row.filePathList.map(item=>Object.assign(item,{
name:item.originalFileName
}))
shomkA.value = true
if (!row) return
editA.value = row
console.log(row)
row.fileList = row.filePathList.map((item) =>
Object.assign(item, {
name: item.originalFileName
})
)
shomkA.value = true
if (!row) return
editA.value = row
}
async function handleDelete(obj) {
const {id} = obj
const { code,msg} =await deleteCateItem({id})
if (code === 200) { message.success("删除成功!") }
else { message.error(msg) }
window.location.reload();
const { id } = obj
const { code, msg } = await deleteCateItem({ id })
if (code === 200) {
message.success('删除成功!')
} else {
message.error(msg)
}
window.location.reload()
}
async function downloadFile(data) {
// console.log(data)
if(actMidIsSelects.value===2){
message.info("没有访问权限")
return
}
if (actMidIsSelects.value === 2) {
message.info('没有访问权限')
return
}
const url = data.it.url
try {
const response = await fetch(url);
const blob = await response.blob();
const response = await fetch(url)
const blob = await response.blob()
const downloadUrl = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = downloadUrl;
link.download = data.it.originalFileName; //
link.click();
URL.revokeObjectURL(downloadUrl);
const downloadUrl = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = downloadUrl
link.download = data.it.originalFileName //
link.click()
URL.revokeObjectURL(downloadUrl)
} catch (error) {
message.error('下载文件出错:', error);
message.error('下载文件出错:', error)
}
}
</script>
<template>
<HomeHead class="top">
@ -174,9 +183,14 @@ async function downloadFile(data) {
<div class="text-18px ml40px mr25px">{{ day }}</div>
<div class="text-18px">{{ week }}</div>
</div>
<div class="q-wrapper flex-1 mt30px text-#142142 flex flex-col bg-#fff p30px rounded-20px">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane v-for="(item,ind) in tabsList" :label="item.id" :name="item.id+''" :index="item.id">
<div class="q-wrapper flex-1 mt30px text-#142142 flex flex-col bg-#fff p30px rounded-20px">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane
v-for="(item, ind) in tabsList"
:label="item.id"
:name="item.id + ''"
:index="item.id"
>
<template #label>
<span class="custom-tabs-label">
<span class="text-20px">{{ item.cateName }}</span>
@ -186,54 +200,59 @@ async function downloadFile(data) {
</el-tabs>
<div>
<div v-if="dataA" v-for="iet in dataA" class="py25px px10px text-18px ">
<span class="content">{{iet.title}}</span>
<el-dropdown max-height="100px" @command="downloadFile" class="top--5px w50px block float-left">
<el-icon size="25" color="#0054E4">
<CaretBottom />
</el-icon>
<div v-if="dataA" v-for="iet in dataA" class="py25px px10px text-18px">
<span class="content">{{ iet.title }}</span>
<el-dropdown
max-height="100px"
@command="downloadFile"
class="top--5px w50px block float-left"
>
<el-icon size="25" color="#0054E4">
<CaretBottom />
</el-icon>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-if="iet.filePathList" v-for="it in iet.filePathList"
:command="{ it }">{{ it.originalFileName }}</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<!--
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item
v-if="iet.filePathList"
v-for="it in iet.filePathList"
:command="{ it }"
>{{ it.originalFileName }}</el-dropdown-item
>
</el-dropdown-menu>
</template>
</el-dropdown>
<!--
<div v-if="userCode" class="w120px block float-right">
<el-button size="small" @click="handleEdit(iet)"></el-button>
<el-button size="small" type="danger" @click="handleDelete(iet)"></el-button>
</div> -->
</div>
</div>
</div>
<!-- <el-button v-if="userCode" type="primary" class="" @click="shomkA = !shomkA"></el-button> -->
</div>
<n-modal v-model:show="shomkA">
<div class="bg-#FFF p30px">
<el-form :model="editA" label-width="120px" :inline="true">
<br>
<br />
<el-form-item label="标题">
<el-input v-model="editA.title" />
</el-form-item>
<br>
<br />
<el-form-item label="文件">
<el-upload v-model:file-list="editA.fileList" class="upload-demo" :headers="header"
action="/test-api/common/upload">
<el-upload
v-model:file-list="editA.fileList"
class="upload-demo"
:headers="header"
action="/test-api/common/upload"
>
<el-button type="primary">选择文件</el-button>
</el-upload>
</el-form-item>
</el-form>
<hr class="mb15px border-#f1f1f1">
<hr class="mb15px border-#f1f1f1" />
<el-form-item>
<el-button type="primary" @click="onSubmit(editA)"></el-button>
</el-form-item>
@ -241,15 +260,15 @@ async function downloadFile(data) {
</n-modal>
</template>
<style lang="less">
.el-tabs__content{
.el-tabs__content {
padding: 0;
}
.content{
.content {
display: block;
max-width:1100px;
max-width: 1100px;
float: left;
white-space: nowrap;
overflow: hidden;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.top {
@ -264,4 +283,4 @@ async function downloadFile(data) {
right: 20px;
z-index: 500;
}
</style>
</style>

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,20 @@
<script setup lang="ts">
import { useMessage, NModal, NSelect } from 'naive-ui'
import { useUserStore } from '@/stores/modules/user'
import { getLabCsrActList, updateLab, getCateList, addLab, getLabActList,actLABDel,updateActOne,deleteCateItem ,editCateItem} from '@/api/daikin/base'
import { time } from 'echarts';
import {
getLabCsrActList,
updateLab,
getCateList,
addLab,
getLabActList,
actLABDel,
updateActOne,
deleteCateItem,
editCateItem
} from '@/api/daikin/base'
import { time } from 'echarts'
import UserList from '@/views/home/intelligence/process/UserPages.vue'
import { pickerOptions } from '@/utils/date'
const ids = ref('')
const { push } = useRouter()
@ -19,7 +30,7 @@ onBeforeMount(async () => {
const { data: dataBot1 } = await getCateList({ indexId: 1 })
const { data: dataBot3 } = await getCateList({ indexId: 3 })
options.value = dataBot
list.value.map(item => {
list.value.map((item) => {
if (item.id === 2) {
item.options = dataBot
}
@ -53,11 +64,9 @@ onBeforeMount(async () => {
// console.log( swiperList.value )
})
const store = useUserStore()
const message = useMessage()
async function onSubmitAdd() {
console.log(swiperList.value)
let newData = swiperList.value.map((item) => {
@ -65,55 +74,53 @@ async function onSubmitAdd() {
const urls = item.fileList.map((file) => {
if (file.response) {
return file.response.url
}
else {
} else {
return file.url
}
});
return { ...item, filePath: urls.join(",") };
});
})
return { ...item, filePath: urls.join(',') }
})
newData.forEach((item) => {
delete item.fileList;
});
delete item.fileList
})
// const data = JSON.stringify(newData)
console.log(newData)
const { code, msg } = await updateLab(newData)
// const { code, msg } = await editCateItem(newData)
if (code === 200) { message.success("修改成功") }
else message.warning(msg)
if (code === 200) {
message.success('修改成功')
} else message.warning(msg)
// getSwiperList()
// push({name:'Diffspace'})
}
async function onSubmit(row) {
// swiperList.value.push(row)
console.log(row)
if (row.indexId === '') {
message.info("请选择分类选项!")
message.info('请选择分类选项!')
return
}
if (!row.catId || row.catId === '') {
message.info("请选择所属模块!")
message.info('请选择所属模块!')
return
}
row.title = '【' + row.catId + '】' + row.title
if(row.fileList&&row.fileList.length>0){
if (row.fileList && row.fileList.length > 0) {
if (row.fileList[0].response) {
row.filePath = row.fileList[0].response.url
}
else {
row.filePath = row.fileList[0].url
}
}
const {msg,code} = await updateActOne(row)
if (code === 200) {
message.success("操作成功")
getSwiperList()
row.filePath = row.fileList[0].response.url
} else {
row.filePath = row.fileList[0].url
}
}
const { msg, code } = await updateActOne(row)
if (code === 200) {
message.success('操作成功')
getSwiperList()
}
// else message.warning(msg)
// swiperList.value.map(obj => {
// obj.id === row.id ? { ...obj, ...row } : obj
@ -130,19 +137,41 @@ async function onSubmit(row) {
// }
shomkB.value = false
console.log(swiperList.value)
}
async function onSubmitAdds() {
const actTopUserList = unref(actTopUserLists.value)
const actMidUserList = unref(actMidUserLists.value)
const actDownUserList = unref(actDownUserLists.value)
const { id, bannerUserList, leftUserList, rightUserList, memberUserList, bannerContent, leftContent, rightContent, memberContent } = Data.value
const { code, msg } = await addLab({ id, bannerUserList, leftUserList, rightUserList, memberUserList, bannerContent, leftContent, rightContent, memberContent, actTopUserList, actMidUserList, actDownUserList })
if (code === 200) { message.success("修改成功") }
else message.warning(msg)
const {
id,
bannerUserList,
leftUserList,
rightUserList,
memberUserList,
bannerContent,
leftContent,
rightContent,
memberContent
} = Data.value
const { code, msg } = await addLab({
id,
bannerUserList,
leftUserList,
rightUserList,
memberUserList,
bannerContent,
leftContent,
rightContent,
memberContent,
actTopUserList,
actMidUserList,
actDownUserList
})
if (code === 200) {
message.success('修改成功')
} else message.warning(msg)
}
const shomkB = ref(false)
@ -151,20 +180,16 @@ const shomksB = () => {
console.log(shomkB.value)
}
let swiperList = ref([
])
let swiperList = ref([])
const editList = ref()
const handleEdit = (index: number, row: any) => {
console.log(row)
if (row && row.url) {
console.log(row.files.length)
if (row.files.length <= 0) {
row.files.push({ url: row.url });
row.files.push({ url: row.url })
}
}
else {
} else {
editList.value = {
id: '',
indexId: '1',
@ -180,43 +205,53 @@ const handleEdit = (index: number, row: any) => {
console.log(row)
}
const list = ref([{
id: 1,
title: '部品业种',
options: [{ id: '1', cateName: 'DEVICE' }, { id: '2', cateName: '加工品' }, { id: '3', cateName: '原材料' }]
},
{
id: 3,
title: '走访类型',
options: [{ id: '1', cateName: '供方走访' }, { id: '2', cateName: '展会走访' }, { id: '3', cateName: '企业走访' }]
},
{
id: 2,
title: '探索方向',
options: []
},
const list = ref([
{
id: 1,
title: '部品业种',
options: [
{ id: '1', cateName: 'DEVICE' },
{ id: '2', cateName: '加工品' },
{ id: '3', cateName: '原材料' }
]
},
{
id: 3,
title: '走访类型',
options: [
{ id: '1', cateName: '供方走访' },
{ id: '2', cateName: '展会走访' },
{ id: '3', cateName: '企业走访' }
]
},
{
id: 2,
title: '探索方向',
options: []
}
])
const opt = ref()
const radioClick = (e) => {
opt.value = list.value.find(item => item.id == e)
opt.value = list.value.find((item) => item.id == e)
// console.log(ll)
}
const handleDelete = async (index: number, row: any) => {
swiperList.value = swiperList.value.filter(item => item.id !== row.id);
swiperList.value = swiperList.value.filter((item) => item.id !== row.id)
const id = row.id
if(!id) return
const {code,msg} =await actLABDel({id})
if(code===200){message.info("操作成功!")}
else{
message.error(msg)
}
getSwiperList()
if (!id) return
const { code, msg } = await actLABDel({ id })
if (code === 200) {
message.info('操作成功!')
} else {
message.error(msg)
}
getSwiperList()
}
const handOnExceed: UploadProps['onExceed'] = (uploadFile: any, uploadFiles: any) => {
message.warning("最多只能上传一个文件!")
message.warning('最多只能上传一个文件!')
}
const header = { 'token': store.user.token }
@ -232,7 +267,6 @@ const getUser = (id: any) => {
}
}
//
const handleChild = (data: any) => {
const { showModal: show, multipleSelection } = data
@ -240,95 +274,117 @@ const handleChild = (data: any) => {
// userList.value = multipleSelection
let userIdList: any[] = []
multipleSelection.value.forEach((i: { userId: any }) => {
userIdList.push(i.userId)
})
if (flg.value === 1) {
actTopUserLists.value = userIdList
// actDownUserLists.value = userIdList
// actMidUserLists.value = userIdList
}
else {
} else {
actMidUserLists.value = userIdList
}
console.log(userIdList)
onSubmitAdds()
}
const CloseThiss = (data: boolean) => {
console.log(data)
showModal.value = data
}
const value = ref()
const optt = [{ id: '1', cateName: '核心部品强化' }, { id: '2', cateName: '新领域部材探索' }, { id: '3', cateName: '外部调研报告' }]
const optt = [
{ id: '1', cateName: '核心部品强化' },
{ id: '2', cateName: '新领域部材探索' },
{ id: '3', cateName: '外部调研报告' }
]
const listData = ref()
const thisSelect = (e) => {
pageInfo.index = e
}
const thisSelects = () => {
pageInfo.index = ''
}
const pageInfo = reactive({
currentPage:1,
pageSize:10,
total:10,
index:''
currentPage: 1,
pageSize: 10,
total: 10,
index: ''
})
const ss = computed(() => [pageInfo.index,pageInfo.currentPage])
watch(() => unref(ss),
const ss = computed(() => [pageInfo.index, pageInfo.currentPage])
watch(
() => unref(ss),
async (v) => {
getSwiperList()
},
{ immediate: true, deep: true },
{ immediate: true, deep: true }
)
async function getSwiperList() {
const indexId = pageInfo.index
const { rows,total } = await getLabCsrActList({ indexId,pageNum:pageInfo.currentPage,pageSize:pageInfo.pageSize })
const { rows, total } = await getLabCsrActList({
indexId,
pageNum: pageInfo.currentPage,
pageSize: pageInfo.pageSize
})
pageInfo.total = total
if (!rows) return
const datas = rows.map((item: any) => Object.assign(item, {
indexId: item.indexId + '',
}))
const datas = rows.map((item: any) =>
Object.assign(item, {
indexId: item.indexId + ''
})
)
swiperList.value = datas
swiperList.value = datas.map((item: { filePathList: any[] }) => {
const fileList = item.filePathList.map((itt: any) => Object.assign(itt, {
name: itt.originalFileName,
url: itt.url
}))
const fileList = item.filePathList.map((itt: any) =>
Object.assign(itt, {
name: itt.originalFileName,
url: itt.url
})
)
return { ...item, fileList }
})
}
const handleSizeChange=(e)=>{
const handleSizeChange = (e) => {
console.log(e)
}
const handleCurrentChange=(e)=>{
const handleCurrentChange = (e) => {
console.log(e)
}
</script>
<template>
<div class="relative w-full h-full">
<div class="flex my20px">
<el-button type="primary" @click="handleEdit" class="mr-20px">新增研究方向内容</el-button>
<div class="leading-30px w125px h50px ml20px">请选择类别</div>
<n-select class="w250px" size="large" v-if="optt" :show-arrow="false" :show-checkmark="false" v-model:value="value" :options="optt" label-field="cateName"
value-field="id" @update:value="thisSelect" />
<n-select
class="w250px"
size="large"
v-if="optt"
:show-arrow="false"
:show-checkmark="false"
v-model:value="value"
:options="optt"
label-field="cateName"
value-field="id"
@update:value="thisSelect"
/>
<el-button type="primary" @click="thisSelects" class="ml-20px mt5px">重置</el-button>
</div>
<el-table :data="swiperList" style="width: 100%,height: 600px;overflow-y: auto;"
:header-cell-style="{ background: '#2A7BF7', color: '#fff', height: '60px', textAlign: 'center', 'font-size': '24px' }"
:cell-style="{ 'text-align': 'center','overflow-y':'auto' }">
<el-table
:data="swiperList"
style="width: 100%,height: 600px;overflow-y: auto;"
:header-cell-style="{
background: '#2A7BF7',
color: '#fff',
height: '60px',
textAlign: 'center',
'font-size': '24px'
}"
:cell-style="{ 'text-align': 'center', 'overflow-y': 'auto' }"
>
<el-table-column label="标题" prop="title" />
<el-table-column label="分类选项" width="280">
<template #default="scope">
@ -345,7 +401,6 @@ const handleCurrentChange=(e)=>{
{{ it.name }}
</div>
</template>
</el-table-column>
<!-- <el-table-column label="通知范围" prop="fileList" >
<template #default="scope">
@ -358,14 +413,14 @@ const handleCurrentChange=(e)=>{
<el-table-column label="操作" :header-style="{ background: 'red' }">
<template #default="scope">
<el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
<el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
<el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<el-form-item>
<div class="my20px fixed bottom-25px left-20% z-2000 h50px w-200px">
<!-- <el-button type="primary" @click="onSubmitAdd"></el-button> -->
@ -375,16 +430,17 @@ const handleCurrentChange=(e)=>{
</div>
</el-form-item>
<div class=" fixed bottom-65px right-100px ">
<el-pagination v-model:current-page="pageInfo.currentPage" v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, jumper" :total="pageInfo.total"
@size-change="handleSizeChange" @current-change="handleCurrentChange" />
</div>
<div class="fixed bottom-65px right-100px">
<el-pagination
v-model:current-page="pageInfo.currentPage"
v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, jumper"
:total="pageInfo.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
<n-modal v-model:show="shomkB">
<div class="bg-#FFF p30px">
<el-form :model="editList" label-width="120px" :inline="true">
<el-form-item label="分类选项">
@ -394,26 +450,72 @@ const handleCurrentChange=(e)=>{
<el-radio label="3" size="large">外部调研报告</el-radio>
</el-radio-group>
</el-form-item>
<br>
<br />
<el-form-item :label="opt.title">
<n-select class="min-w220px" size="large" v-if="opt.options" v-model:value="editList.catId"
:options="opt.options" label-field="cateName" value-field="cateName" />
<n-select
class="min-w220px"
v-if="opt.options"
v-model:value="editList.catId"
:options="opt.options"
label-field="cateName"
value-field="cateName"
/>
</el-form-item>
<br>
<br />
<el-form-item label="标题">
<el-input v-model="editList.title" />
</el-form-item>
<br>
<br />
<el-form-item label="文件">
<el-upload v-model:file-list="editList.fileList" class="upload-demo" :headers="header"
action="/test-api/common/upload" :on-change="handleChange" :on-exceed="handOnExceed" :limit="1">
<el-upload
v-model:file-list="editList.fileList"
class="upload-demo"
:headers="header"
action="/test-api/common/upload"
:on-change="handleChange"
:on-exceed="handOnExceed"
:limit="1"
>
<el-button type="primary">选择文件</el-button>
</el-upload>
</el-form-item>
<br />
<el-form-item label="是否置顶">
<el-switch
v-model="editList.isTop"
active-text="置顶"
inactive-text="不置顶"
:inactive-value="0"
:active-value="1"
></el-switch>
</el-form-item>
<br />
<el-form-item label="是否定时发送">
<el-switch
v-model="editList.isPublish"
active-text="是"
inactive-text="否"
:inactive-value="0"
:active-value="1"
@change="(val) => (editList.publishTime = val ? pickerOptions.day : '')"
></el-switch>
</el-form-item>
<br />
<el-form-item label="发布时间" v-if="editList.isPublish == 1">
<el-date-picker
v-model="editList.publishTime"
align="right"
type="date"
placeholder="选择日期"
:disabledDate="pickerOptions.disabledDate"
:shortcuts="pickerOptions.shortcuts"
:value-format="pickerOptions.valueFormat"
>
</el-date-picker>
</el-form-item>
</el-form>
<hr class="mb15px border-#f1f1f1">
<hr class="mb15px border-#f1f1f1" />
<el-form-item>
<el-button type="primary" @click="onSubmit(editList)"></el-button>
</el-form-item>
@ -430,4 +532,4 @@ const handleCurrentChange=(e)=>{
right: 30px;
top: -92px;
}
</style>
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 KiB

View File

@ -30,8 +30,17 @@ const props = defineProps({
<div class="containers" v-html="content"></div>
</div>
</template>
<style>
.containers a {
line-break: anywhere;
}
</style>
<style scoped lang="less">
::deep(.containers) {
a {
line-break: anywhere;
}
}
.news-wrapper {
.title {
font-size: 22px;

View File

@ -1,9 +1,10 @@
<!-- 外部情报 -->
<script setup lang="ts">
// import Vue3Tinymce from '@jsdawn/vue3-tinymce';
import HomeHead from "@/views/home/components/HomeHead.vue";
import HomeHead from '@/views/home/components/HomeHead.vue'
import UserPage from '../../../home/intelligence/process/UserPages.vue'
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import { useDate } from "@/views/home/hooks/useDate";
import { useDate } from '@/views/home/hooks/useDate'
import {
NModal,
NForm,
@ -14,37 +15,38 @@ import {
NSelect,
NSpace,
NRadioGroup,
useMessage,
useMessage
// FormInst,
} from "naive-ui";
import { saveArticle, trendsDetail } from "@/api/daikin/base";
import Editor from "../components/TinyECE.vue";
import { useUserStore } from "@/stores/modules/user";
import { useRoute } from "vue-router";
const { day, week } = useDate();
const { push } = useRouter();
const store = useUserStore();
let route = useRoute();
let cate = ref(1);
const fileList = ref<[]>();
const editorContent = ref("");
const formRef = ref<any | null>(null);
const message = useMessage();
} from 'naive-ui'
import { saveArticle, trendsDetail } from '@/api/daikin/base'
import Editor from '../components/TinyECE.vue'
import { useUserStore } from '@/stores/modules/user'
import { pickerOptions } from '@/utils/date'
import { useRoute } from 'vue-router'
const { day, week } = useDate()
const { push } = useRouter()
const store = useUserStore()
let route = useRoute()
let cate = ref(1)
const fileList = ref<[]>()
const editorContent = ref('')
const formRef = ref<any | null>(null)
const message = useMessage()
const formValue: any = ref({
type: "1",
cate: "1",
title: "",
tag: "",
source: "",
content: "",
reviewSource: "2",
});
type: '1',
cate: '1',
title: '',
tag: '',
source: '',
content: '',
reviewSource: '2'
})
if (route.query.id) {
trendsDetail(route.query.id).then((res) => {
let data = res.data;
console.log(res);
let data = res.data
console.log(res)
formValue.value = {
type: data.type,
cate: data.cate,
@ -52,34 +54,34 @@ if (route.query.id) {
tag: data.tag,
source: data.source,
content: unescapeHTML(data.content),
reviewSource: data.reviewSource,
};
editorContent.value = unescapeHTML(data.content);
reviewSource: data.reviewSource
}
editorContent.value = unescapeHTML(data.content)
if (data.type === 2) {
cate.value = 3;
cate.value = 3
} else {
}
console.log(cate.value, data.cate);
console.log(cate.value, data.cate)
rules = {
title: {
required: false,
message: "请输入标题",
trigger: "blur",
message: '请输入标题',
trigger: 'blur'
},
tag: {
required: true,
message: "请输入标题",
trigger: "blur",
message: '请输入标题',
trigger: 'blur'
},
content: {
required: false,
message: "请输入内容",
trigger: "blur",
},
};
});
message: '请输入内容',
trigger: 'blur'
}
}
})
}
let rules: any = {
// cate: {
@ -89,123 +91,146 @@ let rules: any = {
// },
title: {
required: false,
message: "请输入标题",
trigger: "blur",
message: '请输入标题',
trigger: 'blur'
},
tag: {
required: true,
message: "请输入标题",
trigger: "blur",
message: '请输入标题',
trigger: 'blur'
},
content: {
required: false,
message: "请输入内容",
trigger: "blur",
},
};
message: '请输入内容',
trigger: 'blur'
}
}
function change(i: any) {
// console.log(i)
cate.value = i;
cate.value = i
// console.log(formValue.cate)
formValue.cate = i;
formValue.cate = i
// console.log(formValue.cate)
}
function sure(e: MouseEvent) {
e.preventDefault();
e.preventDefault()
formRef.value?.validate((errors) => {
if (!errors) {
formValue.value.cate = cate.value;
formValue.value.cate = cate.value
if (!formValue.value.type) {
message.success("请选择类型");
return;
message.success('请选择类型')
return
}
// console.log('555555', editorContent.value);
save();
save()
} else {
console.log(errors);
message.error("请输入完整");
console.log(errors)
message.error('请输入完整')
}
});
})
}
function escapeHTML(html: string): string {
const tempElement = document.createElement("div");
tempElement.textContent = html;
return tempElement.innerHTML;
const tempElement = document.createElement('div')
tempElement.textContent = html
return tempElement.innerHTML
}
function unescapeHTML(html: string) {
const doc = new DOMParser().parseFromString(html, "text/html");
return doc.documentElement.textContent;
const doc = new DOMParser().parseFromString(html, 'text/html')
return doc.documentElement.textContent
}
const header = { token: store.user.token };
const header = { token: store.user.token }
// console.log(store.user.token)
const dialogImageUrl = ref("");
const dialogVisible = ref(false);
const dialogImageUrl = ref('')
const dialogVisible = ref(false)
const handleRemove: UploadProps["onRemove"] = (
uploadFile: any,
uploadFiles: any
) => {
const handleRemove: UploadProps['onRemove'] = (uploadFile: any, uploadFiles: any) => {
// console.log(dialogImageUrl,dialogVisible)
};
}
const handlePictureCardPreview: UploadProps["onPreview"] = (uploadFile: {
url: string;
}) => {
dialogImageUrl.value = uploadFile.url!;
dialogVisible.value = true;
const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile: { url: string }) => {
dialogImageUrl.value = uploadFile.url!
dialogVisible.value = true
// console.log(dialogImageUrl.value)
};
}
async function save() {
const cont = editorContent.value;
const content = escapeHTML(cont);
const reviewSource = 2;
const cont = editorContent.value
const content = escapeHTML(cont)
const reviewSource = 2
// console.log(fileList.value)
let bannerImg;
let bannerImg
if (fileList.value && fileList.value.length > 0) {
bannerImg = fileList.value.map((item) => item.response.url).join("");
bannerImg = fileList.value.map((item) => item.response.url).join('')
} else {
}
console.log(formValue.value);
let userIdList: any[] = []
if (dataList.value?.length > 0) {
dataList.value.forEach((i: { userId: any }) => {
userIdList.push(i.userId)
})
}
const { title, tag, source, cate, type } = formValue.value;
console.log(cate);
const { title, tag, source, cate, type, isTop, isPublish, publishTime } = formValue.value
console.log(cate)
const { msg, code } = await saveArticle({
title,
tag: "",
tag: '',
reviewSource,
source,
cate: formValue.cate || formValue.value.cate,
type,
content,
bannerImg,
});
userIdList,
isTop,
isPublish,
publishTime
})
if (code === 200) {
message.success("新增成功");
message.success('新增成功')
// window.location.reload();
history.back();
history.back()
} else {
message.success(msg);
message.success(msg)
}
}
//
const handleChild = (data: string) => {
editorContent.value = data;
};
editorContent.value = data
}
const radios = (e: any) => {
console.log(e.srcElement.value);
if (e.srcElement.value === "1") {
cate.value = 1;
console.log(e.srcElement.value)
if (e.srcElement.value === '1') {
cate.value = 1
} else {
cate.value = 4;
cate.value = 4
}
};
const showModal = ref(false);
}
const showModal = ref(false)
const showModal1 = ref(false)
const setUserList = ref()
const dataList = ref()
const thisClick = () => {
showModal1.value = true
setUserList.value = dataList.value || []
}
const CloseThis = (data: boolean) => {
showModal1.value = data
}
const handleChild1 = (data: any) => {
const { showModal: show, multipleSelection } = data
showModal1.value = unref(show)
dataList.value = unref(multipleSelection)
}
const handleClose = (tag: any) => {
dataList.value.splice(dataList.value.indexOf(tag), 1)
}
</script>
<template>
@ -332,16 +357,64 @@ const showModal = ref(false);
<n-input v-model:value="formValue.source" placeholder="" />
</n-form-item>
<n-form-item label="情报内容" path="content">
<Editor
@getChildData="handleChild"
v-model="formValue.content"
></Editor>
<Editor @getChildData="handleChild" v-model="formValue.content"></Editor>
</n-form-item>
<n-button @click="thisClick"> </n-button>
<div class="mt15px h150px overflow-y-auto">
<el-tag
v-for="i in dataList"
:key="i"
class="mx-1 my5px"
closable
:disable-transitions="false"
@close="handleClose(i)"
type="info"
size="large"
>
{{ i.nickName }}
</el-tag>
</div>
<n-form-item label="是否置顶">
<el-switch
v-model="formValue.isTop"
active-text="置顶"
inactive-text="不置顶"
inactive-value="N"
active-value="Y"
></el-switch>
</n-form-item>
<n-form-item label="是否定时发送">
<el-switch
v-model="formValue.isPublish"
active-text="是"
inactive-text="否"
:inactive-value="0"
:active-value="1"
@change="(val) => (formValue.publishTime = val ? pickerOptions.day : '')"
></el-switch>
</n-form-item>
<n-form-item label="发布时间" v-if="formValue.isPublish == 1">
<el-date-picker
v-model="formValue.publishTime"
align="right"
type="date"
placeholder="选择日期"
:disabledDate="pickerOptions.disabledDate"
:shortcuts="pickerOptions.shortcuts"
:value-format="pickerOptions.valueFormat"
>
</el-date-picker>
</n-form-item>
<n-form-item>
<div>
<n-button @click="showModal = true"> 文本内容预览</n-button>
</div>
</n-form-item>
<!-- <n-form-item>
<div>
<el-button type="primary" @click="thisClick"> {{''}}</el-button>
</div>
</n-form-item> -->
</n-form>
<n-button
attr-type="button"
@ -354,12 +427,19 @@ const showModal = ref(false);
</div>
<n-modal v-model:show="showModal">
<div class="flex w80% p30px bg-#fff my40px rounded-30px">
<div
class="overflow-y-auto h800px container"
v-html="editorContent"
></div>
<div class="overflow-y-auto h800px container" v-html="editorContent"></div>
</div>
</n-modal>
<n-modal v-model:show="showModal1">
<!-- <n-card style="width:1100px; height: 800px;" title="调达中心" :bordered="false" size="huge" role="dialog"
aria-modal="true"> -->
<UserPage
:userDataList="setUserList"
@clickChild="handleChild1"
@CloseThis="CloseThis"
></UserPage>
<!-- </n-card> -->
</n-modal>
</template>
<style scoped lang="less">

View File

@ -4,6 +4,7 @@ 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 { noticeld } from '@/stores/modules/noticeId'
import type { FormInst } from 'naive-ui'
import { useMessage } from 'naive-ui'
import { ref } from 'vue'
@ -25,6 +26,19 @@ import { useUserStore } from '@/stores/modules/user'
const store = useUserStore()
const { day, week } = useDate()
const { push } = useRouter()
const not = noticeld()
const toDetail2 = (id: any) => {
not.article.cate = id
console.log(not.article.cate)
// push(`${route.path.replace('/external','')}/info/${n.id}`)
push('/external/Board')
}
const userCode = ref(false)
userCode.value = ['admin', 'waibuyemianguanliyuan', 'tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
</script>
<template>
@ -38,9 +52,34 @@ const { push } = useRouter()
<div class="text-36px">外部情报</div>
<div class="text-18px ml40px mr25px">{{ day }}</div>
<div class="text-18px flex-1">{{ week }}</div>
<el-dropdown>
<div class="text-#fff" style="margin-right: 8px" v-if="userCode">
<div class="add text-18px px13px py11px cursor-pointer">外部审批流程</div>
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="push({ path: '/external/Process' })">News</el-dropdown-item>
<el-dropdown-item @click="push({ path: '/external/Process', query: { cate: '8' } })"
>重要通知</el-dropdown-item
>
</el-dropdown-menu>
</template>
</el-dropdown>
<el-dropdown>
<div class="text-#fff" style="margin-right: 28px" v-if="userCode">
<div class="add text-18px px13px py11px cursor-pointer">外部新增 +</div>
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="toDetail2(7)">News</el-dropdown-item>
<el-dropdown-item @click="toDetail2(8)"></el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<div
style="margin-right: 8px"
v-if="store.user.isPublish === 1 || store.user.roleCode === 'zhuxi'"
v-if="store.user.isPublish === 1 || store.user.roleCode?.includes('zhuxi')"
>
<div
class="add text-18px px13px py11px cursor-pointer"
@ -51,7 +90,7 @@ const { push } = useRouter()
</div>
<div
style="margin-right: 8px"
v-if="store.user.isPublish === 1 || store.user.roleCode === 'zhuxi'"
v-if="store.user.isPublish === 1 || store.user.roleCode?.includes('zhuxi')"
>
<div
class="add text-18px px13px py11px cursor-pointer"

View File

@ -4,11 +4,7 @@ import { useUserStore } from '@/stores/modules/user'
import HomeHead from '@/views/home/components/HomeHead.vue'
import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import { useDate } from '@/views/home/hooks/useDate'
import {
getNoticeList,
deleteWithdraw,
getManagerList
} from '@/api/daikin/base'
import { getNoticeList, deleteWithdraw, getManagerList } from '@/api/daikin/base'
import { noticeld } from '@/stores/modules/noticeId'
import { getImg } from '../images'
import { NTag } from 'naive-ui'
@ -21,236 +17,234 @@ const route = useRoute()
// console.log(route,route.path)
// push(`/Home/Process/ProcessInfo`)
const cateList = [
{ cate: 1, name: '外部环境', color: '#33C2B2' },
{ cate: 2, name: '竞争对手', color: '#F57E6C' },
{ cate: 3, name: '供方动向 ', color: '#547EE9' },
{ cate: 4, name: '大金集团', color: '#5ECBFA' },
{ cate: 5, name: '中国据点', color: '#E5A742' },
{ cate: 6, name: '调达本部', color: '#946DE1' },
{ cate: 7, name: 'news', color: '#63BF90' },
{ cate: 8, name: '重要通知', color: '#E36461' },
{ cate: 9, name: '留言板', color: '#F5BC00' }
{ cate: 1, name: '外部环境', color: '#33C2B2' },
{ cate: 2, name: '竞争对手', color: '#F57E6C' },
{ cate: 3, name: '供方动向 ', color: '#547EE9' },
{ cate: 4, name: '大金集团', color: '#5ECBFA' },
{ cate: 5, name: '中国据点', color: '#E5A742' },
{ cate: 6, name: '调达本部', color: '#946DE1' },
{ cate: 7, name: 'news', color: '#63BF90' },
{ cate: 8, name: '重要通知', color: '#E36461' },
{ cate: 9, name: '留言板', color: '#F5BC00' }
]
const listData = ref<any>({})
const Status = reactive({
reviewStatus: 1,
reviewSource: 2
reviewStatus: 1,
reviewSource: 2
})
const pageInfo = reactive({
pageNum: 1,
pageSize: 13,
total: 10
pageNum: 1,
pageSize: 13,
total: 10
})
const handleSizeChange = (e) => {
console.log(e)
console.log(e)
}
const handleCurrentChange = (e) => {
console.log(e)
console.log(e)
}
async function getPageList() {
const { reviewStatus, reviewSource } = Status
// -&
if (reviewStatus == 4) {
console.log('一级:', reviewSource, '二级:', reviewStatus)
const { pageNum, pageSize } = pageInfo
const { rows } = await getManagerList({
pageNum,
pageSize,
reviewStatus: '5'
})
console.log(rows, 7777777777)
listData.value = []
listData.value = rows
} else {
const { data } = await getNoticeList({ reviewStatus, reviewSource })
listData.value = []
listData.value = data
}
if (listData.value && reviewStatus === 3) {
flg.value = true
} else {
flg.value = false
}
const { reviewStatus, reviewSource } = Status
// -&
if (reviewStatus == 4) {
console.log('一级:', reviewSource, '二级:', reviewStatus)
const { pageNum, pageSize } = pageInfo
const { rows } = await getManagerList({
pageNum,
pageSize,
reviewStatus: '5'
})
console.log(rows, 7777777777)
listData.value = []
listData.value = rows
} else {
const { data } = await getNoticeList({ reviewStatus, reviewSource })
listData.value = []
listData.value = data
}
if (listData.value && reviewStatus === 3) {
flg.value = true
} else {
flg.value = false
}
}
//
const clickTo = (data: any) => {
let flag = false
const { id, noticeId, reviewStatus } = data
if (reviewStatus == 4) {
flag = true
}
console.log(data)
store.article.noticeld = noticeId
if (
[1, 2].includes(reviewStatus) &&
['review_person', 'zhuxi', 'tech_service'].includes(store2.user.roleCode)
) {
push(`/Home/Process/ProcessInfo/${id}`)
} else {
push(`/Home/Process/Detail/${id}/${flag}`) //
}
// console.log(store.article.noticeld)
let flag = false
const { id, noticeId, reviewStatus } = data
if (reviewStatus == 4) {
flag = true
}
console.log(data)
store.article.noticeld = noticeId
if (
[1, 2].includes(reviewStatus) &&
['review_person', 'zhuxi', 'tech_service'].some((item) => store2.user.roleCode?.includes(item))
) {
push(`/Home/Process/ProcessInfo/${id}`)
} else {
push(`/Home/Process/Detail/${id}/${flag}`) //
}
// console.log(store.article.noticeld)
}
//
const clickCancel = (data: any) => {
const { id, noticeId, reviewStatus } = data
deleteWithdraw(id).then((res) => {
console.log(res, '删除结果')
getPageList()
})
const { id, noticeId, reviewStatus } = data
deleteWithdraw(id).then((res) => {
console.log(res, '删除结果')
getPageList()
})
}
const activeName = ref('0')
const activeNames = ref('2')
const flg = ref(false)
const handleClicks = (tab: any) => {
// 2 3
Status.reviewSource = tab.paneName
// 2 3
Status.reviewSource = tab.paneName
}
//
const handleClick = (tab: TabsPaneContext, event: Event) => {
switch (tab.index) {
case '0':
//
Status.reviewStatus = 1
break
case '1':
//
Status.reviewStatus = 3
break
case '2':
//
Status.reviewStatus = 4
break
default:
//
Status.reviewStatus = 1
break
}
console.log(tab.index)
switch (tab.index) {
case '0':
//
Status.reviewStatus = 1
break
case '1':
//
Status.reviewStatus = 3
break
case '2':
//
Status.reviewStatus = 4
break
default:
//
Status.reviewStatus = 1
break
}
console.log(tab.index)
}
const showDetail = (row: any) => {
console.log(row, '单选一行')
// sessionStorage.setItem("title", row.title);
// console.log(row.content);
// sessionStorage.setItem("content", row.content);
// push({ name: "bcpDetail" });
console.log(row, '单选一行')
// sessionStorage.setItem("title", row.title);
// console.log(row.content);
// sessionStorage.setItem("content", row.content);
// push({ name: "bcpDetail" });
}
// Tab []
const ss = computed(() => [Status.reviewStatus, Status.reviewSource])
watch(
() => unref(ss),
async (v) => {
getPageList()
},
{ immediate: true, deep: true }
() => unref(ss),
async (v) => {
getPageList()
},
{ immediate: true, deep: true }
)
const tabsList = ref([
{
name: '审核中',
icon: getImg('shq2@2x.png'),
icons: getImg('shq1@2x.png'),
id: 0
},
{
name: '审核通过',
icon: getImg('shetg2@2x.png'),
icons: getImg('shetg1@2x.png'),
id: 1
},
{
name: '驳回/撤回',
icon: getImg('boh2@2x.png'),
icons: getImg('boh1@2x.png'),
id: 2
}
// {
// name:'稿',
// icon:getImg('caog2@2x.png'),
// icons:getImg('caog1@2x.png'),
// id:3,
// },
{
name: '审核中',
icon: getImg('shq2@2x.png'),
icons: getImg('shq1@2x.png'),
id: 0
},
{
name: '审核通过',
icon: getImg('shetg2@2x.png'),
icons: getImg('shetg1@2x.png'),
id: 1
},
{
name: '驳回/撤回',
icon: getImg('boh2@2x.png'),
icons: getImg('boh1@2x.png'),
id: 2
}
// {
// name:'稿',
// icon:getImg('caog2@2x.png'),
// icons:getImg('caog1@2x.png'),
// id:3,
// },
])
// tab
const tabsList2 = ref([
{
name: '待审核',
icon: getImg('shhz2@2x.png'),
icons: getImg('shhz1@2x.png'),
id: 0
},
{
name: '已发布',
icon: getImg('wanc2@2x.png'),
icons: getImg('wanc1@2x.png'),
id: 1
},
{
name: '驳回/撤回',
icon: getImg('boh2@2x.png'),
icons: getImg('boh1@2x.png'),
id: 2
}
// {
// name:'',
// icon:getImg('guid2@2x.png'),
// icons:getImg('guid1@2x.png'),
// id:3,
// },
{
name: '待审核',
icon: getImg('shhz2@2x.png'),
icons: getImg('shhz1@2x.png'),
id: 0
},
{
name: '已发布',
icon: getImg('wanc2@2x.png'),
icons: getImg('wanc1@2x.png'),
id: 1
},
{
name: '驳回/撤回',
icon: getImg('boh2@2x.png'),
icons: getImg('boh1@2x.png'),
id: 2
}
// {
// name:'',
// icon:getImg('guid2@2x.png'),
// icons:getImg('guid1@2x.png'),
// id:3,
// },
])
let tabs = store2.user.isReview > 0 ? tabsList2.value : tabsList.value
</script>
<template>
<HomeHead class="top"> </HomeHead>
<div class="h-full relative flex flex-col">
<div class="font-600 flex items-end mt30px">
<div class="text-36px">情报列表</div>
<div class="text-18px ml40px mr25px">{{ day }}</div>
<div class="text-18px">{{ week }}</div>
</div>
<div
class="q-wrapper flex-1 mt30px text-#142142 flex flex-col bg-#fff p30px"
>
<div>
<el-tabs type="card" v-model="activeNames" @tab-click="handleClicks">
<el-tab-pane name="2">
<template #label>
<span class="custom-tabs-label text-25px">内部情报</span>
</template>
</el-tab-pane>
<el-tab-pane
name="3"
v-if="
['review_person', 'zhuxi', 'tech_service'].includes(
store2.user.roleCode
)
"
>
<template #label>
<span class="custom-tabs-label text-25px">外部情报</span>
</template>
</el-tab-pane>
</el-tabs>
</div>
<div>
<!-- tab标题页 -->
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane v-for="item in tabs" :key="item">
<template #label>
<span class="custom-tabs-label">
<img
:src="activeName == item.id ? item.icon : item.icons"
class="w25px h25px mr-5px mt--5px"
/>
<span class="text-20px">{{ item.name }}</span>
</span>
</template>
</el-tab-pane>
</el-tabs>
</div>
<HomeHead class="top"> </HomeHead>
<div class="h-full relative flex flex-col">
<div class="font-600 flex items-end mt30px">
<div class="text-36px">情报列表</div>
<div class="text-18px ml40px mr25px">{{ day }}</div>
<div class="text-18px">{{ week }}</div>
</div>
<div class="q-wrapper flex-1 mt30px text-#142142 flex flex-col bg-#fff p30px">
<div>
<el-tabs type="card" v-model="activeNames" @tab-click="handleClicks">
<el-tab-pane name="2">
<template #label>
<span class="custom-tabs-label text-25px">内部情报</span>
</template>
</el-tab-pane>
<el-tab-pane
name="3"
v-if="
['review_person', 'zhuxi', 'tech_service'].some((item) =>
store2.user.roleCode?.includes(item)
)
"
>
<template #label>
<span class="custom-tabs-label text-25px">外部情报</span>
</template>
</el-tab-pane>
</el-tabs>
</div>
<div>
<!-- tab标题页 -->
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane v-for="item in tabs" :key="item">
<template #label>
<span class="custom-tabs-label">
<img
:src="activeName == item.id ? item.icon : item.icons"
class="w25px h25px mr-5px mt--5px"
/>
<span class="text-20px">{{ item.name }}</span>
</span>
</template>
</el-tab-pane>
</el-tabs>
</div>
<!-- 驳回分页 -->
<!-- <div
<!-- 驳回分页 -->
<!-- <div
class="bg-#fff rd-15px px30px pt30px w-full h100%"
>
<div
@ -307,103 +301,95 @@ let tabs = store2.user.isReview > 0 ? tabsList2.value : tabsList.value
</div>
</div>
</div> -->
<!-- 没分页 -->
<div
v-for="i in listData"
:key="i"
class="mt8px cursor-pointer flex items-center p15px pl20px text-18px"
>
<span v-for="s in cateList" :key="s">
<span
v-if="s.cate === i.cate"
class="shrink-0 w80px inline-flex px8px py5px lh-1.5em text-14px rd-6px text-#fff/80 vertical-middle items-center justify-center bg-gray mr10px"
:style="{ backgroundColor: s.color }"
>
{{ s.name }}
</span>
</span>
<NTag
type="info"
v-if="i.reviewStatus == 5 && Status.reviewSource === 2"
class="shrink-0 w80px inline-flex px8px py5px lh-1.5em text-14px rd-6px text-#fff/80 vertical-middle items-center justify-center bg-#547EE9 mr10px"
>
个人撤回
</NTag>
<NTag
type="info"
v-else-if="i.reviewStatus == 4 && Status.reviewSource === 2"
class="shrink-0 w80px inline-flex px8px py5px lh-1.5em text-14px rd-6px text-#fff/80 vertical-middle items-center justify-center bg-#002FA7 mr10px"
>
领导驳回
</NTag>
<el-dropdown>
<span
class="truncate flex-1 text-#142142 hover:underline w400px max-w400px"
:title="i.title"
@click="clickTo(i)"
>
{{ i.title }}
</span>
<template #dropdown v-if="flg && i.firstReviewName">
<el-dropdown-menu>
<el-dropdown-item v-if="i.firstReviewName">
<div class="ml20px text-#808696 !text-12px flex">
<span class="min-w120px"
>初审人{{ i.firstReviewName }}</span
>
<span class="ml20px">初审时间{{ i.firstReviewTime }}</span>
</div>
</el-dropdown-item>
<el-dropdown-item v-if="i.ultimateReviewName">
<div class="ml20px text-#808696 !text-12px flex">
<span class="min-w120px"
>终审人{{ i.ultimateReviewName }}</span
>
<span class="ml20px"
>终审时间{{ i.ultimateReviewTime }}</span
>
</div>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<span class="shrink-0 ml38px text-#808696 w220px">{{
i.createTime
}}</span>
<span
v-if="store2.user.isReview > 0 && i.publishName"
class="ml20px text-#808696 text-16px flex-1"
>来自: {{ i.publishName }}</span
>
<span
v-if="
['publish', 'tech_service'].includes(store2.user.roleCode) &&
Status.reviewStatus === 1
"
class="absolute right-10px top-18px"
>
<el-button @click="clickCancel(i)"></el-button>
</span>
</div>
</div>
</div>
<!-- 没分页 -->
<div
v-for="i in listData"
:key="i"
class="mt8px cursor-pointer flex items-center p15px pl20px text-18px"
>
<span v-for="s in cateList" :key="s">
<span
v-if="s.cate === i.cate"
class="shrink-0 w80px inline-flex px8px py5px lh-1.5em text-14px rd-6px text-#fff/80 vertical-middle items-center justify-center bg-gray mr10px"
:style="{ backgroundColor: s.color }"
>
{{ s.name }}
</span>
</span>
<NTag
type="info"
v-if="i.reviewStatus == 5 && Status.reviewSource === 2"
class="shrink-0 w80px inline-flex px8px py5px lh-1.5em text-14px rd-6px text-#fff/80 vertical-middle items-center justify-center bg-#547EE9 mr10px"
>
个人撤回
</NTag>
<NTag
type="info"
v-else-if="i.reviewStatus == 4 && Status.reviewSource === 2"
class="shrink-0 w80px inline-flex px8px py5px lh-1.5em text-14px rd-6px text-#fff/80 vertical-middle items-center justify-center bg-#002FA7 mr10px"
>
领导驳回
</NTag>
<el-dropdown>
<span
class="truncate flex-1 text-#142142 hover:underline w400px max-w400px"
:title="i.title"
@click="clickTo(i)"
>
{{ i.title }}
</span>
<template #dropdown v-if="flg && i.firstReviewName">
<el-dropdown-menu>
<el-dropdown-item v-if="i.firstReviewName">
<div class="ml20px text-#808696 !text-12px flex">
<span class="min-w120px">初审人{{ i.firstReviewName }}</span>
<span class="ml20px">初审时间{{ i.firstReviewTime }}</span>
</div>
</el-dropdown-item>
<el-dropdown-item v-if="i.ultimateReviewName">
<div class="ml20px text-#808696 !text-12px flex">
<span class="min-w120px">终审人{{ i.ultimateReviewName }}</span>
<span class="ml20px">终审时间{{ i.ultimateReviewTime }}</span>
</div>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<span class="shrink-0 ml38px text-#808696 w220px">{{ i.createTime }}</span>
<span
v-if="store2.user.isReview > 0 && i.publishName"
class="ml20px text-#808696 text-16px flex-1"
>来自: {{ i.publishName }}</span
>
<span
v-if="
['publish', 'tech_service'].some((item) => store2.user.roleCode?.includes(item)) &&
Status.reviewStatus === 1
"
class="absolute right-10px top-18px"
>
<el-button @click="clickCancel(i)"></el-button>
</span>
</div>
</div>
</div>
</template>
<style scoped lang="less">
.top {
position: absolute;
right: 30px;
top: -92px;
position: absolute;
right: 30px;
top: -92px;
}
::-webkit-scrollbar {
width: 1px;
width: 1px;
}
.q-wrapper {
border-radius: 18px;
border: 1px solid #e7ebf5;
box-shadow: inset 1px 2px 12px rgba(14, 86, 221, 0.32);
overflow: auto;
border-radius: 18px;
border: 1px solid #e7ebf5;
box-shadow: inset 1px 2px 12px rgba(14, 86, 221, 0.32);
overflow: auto;
}
</style>

View File

@ -6,6 +6,7 @@ import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import UserPage from './UserPages.vue'
import { useDate } from '@/views/home/hooks/useDate'
import { getArticleDetail, review } from '@/api/daikin/base'
import { pickerOptions } from '@/utils/date'
import {
NModal,
NCard,
@ -59,6 +60,8 @@ let formValue: any = ref({
source: '',
content: '',
isTop: 'N',
isPublish: 0,
publishTime: '',
bannerImg: ''
})
@ -422,6 +425,37 @@ const showModalRefs = ref(false)
{{ i.nickName }}
</el-tag>
</div>
<!-- <n-form-item label="是否置顶">
<el-switch
v-model="formValue.isTop"
active-text="置顶"
inactive-text="不置顶"
:inactive-value="0"
:active-value="1"
></el-switch>
</n-form-item> -->
<n-form-item label="是否定时发送">
<el-switch
v-model="formValue.isPublish"
active-text="是"
inactive-text="否"
:inactive-value="0"
:active-value="1"
@change="(val) => (formValue.publishTime = val ? pickerOptions.day : '')"
></el-switch>
</n-form-item>
<n-form-item label="发布时间" v-if="formValue.isPublish == 1">
<el-date-picker
v-model="formValue.publishTime"
align="right"
type="date"
placeholder="选择日期"
:disabledDate="pickerOptions.disabledDate"
:shortcuts="pickerOptions.shortcuts"
:value-format="pickerOptions.valueFormat"
>
</el-date-picker>
</n-form-item>
<div class="text-end float-right block h50px pt10px">
<n-form-item>
<n-button attr-type="button" style="padding: 0 20px" @click="submitSave(2)">

View File

@ -17,7 +17,6 @@ async function getTree() {
if (data && data != 'null' && data.length > 0) {
treeData.value = data
}
console.log(data)
}
const props = defineProps({
@ -67,11 +66,13 @@ async function getUserPage() {
}, 150)
}
function selection(list = props.userDataList) {
function selection(list = uniqBy(props.userDataList, 'userId')) {
console.log('🚀 ~ file: UserPages.vue:79 ~ list:', toRaw(list))
if (userData.value && list) {
const commonItems = userData.value.filter((item1: { userId: any }) =>
list.some((item2) => item2.userId === item1.userId)
)
toggleSelection(commonItems)
}
}
@ -108,7 +109,7 @@ const multipleSelection = ref<[]>([])
const multipleSelectionObj: any = {}
const handleSelectionChange = (val) => {
console.log(val)
// console.log(val, 'val-')
multipleSelectionObj[da.deptId] = val
multipleSelection.value = uniqBy(Object.values(multipleSelectionObj).flat(), 'userId')
}
@ -210,7 +211,7 @@ const addGroupList = () => {
showModal2.value = true
}
const deleteGroupp = (i: any) => {
console.log(i)
// console.log(i)
deleteGroups(i.id)
}
async function deleteGroups(id) {

View File

@ -0,0 +1,556 @@
<!-- 市况 -->
<script setup lang="ts">
import { Chart1, Chart3, Chart4, Chart5, Chart6 } from './MarketData-bak'
import HomeHead from '@/views/home/components/HomeHead.vue'
import AppBlock from '@/components/AppBlock.vue'
import AppNewsBox from '@/components/AppNewsBox.vue'
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import { useDate } from '@/views/home/hooks/useDate'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import { getList ,marketPreADD,getMarketUser,saveMarketUser,MarketDownload,MarketPreview,getCurrencyList,getMetalList} from '@/api/daikin/base'
import { NModal,NCard } from 'naive-ui'
import {formatDate} from '@/utils/format'
import { message } from '@/utils/message'
import { useUserStore } from '@/stores/modules/user'
import UserList from '@/views/home/intelligence/process/UserPages.vue'
import Amtion from '@/components/amtion.vue'
import {noticeld} from '@/stores/modules/noticeId'
const store = useUserStore()
const stores = noticeld()
const userCode = ['admin','shikuang_dandang','tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
const userCodes = ['admin','huilv_dandang','tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
const { day, week } = useDate()
const { push } = useRouter()
const currentDate = new Date();
const currentDates = new Date();
const value1 = ref<[Date, Date]>([
currentDate.setMonth(currentDate.getMonth() - 11),
new Date()
])
const value2 = ref<[Date, Date]>([
currentDates.setMonth(currentDates.getMonth() - 11),
new Date()
])
const { chartRef: chartRef1, option: chartOption1,state } = Chart1()
const { chartRef: chartRef3, option: chartOption3 ,state2} = Chart3()
const { chartRef: chartRef4, option: chartOption4 ,state3} = Chart4()
const { chartRef: chartRef5, option: chartOption5,state4 } = Chart5()
const { chartRef: chartRef6, option: chartOption6 ,state5} = Chart6()
const listData = ref()
const listDatas = ref()
async function getData() {
const {data} = await getList({type:2})
const {data:ds} = await getList({type:1})
listData.value = data
listDatas.value = ds
}
const metal = ref()
const currency = ref()
onMounted(async ()=>{
getData()
const {data} =await getCurrencyList()
const {data:dat} =await getMetalList()
if(dat&&dat!='null'&&dat.length>0){
metal.value = dat
// .filter((item:any) => {
// if(["Fe","lengmei"].includes(item.value)){
// return false
// }else return item
// })
from.value.label.radio = dat[0].value
state4.number = dat[0].value
console.log("🚀 ~ file: Market.vue:56 ~ metal:", metal)
}
if(data&&data!='null'&&data.length>0){
currency.value = data
from.value.labe2.radio = data[0].value
const dat = data[0].value.split(',')
state5.currencyCodeFrom =dat[0]
state5.currencyCodeTo =dat[1]
state2.currencyCodeFrom =dat[0]
state2.currencyCodeTo =dat[1]
state3.currencyCodeFrom =dat[0]
state3.currencyCodeTo =dat[1]
}
})
const src = ref('');
const srcType = ref()
const showModalRef2 =ref(false)
const lokeFuck = async (n)=>{
const {id} =n
if(!id) return
let {data:{url}} = await MarketPreview({id})
if(!url) {
message.info("没有可预览文件!")
return
}
srcType.value = getLastSubstring(url)
if(['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'].includes(srcType.value)){
// src.value = filePath
// pdfShow.value = true
url='https://view.xdocin.com/view?src='+url
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
window.open(url, '', 'width=' + screenWidth + ',height=' + screenHeight + ',top=' + 0 + ',left=' + 0)
}
else{
message.error("文件格式不是 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'")
}
}
function getLastSubstring(str: string): string {
const lastIndex = str.lastIndexOf('.');
if (lastIndex !== -1) {
return str.substring(lastIndex + 1);
} else {
return '';
}
}
async function downloadFile(data: { id: any; title: string }) {
console.log(data)
if(!data.id) return
try {
const response = await MarketDownload({ id: data.id })
console.log(response)
var blob = new Blob([response.data]);
const downloadUrl = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = downloadUrl;
link.download = response.fileName; //
link.click();
URL.revokeObjectURL(downloadUrl);
} catch (error) {
message.error(error);
}
}
const tab = ref(false)
const tab1 = ref(false)
const tab2 = ref(false)
const names =ref('Cu')
const names1 =ref('100USD-CNY')
const names2 =ref('100USD-CNY')
const tabClick1 = (e)=>{
console.log(e.target.getAttribute('data-id'))
tab1.value=false
const dat =e.target.getAttribute('data-id').split(',')
names1.value =e.target.innerText
state2.currencyCodeFrom =dat[0]
state2.currencyCodeTo =dat[1]
}
const tabClick2 = (e)=>{
console.log(e.target.getAttribute('data-id'))
tab2.value=false
const dat =e.target.getAttribute('data-id').split(',')
names2.value =e.target.innerText
state3.currencyCodeFrom =dat[0]
state3.currencyCodeTo =dat[1]
}
const tabClick= (e)=>{
console.log(e.target)
tab.value=false
state.type =e.target.getAttribute('data-id')
names.value =e.target.innerText
}
const tabShow = (num)=>{
// console.log(num)
switch (num) {
case 0:
tab.value = tab.value === false?true:false
break;
case 1:
tab1.value = tab1.value === false?true:false
break;
case 2:
tab2.value = tab2.value === false?true:false
break;
}
}
const from = ref({
label:{
radio:''
},
labe2:{
radio:''
}
})
const shomk = ref(false)
const sdubList = ref({
title:'',
fileList:[],
})
const shomks=(it)=>{
sdubList.value.type = it
// console.log(sdubList.value)
shomk.value =true
}
async function onSubmit(){
const {type,title ,fileList} = sdubList.value
let filePath
if(fileList.length>0){
// console.log(fileList)
filePath = fileList[0].response.url
}
const {msg,code} = await marketPreADD({type,title,filePath})
if (code === 200) { message.success("修改成功") }
else message.warning(msg)
window.location.reload();
// console.log(sdubList.value)
}
const handleExceed: UploadProps['onExceed'] = (uploadFile: any, uploadFiles: any) => {
message.warning("当前只支持上传一个文件")
}
const thisCka = (e)=>{
if(value1.value){
state4.startTime = formatDate(value1.value[0]).substring(0,10)
state4.endTime = formatDate(value1.value[1]).substring(0,10)
}
state4.number =e
console.log(e)
}
const thisCka2 = (e)=>{
const dat = e.split(',')
if(value2.value){
state5.startTime = formatDate(value2.value[0]).substring(0,10)
state5.endTime = formatDate(value2.value[1]).substring(0,10)
}
state5.currencyCodeFrom =dat[0]
state5.currencyCodeTo =dat[1]
}
const timenFirst=(e)=>{
// console.log(e)
state4.startTime = formatDate(value1.value[0]).substring(0,10)
state4.endTime = formatDate(value1.value[1]).substring(0,10)
}
const timenFirsts=(e)=>{
// console.log(e)
state5.startTime = formatDate(value2.value[0]).substring(0,10)
state5.endTime = formatDate(value2.value[1]).substring(0,10)
}
const header = { 'token': store.user.token }
const showModal = ref(false)
const flg = ref()
const setUserList =ref()
async function getUser(moduleId: any) {
showModal.value = !showModal.value
flg.value = moduleId
const {data: userArr} = await getMarketUser({moduleId})
stores.article.reviewSource = '2'
setUserList.value = userArr
}
//
const handleChild = (data: any) => {
console.log(data, 444);
const { showModal: show, multipleSelection } = data
showModal.value = unref(show)
// userList.value = multipleSelection
let userIdList: any[] =[]
multipleSelection.value.forEach((i: { userId: any })=>{
// console.log(dataList.value)
userIdList.push(i.userId)
})
saveMarketUser({
moduleId: flg.value,
userIdList: userIdList
})
}
const CloseThiss = (data: boolean)=>{
showModal.value = data
}
</script>
<template>
<HomeHead class="top">
<template #content>
<!-- <HomeHeadSearch /> -->
</template>
</HomeHead>
<div class="h-full relative flex flex-col overflow-y-auto scrollbar-width-1px">
<div class="pl12px mt30px flex w-full h-full gap-30px">
<!-- <img src="./images/shukuang.png" alt="" class="w-full h-full"> -->
<AppBlock class="flex-1 box">
<div class="box-title">市况</div>
<el-button type="primary" v-if="userCode" class="button !mr-30px !mt-[-30px] z-100" @click="push({name:'MarketDataModify'})"></el-button>
<div class="bgStyle mt30px">
<div class="mr25px relative w100%">
<span @click="tabShow(0)" class="title bg-#FF603A p5px pl10px pr20px">{{names}}<el-icon><CaretBottom /></el-icon></span>
<div v-if="tab" class="tab absolute bg-#fff w100px top-50px z-50 text-#112144 text-center leading-28px text-18px ">
<div v-if="metal" v-for="im in metal.filter((item:any) => !['Fe','lengmei'].includes(item.value))" class="py5px !rounded-none" :data-id="im.value" @click="tabClick" >{{im.title}}</div>
<!-- <div class="py5px !rounded-none" data-id="Fe" @click="tabClick">Fe</div>
<div class="py5px !rounded-none" data-id="Cu" @click="tabClick">Cu</div>
<div class="py5px !rounded-none" data-id="Re" @click="tabClick"></div> -->
</div>
<VChart class=" absolute z-22" ref="chartRef1" :option="chartOption1" autoresize />
</div>
<!-- <div>
<span class="title bg-#70BFCD p5px pl10px !pr25px">AI</span>
<VChart class="absolute z-22" ref="chartRef2" :option="chartOption2" autoresize />
</div> -->
</div>
<div class="bgStyle !h250px mt20px">
<div >
<span class="title bg-#003BB7 !text-16px pl13px pr20px ">历年数据</span>
<VChart class=" absolute z-22" ref="chartRef5" :option="chartOption5" autoresize />
</div>
</div>
<div class="mt20px ml10px">
<div>
<span class="text-#000">日期:</span>
<el-config-provider :locale="zhCn">
<el-date-picker v-model="value1" type="daterange" range-separator=""
start-placeholder="开始时间" end-placeholder="结束时间" size="small" @change="timenFirst"/></el-config-provider>
</div>
<div class="mt10px">
<el-radio-group v-model="from.label.radio" class="ml-4" @change="thisCka">
<el-radio v-if="metal" v-for="im in metal" :label="im.value" size="large" >{{im.title}}</el-radio>
<!-- <el-radio label="Al" size="large" >Al</el-radio>
<el-radio label="Fe" size="large" >Fe</el-radio>
<el-radio label="Re" size="large" >稀土</el-radio> -->
</el-radio-group>
</div>
</div>
<div class="bgStyle !h165px mt15px mb10px">
<div>
<span class="title bg-#003BB7 !text-16px pl13px pr20px b">市况预测</span>
<!-- <el-button type="primary" v-if="userCode" class="button" @click="getUser(1)"></el-button> -->
<el-button type="primary" v-if="userCode" class="button" @click="push({name:'MarketModifys'})"></el-button>
<p class="mt40px p15px !border-none max-h120px overflow-auto">
<p class="!border-none w615px !flex items-center pb10px news-item " v-for="n in listDatas" :key="n">
<AppNewsBox class="flex-1 !border-none" :text="n.title" :date="n.createTime" />
<p class="flex-shrink flex !border-none w35px ml20px">
<el-button type="primary" @click="lokeFuck(n)"></el-button>
<!-- <el-button type="primary" @click="downloadFile(n)"></el-button> -->
</p>
</p>
</p>
</div>
</div>
</AppBlock>
<AppBlock class="flex-1 box">
<div class="box-title ">汇率</div>
<div class="bgStyle mt30px">
<div class="mr25px">
<span @click="tabShow(1)" class="title bg-#FF603A !text-16px pl13px pr20px ">{{names1}}<el-icon><CaretBottom /></el-icon></span>
<div v-if="tab1" class="tab absolute bg-#fff w100px top-40px z-50 text-#112144 text-center leading-28px text-16px ">
<div v-if="currency" v-for="it in currency" class="py5px !rounded-none" :data-id="it.value" @click="tabClick1">{{it.title}}</div>
<!-- <div class="py5px !rounded-none" data-id="CNA,USD" @click="tabClick1">-</div>
<div class="py5px !rounded-none" data-id="JPY,USD" @click="tabClick1">-</div> -->
</div>
<VChart class=" absolute z-22" ref="chartRef3" :option="chartOption3" autoresize />
</div>
<div>
<span @click="tabShow(2)" class="title bg-#70BFCD !text-16px pl13px pr20px ">{{names2}}<el-icon><CaretBottom /></el-icon></span>
<div v-if="tab2" class="tab absolute bg-#fff w100px top-40px z-50 text-#112144 text-center leading-28px text-16px ">
<div v-if="currency" v-for="it in currency" class="py5px !rounded-none" :data-id="it.value" @click="tabClick2">{{it.title}}</div>
<!-- <div class="py5px !rounded-none" data-id="CNA,USD" @click="tabClick2">-</div>
<div class="py5px !rounded-none" data-id="JPY,USD" @click="tabClick2">-</div> -->
</div>
<VChart class="absolute z-22" ref="chartRef4" :option="chartOption4" autoresize />
</div>
</div>
<div class="bgStyle !h250px mt20px">
<div>
<span class="title bg-#003BB7 !text-16px pl13px pr20px ">历年数据</span>
<VChart class=" absolute z-22" ref="chartRef6" :option="chartOption6" autoresize />
</div>
</div>
<div class="mt20px ml10px">
<div>
<span class="text-#000">日期:</span>
<el-config-provider :locale="zhCn">
<el-date-picker v-model="value2" type="daterange" range-separator=""
start-placeholder="开始时间" end-placeholder="结束时间" size="small" @change="timenFirsts"/></el-config-provider>
</div>
<div class="mt10px">
<el-radio-group v-model="from.labe2.radio" class="ml-4" @change="thisCka2">
<el-radio v-if="currency" v-for="it in currency" :label="it.value" size="large" >{{it.title}}</el-radio>
<!-- <el-radio label="JPY,USD" size="large" >日元-美元</el-radio>
<el-radio label="CNA,USD" size="large" >人民币-美元</el-radio> -->
</el-radio-group>
</div>
</div>
<div class="bgStyle !h165px mt15px mb10px">
<div>
<span class="title bg-#003BB7 !text-16px pl13px pr20px ">汇率预测</span>
<!-- <el-button type="primary" v-if="userCode" class="button" @click="getUser(2)"></el-button> -->
<el-button type="primary" v-if="userCodes" class="button" @click="push({name:'MarketModify'})"></el-button>
<p class="mt40px p15px !border-none max-h120px overflow-auto">
<p class="!border-none w615px !flex items-center pb10px news-item " v-for="n in listData" :key="n">
<AppNewsBox class="flex-1 !border-none" :text="n.title" :date="n.createTime" />
<p class="flex-shrink flex !border-none w35px ml20px">
<el-button type="primary" @click="lokeFuck(n)"></el-button>
<!-- <el-button type="primary" @click="downloadFile(n)"></el-button> -->
</p>
</p>
</p>
</div>
</div>
</AppBlock>
</div>
</div>
<!-- <div style="width: 1200px; height:800px ; position: fixed; z-index: 100; top:50px;;">
</div> -->
<n-modal :mask-closable="true" v-model:show="showModalRef2">
<div class="w90% h90% ">
<Amtion :data="src" :datas="srcType"/>
</div>
</n-modal>
<n-modal v-model:show="shomk">
<div class="py40px px30px bg-#fff">
<el-form :model="sdubList" label-width="120px" :inline="true">
<el-form-item label="标题" >
<el-input v-model="sdubList.title"/>
</el-form-item>
<br>
<el-form-item label="文件">
<el-upload v-model:file-list="sdubList.fileList" class="upload-demo" :headers="header"
action="/test-api/common/upload" :on-change="handleChange">
<el-button type="primary">选择文件</el-button>
</el-upload>
</el-form-item>
<br>
<br>
<el-form-item class="ml80px">
<el-button type="primary" @click="onSubmit"></el-button>
</el-form-item>
</el-form>
</div>
</n-modal>
<n-modal v-model:show="showModal">
<UserList :userDataList="setUserList" @clickChild="handleChild" @CloseThis="CloseThiss"/>
</n-modal>
</template>
<style scoped lang="less">
.button{
display: block;
float: right;
margin-right:20px ;
}
::-webkit-scrollbar{
width: 1px;
}
.top {
position: absolute;
right: 30px;
top: -92px;
}
.date-wrapper[data-v-c5c4f420] {
line-height: 1.5;
position: relative;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: middle;
color: #142142;
border: none;
}
.tab{
div:hover{
color: #0036BC;
}
}
.box {
padding: 23px 20px 0 20px;
.box-title {
font-size: 28px;
font-weight: 600;
position: relative;
padding-left: 24px;
color: black;
&::before {
content: " ";
display: block;
width: 8px;
height: 30px;
background-color: #003ab5;
position: absolute;
left: 0;
}
}
}
.bgStyle {
display: flex;
width: 100%;
height: 270px;
position: relative;
padding: 0 5px;
div {
flex: 1;
border: 1px solid rgb(236, 236, 236);
border-radius: 18px;
.title {
// width: 60px;
// height: 60px;
border-radius: 18px 0 50px 0;
color: aliceblue;
line-height: 40px;
font-size: 24px;
font-weight: 500;
z-index: 50;
position: absolute;
}
}
}
</style>

View File

@ -7,18 +7,22 @@ import AppNewsBox from '@/components/AppNewsBox.vue'
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import { useDate } from '@/views/home/hooks/useDate'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import { getList ,marketPreADD,getMarketUser,saveMarketUser,MarketDownload,MarketPreview,getCurrencyList,getMetalList} from '@/api/daikin/base'
import { NModal,NCard } from 'naive-ui'
import {formatDate} from '@/utils/format'
import { getList, marketPreADD, getMarketUser, saveMarketUser, MarketDownload, MarketPreview, getCurrencyList, getMetalList, fetchExchangeInfo,fetchTimeFuturecenterCu,fetchTimeFuturecenterAl } from '@/api/daikin/base'
import { NModal, NCard } from 'naive-ui'
import { formatDate } from '@/utils/format'
import { message } from '@/utils/message'
import { useUserStore } from '@/stores/modules/user'
import UserList from '@/views/home/intelligence/process/UserPages.vue'
import Amtion from '@/components/amtion.vue'
import {noticeld} from '@/stores/modules/noticeId'
import { noticeld } from '@/stores/modules/noticeId'
const store = useUserStore()
const stores = noticeld()
const userCode = ['admin','shikuang_dandang','tech_service'].includes(store.user.roleCode)
const userCodes = ['admin','huilv_dandang','tech_service'].includes(store.user.roleCode)
const userCode = ['admin', 'shikuang_dandang', 'tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
const userCodes = ['admin', 'huilv_dandang', 'tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
const { day, week } = useDate()
const { push } = useRouter()
const currentDate = new Date();
@ -31,27 +35,29 @@ const value2 = ref<[Date, Date]>([
currentDates.setMonth(currentDates.getMonth() - 11),
new Date()
])
const { chartRef: chartRef1, option: chartOption1,state } = Chart1()
const { chartRef: chartRef3, option: chartOption3 ,state2} = Chart3()
const { chartRef: chartRef4, option: chartOption4 ,state3} = Chart4()
const { chartRef: chartRef5, option: chartOption5,state4 } = Chart5()
const { chartRef: chartRef6, option: chartOption6 ,state5} = Chart6()
const { chartRef: chartRef1, option: chartOption1, state } = Chart1()
const { option: chartOption11 } = Chart1()
const { chartRef: chartRef3, option: chartOption3, state2 } = Chart3()
const { chartRef: chartRef4, option: chartOption4, state3 } = Chart4()
const { chartRef: chartRef5, option: chartOption5, state4 } = Chart5()
const { chartRef: chartRef6, option: chartOption6, state5 } = Chart6()
const listData = ref()
const listDatas = ref()
async function getData() {
const {data} = await getList({type:2})
const {data:ds} = await getList({type:1})
const { data } = await getList({ type: 2 })
const { data: ds } = await getList({ type: 1 })
listData.value = data
listDatas.value = ds
}
const metal = ref()
const currency = ref()
onMounted(async ()=>{
onMounted(async () => {
getData()
const {data} =await getCurrencyList()
const {data:dat} =await getMetalList()
if(dat&&dat!='null'&&dat.length>0){
const { data } = await getCurrencyList()
console.log("🚀 ~ file: Market.vue:58 ~ data:", data)
const { data: dat } = await getMetalList()
if (dat && dat != 'null' && dat.length > 0) {
metal.value = dat
// .filter((item:any) => {
// if(["Fe","lengmei"].includes(item.value)){
@ -62,218 +68,233 @@ onMounted(async ()=>{
state4.number = dat[0].value
console.log("🚀 ~ file: Market.vue:56 ~ metal:", metal)
}
if(data&&data!='null'&&data.length>0){
if (data && data != 'null' && data.length > 0) {
currency.value = data
from.value.labe2.radio = data[0].value
const dat = data[0].value.split(',')
state5.currencyCodeFrom =dat[0]
state5.currencyCodeTo =dat[1]
state2.currencyCodeFrom =dat[0]
state2.currencyCodeTo =dat[1]
state3.currencyCodeFrom =dat[0]
state3.currencyCodeTo =dat[1]
const dat = data[0].value.split(',')
state5.currencyCodeFrom = dat[0]
state5.currencyCodeTo = dat[1]
state2.currencyCodeFrom = dat[0]
state2.currencyCodeTo = dat[1]
state3.currencyCodeFrom = dat[0]
state3.currencyCodeTo = dat[1]
}
})
const src = ref('');
const srcType = ref()
const showModalRef2 =ref(false)
const lokeFuck = async (n)=>{
const {id} =n
if(!id) return
let {data:{url}} = await MarketPreview({id})
if(!url) {
const showModalRef2 = ref(false)
const lokeFuck = async (n) => {
const { id } = n
if (!id) return
let { data: { url } } = await MarketPreview({ id })
if (!url) {
message.info("没有可预览文件!")
return
}
srcType.value = getLastSubstring(url)
if(['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'].includes(srcType.value)){
if (['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'pdf'].includes(srcType.value)) {
// src.value = filePath
// pdfShow.value = true
url='https://view.xdocin.com/view?src='+url
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
window.open(url, '', 'width=' + screenWidth + ',height=' + screenHeight + ',top=' + 0 + ',left=' + 0)
url = 'https://view.xdocin.com/view?src=' + url
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
window.open(url, '', 'width=' + screenWidth + ',height=' + screenHeight + ',top=' + 0 + ',left=' + 0)
}
else{
else {
message.error("文件格式不是 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'")
}
}
function getLastSubstring(str: string): string {
const lastIndex = str.lastIndexOf('.');
if (lastIndex !== -1) {
return str.substring(lastIndex + 1);
} else {
return '';
}
const lastIndex = str.lastIndexOf('.');
if (lastIndex !== -1) {
return str.substring(lastIndex + 1);
} else {
return '';
}
}
async function downloadFile(data: { id: any; title: string }) {
console.log(data)
if(!data.id) return
try {
if (!data.id) return
try {
const response = await MarketDownload({ id: data.id })
console.log(response)
var blob = new Blob([response.data]);
var blob = new Blob([response.data]);
const downloadUrl = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = downloadUrl;
link.download = response.fileName; //
link.click();
URL.revokeObjectURL(downloadUrl);
} catch (error) {
} catch (error) {
message.error(error);
}
}
}
const tab = ref(false)
const tab1 = ref(false)
const tab2 = ref(false)
const names =ref('Cu')
const names1 =ref('100USD-CNY')
const names2 =ref('100USD-CNY')
const tabClick1 = (e)=>{
console.log(e.target.getAttribute('data-id'))
tab1.value=false
const dat =e.target.getAttribute('data-id').split(',')
names1.value =e.target.innerText
state2.currencyCodeFrom =dat[0]
state2.currencyCodeTo =dat[1]
const names = ref('Cu')
const names1 = ref('100USD-CNY')
const names2 = ref('100USD-CNY')
const tabClick1 = (e) => {
console.log(e.target.getAttribute('data-id'))
tab1.value = false
const dat = e.target.getAttribute('data-id').split(',')
names1.value = e.target.innerText
state2.currencyCodeFrom = dat[0]
state2.currencyCodeTo = dat[1]
}
const tabClick2 = (e)=>{
console.log(e.target.getAttribute('data-id'))
tab2.value=false
const dat =e.target.getAttribute('data-id').split(',')
names2.value =e.target.innerText
state3.currencyCodeFrom =dat[0]
state3.currencyCodeTo =dat[1]
const tabClick2 = (e) => {
console.log(e.target.getAttribute('data-id'))
tab2.value = false
const dat = e.target.getAttribute('data-id').split(',')
names2.value = e.target.innerText
state3.currencyCodeFrom = dat[0]
state3.currencyCodeTo = dat[1]
}
const tabClick= (e)=>{
console.log(e.target)
tab.value=false
state.type =e.target.getAttribute('data-id')
names.value =e.target.innerText
const tabClick = (e) => {
console.log(e.target)
tab.value = false
state.type = e.target.getAttribute('data-id')
// names.value =e.target.innerText
}
const tabShow = (num)=>{
const tabShow = (num) => {
// console.log(num)
switch (num) {
case 0:
tab.value = tab.value === false?true:false
tab.value = tab.value === false ? true : false
break;
case 1:
tab1.value = tab1.value === false?true:false
case 1:
tab1.value = tab1.value === false ? true : false
break;
case 2:
tab2.value = tab2.value === false?true:false
case 2:
tab2.value = tab2.value === false ? true : false
break;
}
}
const from = ref({
label:{
radio:''
label: {
radio: ''
},
labe2:{
radio:''
labe2: {
radio: ''
}
})
const shomk = ref(false)
const sdubList = ref({
title:'',
fileList:[],
title: '',
fileList: [],
})
const shomks=(it)=>{
const shomks = (it) => {
sdubList.value.type = it
// console.log(sdubList.value)
shomk.value =true
shomk.value = true
}
async function onSubmit(){
const {type,title ,fileList} = sdubList.value
async function onSubmit() {
const { type, title, fileList } = sdubList.value
let filePath
if(fileList.length>0){
if (fileList.length > 0) {
// console.log(fileList)
filePath = fileList[0].response.url
}
const {msg,code} = await marketPreADD({type,title,filePath})
const { msg, code } = await marketPreADD({ type, title, filePath })
if (code === 200) { message.success("修改成功") }
else message.warning(msg)
window.location.reload();
// console.log(sdubList.value)
}
const handleExceed: UploadProps['onExceed'] = (uploadFile: any, uploadFiles: any) => {
message.warning("当前只支持上传一个文件")
message.warning("当前只支持上传一个文件")
}
const thisCka = (e)=>{
if(value1.value){
state4.startTime = formatDate(value1.value[0]).substring(0,10)
state4.endTime = formatDate(value1.value[1]).substring(0,10)
const thisCka = (e) => {
if (value1.value) {
state4.startTime = formatDate(value1.value[0]).substring(0, 10)
state4.endTime = formatDate(value1.value[1]).substring(0, 10)
}
state4.number =e
state4.number = e
console.log(e)
}
const thisCka2 = (e)=>{
const thisCka2 = (e) => {
const dat = e.split(',')
if(value2.value){
state5.startTime = formatDate(value2.value[0]).substring(0,10)
state5.endTime = formatDate(value2.value[1]).substring(0,10)
if (value2.value) {
state5.startTime = formatDate(value2.value[0]).substring(0, 10)
state5.endTime = formatDate(value2.value[1]).substring(0, 10)
}
state5.currencyCodeFrom =dat[0]
state5.currencyCodeTo =dat[1]
state5.currencyCodeFrom = dat[0]
state5.currencyCodeTo = dat[1]
}
const timenFirst=(e)=>{
const timenFirst = (e) => {
// console.log(e)
state4.startTime = formatDate(value1.value[0]).substring(0,10)
state4.endTime = formatDate(value1.value[1]).substring(0,10)
state4.startTime = formatDate(value1.value[0]).substring(0, 10)
state4.endTime = formatDate(value1.value[1]).substring(0, 10)
}
const timenFirsts=(e)=>{
const timenFirsts = (e) => {
// console.log(e)
state5.startTime = formatDate(value2.value[0]).substring(0,10)
state5.endTime = formatDate(value2.value[1]).substring(0,10)
state5.startTime = formatDate(value2.value[0]).substring(0, 10)
state5.endTime = formatDate(value2.value[1]).substring(0, 10)
}
const header = { 'token': store.user.token }
const showModal = ref(false)
const flg = ref()
const setUserList =ref()
const setUserList = ref()
async function getUser(moduleId: any) {
showModal.value = !showModal.value
flg.value = moduleId
const {data: userArr} = await getMarketUser({moduleId})
stores.article.reviewSource = '2'
setUserList.value = userArr
showModal.value = !showModal.value
flg.value = moduleId
const { data: userArr } = await getMarketUser({ moduleId })
stores.article.reviewSource = '2'
setUserList.value = userArr
}
//
const handleChild = (data: any) => {
//
const handleChild = (data: any) => {
console.log(data, 444);
const { showModal: show, multipleSelection } = data
showModal.value = unref(show)
// userList.value = multipleSelection
let userIdList: any[] =[]
multipleSelection.value.forEach((i: { userId: any })=>{
// console.log(dataList.value)
userIdList.push(i.userId)
})
saveMarketUser({
const { showModal: show, multipleSelection } = data
showModal.value = unref(show)
// userList.value = multipleSelection
let userIdList: any[] = []
multipleSelection.value.forEach((i: { userId: any }) => {
// console.log(dataList.value)
userIdList.push(i.userId)
})
saveMarketUser({
moduleId: flg.value,
userIdList: userIdList
})
}
const CloseThiss = (data: boolean)=>{
showModal.value = data
}
})
}
const CloseThiss = (data: boolean) => {
showModal.value = data
}
getHomeExInfo()
getTimeFuturecenter()
const homeExchangeInfo = ref<any>([])
async function getHomeExInfo() {
const { data } = await fetchExchangeInfo()
homeExchangeInfo.value = data
console.log('🚀 ~ file: Home.vue:252 ~ }):', data)
}
async function getTimeFuturecenter() {
const { data } = await fetchTimeFuturecenterCu()
console.log("🚀 ~ file: Market.vue:293 ~ data:", data)
}
</script>
<template>
@ -288,77 +309,126 @@ async function getUser(moduleId: any) {
<AppBlock class="flex-1 box">
<div class="box-title">市况</div>
<el-button type="primary" v-if="userCode" class="button !mr-30px !mt-[-30px] z-100" @click="push({name:'MarketDataModify'})"></el-button>
<div class="bgStyle mt30px">
<div class="mr25px relative w100%">
<span @click="tabShow(0)" class="title bg-#FF603A p5px pl10px pr20px">{{names}}<el-icon><CaretBottom /></el-icon></span>
<el-button type="primary" v-if="userCode" class="button !mr-30px !mt-[-30px] z-100"
@click="push({ name: 'MarketDataModify' })">数据管理</el-button>
<div class="bgStyle !h250px mt20px">
<div class=" relative w100%">
<div v-if="tab" class="tab absolute bg-#fff w100px top-50px z-50 text-#112144 text-center leading-28px text-18px ">
<div v-if="metal" v-for="im in metal.filter((item:any) => !['Fe','lengmei'].includes(item.value))" class="py5px !rounded-none" :data-id="im.value" @click="tabClick" >{{im.title}}</div>
<span @click="tabShow(0)" class="title bg-#70BFCD pl18px pr24px">{{ names }}
<!-- <el-icon><CaretBottom /></el-icon> -->
</span>
<span class="absolute right-160px top-14px z-30 text-#000">最近7天数据</span>
<div v-if="false && tab"
class="tab absolute bg-#fff w100px top-50px z-50 text-#112144 text-center leading-28px text-18px ">
<div v-if="metal"
v-for="im in metal.filter((item: any) => !['Fe', 'lengmei'].includes(item.value))"
class="py5px !rounded-none" :data-id="im.value" @click="tabClick">{{ im.title }}</div>
<!-- <div class="py5px !rounded-none" data-id="Fe" @click="tabClick">Fe</div>
<div class="py5px !rounded-none" data-id="Cu" @click="tabClick">Cu</div>
<div class="py5px !rounded-none" data-id="Re" @click="tabClick"></div> -->
</div>
<VChart class=" absolute z-22" ref="chartRef1" :option="chartOption1" autoresize />
<VChart class="absolute z-22 left-0 right-0 !w-full" ref="chartRef1" :option="chartOption1"
autoresize />
</div>
<!-- <div>
<span class="title bg-#70BFCD p5px pl10px !pr25px">AI</span>
<VChart class="absolute z-22" ref="chartRef2" :option="chartOption2" autoresize />
</div> -->
</div>
<div class="bgStyle !h250px mt20px">
<div >
<div class="bgStyle !h250px mt10px">
<div class=" relative w100%">
<span class="title bg-#FF960F pl18px pr28px">{{ 'AI' }}
<!-- <el-icon><CaretBottom /></el-icon> -->
</span>
<span class="absolute right-160px top-14px z-30 text-#000">最近7天数据</span>
<VChart class="absolute z-22 left-0 right-0 !w-full" ref="chartRef1" :option="chartOption11"
autoresize />
</div>
<!-- <div>
<span class="title bg-#70BFCD p5px pl10px !pr25px">AI</span>
<VChart class="absolute z-22" ref="chartRef2" :option="chartOption2" autoresize />
</div> -->
</div>
<div class="bgStyle !h240px mt10px">
<div>
<span class="title bg-#003BB7 !text-16px pl13px pr20px ">历年数据</span>
<VChart class=" absolute z-22" ref="chartRef5" :option="chartOption5" autoresize />
</div>
</div>
<div class="mt20px ml10px">
<div>
<span class="text-#000">日期:</span>
<div class="mt8px ml10px">
<div class="flex items-center w-45%">
<span class="text-#000 whitespace-nowrap">日期:</span>
<el-config-provider :locale="zhCn">
<el-date-picker v-model="value1" type="daterange" range-separator=""
start-placeholder="开始时间" end-placeholder="结束时间" size="small" @change="timenFirst"/></el-config-provider>
<el-date-picker v-model="value1" type="daterange" range-separator=""
start-placeholder="开始时间" end-placeholder="结束时间" size="small"
@change="timenFirst" /></el-config-provider>
</div>
<div class="mt10px">
<div class="flex justify-between items-center">
<el-radio-group v-model="from.label.radio" class="ml-4" @change="thisCka">
<el-radio v-if="metal" v-for="im in metal" :label="im.value" size="large" >{{im.title}}</el-radio>
<el-radio v-if="metal" v-for="im in metal" :label="im.value"
size="large">{{ im.title }}</el-radio>
<!-- <el-radio label="Al" size="large" >Al</el-radio>
<el-radio label="Fe" size="large" >Fe</el-radio>
<el-radio label="Re" size="large" >稀土</el-radio> -->
</el-radio-group>
</div>
</div>
<div class="bgStyle !h165px mt15px mb10px">
<div>
<span class="title bg-#003BB7 !text-16px pl13px pr20px b">市况预测</span>
<!-- <el-button type="primary" v-if="userCode" class="button" @click="getUser(1)"></el-button> -->
<el-button type="primary" v-if="userCode" class="button" @click="push({name:'MarketModifys'})"></el-button>
<p class="mt40px p15px !border-none max-h120px overflow-auto">
<p class="!border-none w615px !flex items-center pb10px news-item " v-for="n in listDatas" :key="n">
<AppNewsBox class="flex-1 !border-none" :text="n.title" :date="n.createTime" />
<el-popover placement="top-end" trigger="click" :popper-style="{ width: '590px',borderRadius:'10px' }"
:teleported="true">
<template #reference>
<div
class="bg-gr h-42px w115px flex justify-center items-center text-#fff rounded-10px text-18px cursor-pointer font-bold">
市况预测 <el-icon class="rotate-270deg">
<CaretBottom />
</el-icon></div>
</template>
<!-- <Teleport to="v-screen-box"> -->
<!-- <VScaleScreen
ref="fitscreenRef"
:width="1920"
:height="1080"
mode="fit"
> -->
<div class="bgStyle h-250px w-690px mt15px mb10px">
<div class="w-full">
<span class="title bg-#003BB7 !text-16px pl13px pr20px b">市况预测</span>
<!-- <el-button type="primary" v-if="userCode" class="button" @click="getUser(1)"></el-button> -->
<el-button type="primary" size="small" v-if="userCode" class="button !mr-2%"
@click="push({ name: 'MarketModifys' })">管理</el-button>
<p class="mt40px p15px !border-none max-h250px overflow-auto">
<p class="!border-none w-98% !flex items-center pb10px news-item !pr30rpx"
v-for="n in listDatas" :key="n">
<AppNewsBox class="flex-1 !border-none" :text="n.title" :date="n.createTime" />
<p class="flex-shrink flex !border-none w35px ml20px">
<el-button type="primary" @click="lokeFuck(n)"></el-button>
<el-button size="small" type="primary" @click="lokeFuck(n)"></el-button>
<!-- <el-button type="primary" @click="downloadFile(n)"></el-button> -->
</p>
</p>
</p>
</p>
</p>
</div>
</div>
<!-- </VScaleScreen> -->
<!-- </Teleport> -->
</el-popover>
</div>
</div>
</AppBlock>
<AppBlock class="flex-1 box">
<div class="box-title ">汇率</div>
<div class="bgStyle mt30px">
<div class="bgStyle !h250px mt20px">
<div class="mr25px">
<span @click="tabShow(1)" class="title bg-#FF603A !text-16px pl13px pr20px ">{{names1}}<el-icon><CaretBottom /></el-icon></span>
<div v-if="tab1" class="tab absolute bg-#fff w100px top-40px z-50 text-#112144 text-center leading-28px text-16px ">
<div v-if="currency" v-for="it in currency" class="py5px !rounded-none" :data-id="it.value" @click="tabClick1">{{it.title}}</div>
<span @click="tabShow(1)"
class="title bg-#FF603A !text-16px pl13px pr20px ">{{ names1 }}<el-icon>
<CaretBottom />
</el-icon></span>
<div v-if="tab1"
class="tab absolute bg-#fff w100px top-40px z-50 text-#112144 text-center leading-28px text-16px ">
<div v-if="currency" v-for="it in currency" class="py5px !rounded-none" :data-id="it.value"
@click="tabClick1">{{ it.title }}</div>
<!-- <div class="py5px !rounded-none" data-id="CNA,USD" @click="tabClick1">-</div>
<div class="py5px !rounded-none" data-id="JPY,USD" @click="tabClick1">-</div> -->
</div>
@ -367,10 +437,15 @@ async function getUser(moduleId: any) {
<VChart class=" absolute z-22" ref="chartRef3" :option="chartOption3" autoresize />
</div>
<div>
<span @click="tabShow(2)" class="title bg-#70BFCD !text-16px pl13px pr20px ">{{names2}}<el-icon><CaretBottom /></el-icon></span>
<span @click="tabShow(2)"
class="title bg-#70BFCD !text-16px pl13px pr20px ">{{ names2 }}<el-icon>
<CaretBottom />
</el-icon></span>
<div v-if="tab2" class="tab absolute bg-#fff w100px top-40px z-50 text-#112144 text-center leading-28px text-16px ">
<div v-if="currency" v-for="it in currency" class="py5px !rounded-none" :data-id="it.value" @click="tabClick2">{{it.title}}</div>
<div v-if="tab2"
class="tab absolute bg-#fff w100px top-40px z-50 text-#112144 text-center leading-28px text-16px ">
<div v-if="currency" v-for="it in currency" class="py5px !rounded-none" :data-id="it.value"
@click="tabClick2">{{ it.title }}</div>
<!-- <div class="py5px !rounded-none" data-id="CNA,USD" @click="tabClick2">-</div>
<div class="py5px !rounded-none" data-id="JPY,USD" @click="tabClick2">-</div> -->
</div>
@ -379,44 +454,48 @@ async function getUser(moduleId: any) {
</div>
</div>
<div class="bgStyle !h250px mt20px">
<div class="bgStyle !h250px mt10px">
<div>
<span class="title bg-#003BB7 !text-16px pl13px pr20px ">历年数据</span>
<VChart class=" absolute z-22" ref="chartRef6" :option="chartOption6" autoresize />
</div>
</div>
<div class="mt20px ml10px">
<div>
<span class="text-#000">日期:</span>
<div class="mt10px ml10px">
<div class="flex items-center w-45%">
<span class="text-#000 whitespace-nowrap">日期:</span>
<el-config-provider :locale="zhCn">
<el-date-picker v-model="value2" type="daterange" range-separator=""
start-placeholder="开始时间" end-placeholder="结束时间" size="small" @change="timenFirsts"/></el-config-provider>
<el-date-picker v-model="value2" type="daterange" range-separator=""
start-placeholder="开始时间" end-placeholder="结束时间" size="small"
@change="timenFirsts" /></el-config-provider>
</div>
<div class="mt10px">
<div class="h-30px">
<el-radio-group v-model="from.labe2.radio" class="ml-4" @change="thisCka2">
<el-radio v-if="currency" v-for="it in currency" :label="it.value" size="large" >{{it.title}}</el-radio>
<el-radio v-if="currency" v-for="it in currency" :label="it.value"
size="large">{{ it.title }}</el-radio>
<!-- <el-radio label="JPY,USD" size="large" >日元-美元</el-radio>
<el-radio label="CNA,USD" size="large" >人民币-美元</el-radio> -->
</el-radio-group>
</div>
</div>
<div class="bgStyle !h165px mt15px mb10px">
<div class="bgStyle !h230px mt15px mb10px">
<div>
<span class="title bg-#003BB7 !text-16px pl13px pr20px ">汇率预测</span>
<!-- <el-button type="primary" v-if="userCode" class="button" @click="getUser(2)"></el-button> -->
<el-button type="primary" v-if="userCodes" class="button" @click="push({name:'MarketModify'})"></el-button>
<p class="mt40px p15px !border-none max-h120px overflow-auto">
<p class="!border-none w615px !flex items-center pb10px news-item " v-for="n in listData" :key="n">
<AppNewsBox class="flex-1 !border-none" :text="n.title" :date="n.createTime" />
<p class="flex-shrink flex !border-none w35px ml20px">
<el-button type="primary" @click="lokeFuck(n)"></el-button>
<!-- <el-button type="primary" @click="downloadFile(n)"></el-button> -->
</p>
</p>
<el-button type="primary" v-if="userCodes" class="button"
@click="push({ name: 'MarketModify' })">管理</el-button>
<p class="mt40px p15px !border-none max-h-full overflow-auto">
<p class="!border-none w615px !flex items-center pb10px news-item " v-for="n in listData"
:key="n">
<AppNewsBox class="flex-1 !border-none" :text="n.title" :date="n.createTime" />
<p class="flex-shrink flex !border-none w35px ml20px">
<el-button type="primary" @click="lokeFuck(n)"></el-button>
<!-- <el-button type="primary" @click="downloadFile(n)"></el-button> -->
</p>
</p>
</p>
</div>
</div>
</AppBlock>
@ -425,9 +504,9 @@ async function getUser(moduleId: any) {
<!-- <div style="width: 1200px; height:800px ; position: fixed; z-index: 100; top:50px;;">
</div> -->
<n-modal :mask-closable="true" v-model:show="showModalRef2">
<n-modal :mask-closable="true" v-model:show="showModalRef2">
<div class="w90% h90% ">
<Amtion :data="src" :datas="srcType"/>
<Amtion :data="src" :datas="srcType" />
</div>
</n-modal>
@ -435,54 +514,59 @@ async function getUser(moduleId: any) {
<n-modal v-model:show="shomk">
<div class="py40px px30px bg-#fff">
<el-form :model="sdubList" label-width="120px" :inline="true">
<el-form-item label="标题" >
<el-input v-model="sdubList.title"/>
</el-form-item>
<br>
<el-form-item label="文件">
<el-upload v-model:file-list="sdubList.fileList" class="upload-demo" :headers="header"
action="/test-api/common/upload" :on-change="handleChange">
<el-button type="primary">选择文件</el-button>
<el-form :model="sdubList" label-width="120px" :inline="true">
<el-form-item label="标题">
<el-input v-model="sdubList.title" />
</el-form-item>
<br>
<el-form-item label="文件">
<el-upload v-model:file-list="sdubList.fileList" class="upload-demo" :headers="header"
action="/test-api/common/upload" :on-change="handleChange">
<el-button type="primary">选择文件</el-button>
</el-upload>
</el-form-item>
<br>
<br>
<el-form-item class="ml80px">
<el-button type="primary" @click="onSubmit"></el-button>
</el-form-item>
</el-form>
</el-upload>
</el-form-item>
<br>
<br>
<el-form-item class="ml80px">
<el-button type="primary" @click="onSubmit"></el-button>
</el-form-item>
</el-form>
</div>
</n-modal>
<n-modal v-model:show="showModal">
<UserList :userDataList="setUserList" @clickChild="handleChild" @CloseThis="CloseThiss"/>
</n-modal>
<UserList :userDataList="setUserList" @clickChild="handleChild" @CloseThis="CloseThiss" />
</n-modal>
</template>
<style scoped lang="less">
.bg-gr {
background: linear-gradient(to left, #34A6D9 0%, #23D1C6 100%);
}
.button{
.button {
display: block;
float: right;
margin-right:20px ;
margin-right: 20px;
}
::-webkit-scrollbar{
::-webkit-scrollbar {
width: 1px;
}
.top {
position: absolute;
right: 30px;
top: -92px;
}
.date-wrapper[data-v-c5c4f420] {
line-height: 1.5;
position: relative;
@ -495,8 +579,9 @@ async function getUser(moduleId: any) {
color: #142142;
border: none;
}
.tab{
div:hover{
.tab {
div:hover {
color: #0036BC;
}
}

View File

@ -0,0 +1,473 @@
import { historyStat,rateHistoryStat,historyMarketSevenDay,historyStatSevenDay} from '@/api/daikin/base'
import type { EChartsOption } from 'echarts'
import * as echarts from 'echarts'
import {calculateDateIntervals} from '@/utils/format'
const state = reactive<any>({
type: 'Cu',
})
const state1 = reactive<any>({
currencyCodeFrom:'CNA',
currencyCodeTo:'USD',
})
const state2 = reactive<any>({
currencyCodeFrom:'CNA',
currencyCodeTo:'USD',
})
const state3 = reactive<any>({
currencyCodeFrom:'USD',
currencyCodeTo:'CNA',
})
const state4 = reactive<any>({
number:'Cu',
type: '2',
dateList:calculateDateIntervals('','').list,
startTime:'',
endTime:'',
})
const state5 = reactive<any>({
currencyCodeFrom:'CNA',
currencyCodeTo:'JPY',
type: '2',
dateList:calculateDateIntervals('','').list,
startTime:'',
endTime:'',
})
function getDay(){
const today = new Date();
const pastSevenDays = [];
for (let i = 6; i >= 0; i--) {
const date = new Date(today);
date.setDate(today.getDate() - i);
pastSevenDays.push(date.toISOString().split('T')[0]);
}
return pastSevenDays;
}
function reverseArray(inputArray: string | any[],star: number,enc: number) {
const reversedArray = [];
for (let i = 0; i <= inputArray.length - 1; i++) {
reversedArray.push(inputArray[i].substring(star,enc));
}
return reversedArray;
}
export function Chart1() {
const chartRef = ref()
const optionRef = ref()
async function getDat() {
const { data } = await historyMarketSevenDay({ number: state.type })
if (!data) return
let { LME, SMM } = data[state.type]
SMM = SMM.map((item: any) => (item == 0 ? null : item))
LME = LME.map((item: any) => (item == 0 ? null : item))
const option = {
height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['SMM', 'LME'],
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: reverseArray(getDay(), 5, 10)
},
yAxis: [
{
type: 'value'
// name:'1',
},
{
// name:'2',
type: 'value'
}
],
series: [
{
name: 'SMM',
data: SMM,
color: '#8F97F8',
type: 'line',
yAxisIndex: 1,
showDataShadow: true,
connectNulls: true,
label: {
show: true,
position: 'top'
}
},
{
name: 'LME',
data: LME,
type: 'line',
color: '#FF603A',
showDataShadow: true,
connectNulls: true,
label: {
show: true,
position: 'top'
}
}
]
}
optionRef.value = option
}
const ss = computed(() => [state.type])
watch(
() => unref(ss),
async (v) => {
console.log(state.type)
getDat()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state }
}
export function Chart3() {
const chartRef = ref()
const optionRef = ref<any>({})
async function getDat() {
const { data } = await historyStatSevenDay({
currencyCodeFrom: state2.currencyCodeFrom,
currencyCodeTo: state2.currencyCodeTo
})
if (!data) return
const dat = (
data[state2.currencyCodeFrom + '-' + state2.currencyCodeTo] || []
).map((item: any) => (item == 0 ? null : item))
const option = {
height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
legend: {
data: state2.currencyCodeFrom + '-' + state2.currencyCodeTo,
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: reverseArray(getDay(), 8, 10)
},
yAxis: {
type: 'value'
},
series: [
{
name: state2.currencyCodeFrom + '-' + state2.currencyCodeTo,
data: dat,
color: '#8F97F8',
type: 'line',
showDataShadow: true,
connectNulls: true,
label: {
show: true,
position: 'top'
}
}
]
}
optionRef.value = option
}
const ss = computed(() => [state2.currencyCodeFrom, state2.currencyCodeTo])
watch(
() => unref(ss),
async (v) => {
console.log(state2.type)
getDat()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state2 }
}
export function Chart4() {
const chartRef = ref()
const optionRef = ref<any>({})
async function getDat() {
const { data } = await historyStatSevenDay({
currencyCodeFrom: state3.currencyCodeFrom,
currencyCodeTo: state3.currencyCodeTo
})
if (!data) return
const dat = (
data[state3.currencyCodeFrom + '-' + state3.currencyCodeTo] || []
).map((item: any) => (item == 0 ? null : item))
const option = {
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
height: '150px', // 设置图表高度为 400 像素
tooltip: {
trigger: 'axis'
},
legend: {
data: state3.currencyCodeFrom + '-' + state3.currencyCodeTo,
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: reverseArray(getDay(), 8, 10)
},
yAxis: {
type: 'value'
},
series: [
{
name: state3.currencyCodeFrom + '-' + state3.currencyCodeTo,
data: dat,
color: '#8F97F8',
type: 'line',
showDataShadow: true,
connectNulls: true,
label: {
show: true,
position: 'top'
}
}
]
}
optionRef.value = option
}
const ss = computed(() => [state3.currencyCodeFrom, state3.currencyCodeTo])
watch(
() => unref(ss),
async (v) => {
console.log(state3.type)
getDat()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state3 }
}
export function Chart5() {
const chartRef = ref()
const optionRef = ref<any>({})
let nameX: string[]
async function dataList() {
let SMM, LME
const { data } = await historyStat({
number: state4.number,
type: state4.type,
dateList: state4.dateList
})
if (data && data[state4.number]) {
SMM = data[state4.number].SMM || []
LME = data[state4.number].LME || []
SMM = SMM.map((item: any) => (item == 0 ? null : item))
LME = LME.map((item: any) => (item == 0 ? null : item))
}
const option = {
// width: '250px', // 设置图表宽度为 800 像素
// height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['SMM', 'LME'],
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: nameX
},
yAxis: [
{
type: 'value'
// name:'1',
},
{
// name:'2',
type: 'value'
}
],
series: [
{
name: 'SMM',
data: SMM,
color: '#FF9307',
type: 'line',
smooth: true,
showDataShadow: true,
connectNulls: true
},
{
name: 'LME',
data: LME,
type: 'line',
color: '#0063ED',
smooth: true,
yAxisIndex: 1,
showDataShadow: true,
connectNulls: true
}
]
}
optionRef.value = option
}
const ss = computed(() => [state4.number, state4.startTime, state4.endTime])
watch(
() => unref(ss),
async (v) => {
// console.log(calculateDateIntervals(state4.startTime,state4.endTime),88888)
const { type, list } = calculateDateIntervals(
state4.startTime,
state4.endTime
)
nameX = list
state4.dateList = list
state4.type = type
console.log(state4.number)
dataList()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state4 }
}
export function Chart6() {
const chartRef = ref()
const optionRef = ref<any>({})
let nameX: string[]
async function getDat() {
const { data } = await rateHistoryStat({
currencyCodeFrom: state5.currencyCodeFrom,
currencyCodeTo: state5.currencyCodeTo,
type: state5.type,
dateList: state5.dateList
})
const dat = (
data[state5.currencyCodeFrom + '-' + state5.currencyCodeTo] || []
).map((item: any) => (item == 0 ? null : item))
const option = {
// width: '250px', // 设置图表宽度为 800 像素
// height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
// legend: {
// data:state5.currencyCodeFrom-state5.currencyCodeTo,
// right: 20,
// top: 10,
// },
xAxis: {
type: 'category',
data: nameX
},
yAxis: {
type: 'value'
},
series: [
{
name: state5.currencyCodeFrom + '-' + state5.currencyCodeTo,
data: dat,
color: '#89DF75',
type: 'line',
smooth: true,
showDataShadow: true,
connectNulls: true
}
]
}
optionRef.value = option
}
const ss = computed(() => [
state5.currencyCodeFrom,
state5.currencyCodeTo,
state5.startTime,
state5.endTime
])
watch(
() => unref(ss),
async (v) => {
const { type, list } = calculateDateIntervals(
state5.startTime,
state5.endTime
)
nameX = list
state5.dateList = list
state5.type = type
getDat()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state5 }
}

View File

@ -0,0 +1,976 @@
import {
historyStat,
rateHistoryStat,
historyMarketSevenDay,
historyStatSevenDay,
fetchTimeFuturecenterCu,
fetchTimeFuturecenterAl
} from '@/api/daikin/base'
import { use } from 'echarts/core'
import type { EChartsOption } from 'echarts'
import * as echarts from 'echarts'
import { calculateDateIntervals } from '@/utils/format'
// import { CandlestickChart } from 'echarts/charts'
// use([CandlestickChart])
const state = reactive<any>({
type: 'Cu'
})
const state1 = reactive<any>({
currencyCodeFrom: 'CNA',
currencyCodeTo: 'USD'
})
const state2 = reactive<any>({
currencyCodeFrom: 'CNA',
currencyCodeTo: 'USD'
})
const state3 = reactive<any>({
currencyCodeFrom: 'USD',
currencyCodeTo: 'CNA'
})
const state4 = reactive<any>({
number: 'Cu',
type: '2',
dateList: calculateDateIntervals('', '').list,
startTime: '',
endTime: ''
})
const state5 = reactive<any>({
currencyCodeFrom: 'CNA',
currencyCodeTo: 'JPY',
type: '2',
dateList: calculateDateIntervals('', '').list,
startTime: '',
endTime: ''
})
function getDay() {
const today = new Date()
const pastSevenDays = []
for (let i = 6; i >= 0; i--) {
const date = new Date(today)
date.setDate(today.getDate() - i)
pastSevenDays.push(date.toISOString().split('T')[0])
}
return pastSevenDays
}
function reverseArray(inputArray: string | any[], star: number, enc: number) {
const reversedArray = []
for (let i = 0; i <= inputArray.length - 1; i++) {
reversedArray.push(inputArray[i].substring(star, enc))
}
return reversedArray
}
const cuType = reactive<any>({
type: 'cu0000'
})
export function Chart1(type = 'Cu') {
const chartRef = ref()
const optionRef = ref()
// const state = ref({
// type
// })
async function getDat() {
const { data = {} } =
type == 'Cu'
? await fetchTimeFuturecenterCu({ type: cuType.type })
: await fetchTimeFuturecenterAl({ type: cuType.type })
const { list = [] } = data
let xData: any = []
let lastPrice: any = []
let diff: any = []
let diffV: any = []
let tradingDay = ''
tradingDay = list[0]?.updateTime?.substr(0, 10) || ''
list.forEach((item: any) => {
xData.push(item.updateTime)
lastPrice.push(item.lastPrice)
diff.push(item.avgPrice)
diffV.push(parseFloat(item.diffValue).toFixed(2))
})
// console.log('🚀 ~ file: MarketData-new.ts:97 ~ diffV:', xData.at(-1), diffV.at(-1))
const option = {
// height: '270px', // 设置图表高度为 400 像素
height: '140px', // 设置图表高度为 400 像素
grid: {
left: '10',
right: '10',
// top: 90,
// bottom: '10',
containLabel: true
},
legend: {
data: ['SMM', 'LME'],
right: 20,
top: 10
},
tooltip: {
trigger: 'axis',
// position: function (pt) {
// return [pt[0], '10%']
// },
// backgroundColor: '#4c4c4c90',
zIndex: 50,
appendTo: 'body',
formatter: function (params: any) {
const { dataIndex } = params[0]
const val = list[dataIndex]
const style = 'display: flex;justify-content: space-between;align-items: center;'
const isUp = val.diffPrice > 0
const priceStyle = isUp ? 'color: #ec0000;' : 'color: #00da3c;'
return `
<div style="width:120px;font-size:12px;line-height:18px;">
<div style="${style}borderBottom: 1px solid #ccc">
<span>:</span>
<span>${val.updateTime?.substr(11, 5)}</span>
</div>
<div style="${style}">
<span>:</span>
<span style="${priceStyle}">${val.lastPrice}</span>
</div>
<div style="${style}">
<span>:</span>
<span style="${priceStyle}">${val.diffPrice}</span>
</div>
<div style="${style}">
<span>:</span>
<span style="${priceStyle}">${val.diffValue}%</span>
</div>
${
cuType.type
? `<div style="${style}">
<span>:</span>
<span>${val.donePrice ? (val.donePrice / 100000000).toFixed(2) : 0}亿</span>
</div>`
: ''
}
<div style="${style}">
<span>:</span>
<span>${val.doneNumber}</span>
</div>
${
cuType.type
? `<div style="${style}">
<span>:</span>
<span>${val.avgPrice}</span>
</div>`
: ''
}
</div>
`
},
position: function (pos, params, el, elRect, size) {
const obj: any = {
top: 10
}
obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 60
return obj
},
axisPointer: {
type: 'cross',
animation: true,
link: [
{
xAxisIndex: 'all'
}
],
label: {
backgroundColor: '#505765'
// formatter: function (params: any) {
// const val = parseFloat(params.value).toFixed(0)
// return params.axisDimension == 'x' ? `${tradingDay} ${params.value}:00` : val
// }
}
}
},
xAxis: [
{
type: 'category',
data: xData,
boundaryGap: false,
splitLine: { show: false },
axisLine: { onZero: false },
axisLabel: {
formatter: function (value: any) {
return value.substr(11, 5)
}
}
}
],
yAxis: [
// {
// name: 'Dow-Jones index',
// type: 'candlestick',
// data: list,
// itemStyle: {
// color: '#00da3c',
// color0: '#ec0000',
// borderColor: undefined,
// borderColor0: undefined
// }
// },
{
type: 'value',
name: '',
min: 'dataMin',
max: 'dataMax',
scale: true,
// splitArea: {
// show: true
// },
boundaryGap: [0, '100%']
},
{
type: 'value',
name: '',
// min: 'dataMin',
// formatter: '{value} %',
// alignTicks: true,
// boundaryGap: [0, '100%'],
scale: true,
onZero: false,
minInterval: 0.1,
axisLabel: {
// formatter: '{value}%'
formatter: function (value, index) {
return value.toFixed(1) + '%'
},
color: function (value, index) {
return value > 0 ? '#ec0000' : value == 0 ? '#333' : '#00da3c' //改变颜色 '%'
}
// color: 'skyblue'
}
}
],
dataZoom: [
{
type: 'inside',
start: 80,
end: 100
},
{
start: 80,
end: 100
}
],
series: []
}
const series = [
{
name: '',
type: 'line',
smooth: true,
symbol: 'none',
emphasis: {
focus: 'series'
},
// markLine: {
// data: [
// {
// type: 'average',
// name: 'Avg'
// // coord: [diff.at(-1), lastPrice.at(-1)],
// // name: 'New'
// }
// ],
// symbol: 'none',
// label: {
// // color: '#ec0000',
// formatter: (params) => {
// console.log('🚀 ~ file: MarketData-new.ts:271 ~ params:', params)
// return 0
// }
// // formatter: '{b}: {@score}'
// },
// itemStyle: {
// // color: '#ec0000'
// }
// },
// areaStyle: {},
data: lastPrice
},
{
name: '',
type: 'line',
emphasis: {
focus: 'series'
},
smooth: true,
symbol: 'none',
// yAxisIndex: 1,
// areaStyle: {},
data: diff,
itemStyle: {
normal: {
// color: '#E08F2D',
lineStyle: {
color: '#E08F2D'
}
}
}
},
{
name: '',
type: 'line',
emphasis: {
focus: 'series'
},
smooth: true,
symbol: 'none',
yAxisIndex: 1,
// markLine: {
// type: 'average',
// lineStyle: {
// color: '#E08F2D30'
// }
// },
data: diffV,
itemStyle: {
normal: {
// color: '#E08F2D',
lineStyle: {
type: 'dotted',
color: 'transparent'
}
}
}
// markLine: {
// data: [
// {
// type: 'max',
// name: '111',
// coord: [xData.at(-1), diffV.at(-1)]
// // name: 'New'
// }
// ],
// symbol: 'none',
// label: {
// // color: '#ec0000',
// formatter: (params) => {
// console.log('🚀 ~ file: MarketData-new.ts:271 ~ params:', diffV.at(-1), params)
// // return 0
// }
// // formatter: '{b}: {@score}'
// },
// itemStyle: {
// // color: '#ec0000'
// }
// }
}
]
option.series = cuType.type == 'cu0000' ? series : series.filter((_, i) => i != 1)
optionRef.value = option
}
// const ss = computed(() => [state.type])
watch(
() => cuType,
async (v) => {
getDat()
},
{ immediate: true, deep: true }
)
// getDat()
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, cuType }
}
const alType = reactive<any>({
type: 'al0000'
})
export function Chart11(type = 'Al') {
const chartRef = ref()
const optionRef = ref()
// const state = ref({
// type
// })
async function getDat() {
const { data = {} } =
type == 'Cu'
? await fetchTimeFuturecenterCu({ type: alType.type })
: await fetchTimeFuturecenterAl({ type: alType.type })
const { list = [] } = data
let xData: any = []
let lastPrice: any = []
let diff: any = []
let diffV: any = []
let tradingDay = ''
tradingDay = list[0]?.updateTime?.substr(0, 10) || ''
list.forEach((item: any) => {
xData.push(item.updateTime)
lastPrice.push(item.lastPrice)
diff.push(item.avgPrice)
diffV.push(parseFloat(item.diffValue).toFixed(2))
})
const option = {
// height: '270px', // 设置图表高度为 400 像素
height: '140px', // 设置图表高度为 400 像素
grid: {
left: '10',
right: '10',
// top: 90,
// bottom: '10',
containLabel: true
},
legend: {
data: ['SMM', 'LME'],
right: 20,
top: 10
},
tooltip: {
trigger: 'axis',
// position: function (pt) {
// return [pt[0], '10%']
// },
// backgroundColor: '#4c4c4c90',
appendTo: 'body',
formatter: function (params: any) {
const { dataIndex } = params[0]
const val = list[dataIndex]
const style = 'display: flex;justify-content: space-between;align-items: center;'
const isUp = val.diffPrice > 0
const priceStyle = isUp ? 'color: #ec0000;' : 'color: #00da3c;'
return `
<div style="width:120px;font-size:12px;line-height:18px;">
<div style="${style}borderBottom: 1px solid #ccc">
<span>:</span>
<span>${val.updateTime?.substr(11, 5)}</span>
</div>
<div style="${style}">
<span>:</span>
<span style="${priceStyle}">${val.lastPrice}</span>
</div>
<div style="${style}">
<span>:</span>
<span style="${priceStyle}">${val.diffPrice}</span>
</div>
<div style="${style}">
<span>:</span>
<span style="${priceStyle}">${val.diffValue}%</span>
</div>
${
alType.type
? `<div style="${style}">
<span>:</span>
<span>${val.donePrice ? (val.donePrice / 100000000).toFixed(2) : 0}亿</span>
</div>`
: ''
}
<div style="${style}">
<span>:</span>
<span>${val.doneNumber}</span>
</div>
${
alType.type
? `<div style="${style}">
<span>:</span>
<span>${val.avgPrice}</span>
</div>`
: ''
}
</div>
`
},
position: function (pos, params, el, elRect, size) {
const obj: any = {
top: 10
}
obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 100
return obj
},
axisPointer: {
type: 'cross',
animation: true,
link: [
{
xAxisIndex: 'all'
}
],
label: {
backgroundColor: '#505765'
// formatter: function (params: any) {
// const val = parseFloat(params.value).toFixed(0)
// return params.axisDimension == 'x' ? `${tradingDay} ${params.value}:00` : val
// }
}
}
},
xAxis: [
{
type: 'category',
data: xData,
boundaryGap: false,
splitLine: { show: false },
axisLine: { onZero: false },
axisLabel: {
formatter: function (value: any) {
return value.substr(11, 5)
}
}
}
],
yAxis: [
// {
// name: 'Dow-Jones index',
// type: 'candlestick',
// data: list,
// itemStyle: {
// color: '#00da3c',
// color0: '#ec0000',
// borderColor: undefined,
// borderColor0: undefined
// }
// },
{
type: 'value',
name: '',
min: 'dataMin',
max: 'dataMax',
scale: true,
// splitArea: {
// show: true
// },
boundaryGap: [0, '100%']
},
{
type: 'value',
name: '',
// min: 'dataMin',
// formatter: '{value} %',
// alignTicks: true,
// boundaryGap: [0, '100%'],
scale: true,
onZero: false,
minInterval: 0.1,
axisLabel: {
// formatter: '{value}%'
formatter: function (value, index) {
return value.toFixed(1) + '%'
},
color: function (value, index) {
return value > 0 ? '#ec0000' : value == 0 ? '#333' : '#00da3c' //改变颜色 '%'
}
}
}
],
dataZoom: [
{
type: 'inside',
start: 80,
end: 100
},
{
start: 80,
end: 100
}
],
series: []
}
const series = [
{
name: '',
type: 'line',
smooth: true,
symbol: 'none',
emphasis: {
focus: 'series'
},
// areaStyle: {},
data: lastPrice
},
{
name: '',
type: 'line',
emphasis: {
focus: 'series'
},
show: false,
smooth: true,
symbol: 'none',
// yAxisIndex: 1,
// areaStyle: {},
data: diff,
itemStyle: {
normal: {
// color: '#E08F2D',
lineStyle: {
color: '#E08F2D'
}
}
}
},
{
name: '',
type: 'line',
emphasis: {
focus: 'series'
},
smooth: true,
symbol: 'none',
yAxisIndex: 1,
// markLine: {
// type: 'average',
// lineStyle: {
// color: '#E08F2D30'
// }
// },
data: diffV,
itemStyle: {
normal: {
// color: '#E08F2D',
lineStyle: {
type: 'dotted',
color: 'transparent'
}
}
}
}
]
option.series = alType.type == 'al0000' ? series : series.filter((_: any, index) => index != 1)
optionRef.value = option
}
// const ss = computed(() => [state.type])
watch(
() => alType,
async (v) => {
getDat()
},
{ immediate: true, deep: true }
)
// getDat()
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, alType }
}
export function Chart3() {
const chartRef = ref()
const optionRef = ref<any>({})
async function getDat() {
const { data } = await historyStatSevenDay({
currencyCodeFrom: state2.currencyCodeFrom,
currencyCodeTo: state2.currencyCodeTo
})
if (!data) return
const dat = (data[state2.currencyCodeFrom + '-' + state2.currencyCodeTo] || []).map(
(item: any) => (item == 0 ? null : item)
)
const option = {
height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
legend: {
data: state2.currencyCodeFrom + '-' + state2.currencyCodeTo,
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: reverseArray(getDay(), 8, 10)
},
yAxis: {
type: 'value'
},
series: [
{
name: state2.currencyCodeFrom + '-' + state2.currencyCodeTo,
data: dat,
color: '#8F97F8',
type: 'line',
showDataShadow: true,
connectNulls: true,
label: {
show: true,
position: 'top'
}
}
]
}
optionRef.value = option
}
const ss = computed(() => [state2.currencyCodeFrom, state2.currencyCodeTo])
watch(
() => unref(ss),
async (v) => {
console.log(state2.type)
getDat()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state2 }
}
export function Chart4() {
const chartRef = ref()
const optionRef = ref<any>({})
async function getDat() {
const { data } = await historyStatSevenDay({
currencyCodeFrom: state3.currencyCodeFrom,
currencyCodeTo: state3.currencyCodeTo
})
if (!data) return
const dat = (data[state3.currencyCodeFrom + '-' + state3.currencyCodeTo] || []).map(
(item: any) => (item == 0 ? null : item)
)
const option = {
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
height: '150px', // 设置图表高度为 400 像素
tooltip: {
trigger: 'axis'
},
legend: {
data: state3.currencyCodeFrom + '-' + state3.currencyCodeTo,
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: reverseArray(getDay(), 8, 10)
},
yAxis: {
type: 'value'
},
series: [
{
name: state3.currencyCodeFrom + '-' + state3.currencyCodeTo,
data: dat,
color: '#8F97F8',
type: 'line',
showDataShadow: true,
connectNulls: true,
label: {
show: true,
position: 'top'
}
}
]
}
optionRef.value = option
}
const ss = computed(() => [state3.currencyCodeFrom, state3.currencyCodeTo])
watch(
() => unref(ss),
async (v) => {
console.log(state3.type)
getDat()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state3 }
}
export function Chart5() {
const chartRef = ref()
const optionRef = ref<any>({})
let nameX: string[]
async function dataList() {
let SMM, LME
const { data } = await historyStat({
number: state4.number,
type: state4.type,
dateList: state4.dateList
})
if (data && data[state4.number]) {
SMM = data[state4.number].SMM || []
LME = data[state4.number].LME || []
SMM = SMM.map((item: any) => (item == 0 ? null : item))
LME = LME.map((item: any) => (item == 0 ? null : item))
}
const option = {
// width: '250px', // 设置图表宽度为 800 像素
// height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['SMM', 'LME'],
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: nameX
},
yAxis: [
{
type: 'value'
// name:'1',
},
{
// name:'2',
type: 'value'
}
],
series: [
{
name: 'SMM',
data: SMM,
color: '#FF9307',
type: 'line',
smooth: true,
showDataShadow: true,
connectNulls: true
},
{
name: 'LME',
data: LME,
type: 'line',
color: '#0063ED',
smooth: true,
yAxisIndex: 1,
showDataShadow: true,
connectNulls: true
}
]
}
optionRef.value = option
}
const ss = computed(() => [state4.number, state4.startTime, state4.endTime])
watch(
() => unref(ss),
async (v) => {
// console.log(calculateDateIntervals(state4.startTime,state4.endTime),88888)
const { type, list } = calculateDateIntervals(state4.startTime, state4.endTime)
nameX = list
state4.dateList = list
state4.type = type
console.log(state4.number)
dataList()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state4 }
}
export function Chart6() {
const chartRef = ref()
const optionRef = ref<any>({})
let nameX: string[]
async function getDat() {
const { data } = await rateHistoryStat({
currencyCodeFrom: state5.currencyCodeFrom,
currencyCodeTo: state5.currencyCodeTo,
type: state5.type,
dateList: state5.dateList
})
const dat = (data[state5.currencyCodeFrom + '-' + state5.currencyCodeTo] || []).map(
(item: any) => (item == 0 ? null : item)
)
const option = {
// width: '250px', // 设置图表宽度为 800 像素
// height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
// legend: {
// data:state5.currencyCodeFrom-state5.currencyCodeTo,
// right: 20,
// top: 10,
// },
xAxis: {
type: 'category',
data: nameX
},
yAxis: {
type: 'value'
},
series: [
{
name: state5.currencyCodeFrom + '-' + state5.currencyCodeTo,
data: dat,
color: '#89DF75',
type: 'line',
smooth: true,
showDataShadow: true,
connectNulls: true
}
]
}
optionRef.value = option
}
const ss = computed(() => [
state5.currencyCodeFrom,
state5.currencyCodeTo,
state5.startTime,
state5.endTime
])
watch(
() => unref(ss),
async (v) => {
const { type, list } = calculateDateIntervals(state5.startTime, state5.endTime)
nameX = list
state5.dateList = list
state5.type = type
getDat()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state5 }
}

View File

@ -1,473 +1,472 @@
import { historyStat,rateHistoryStat,historyMarketSevenDay,historyStatSevenDay} from '@/api/daikin/base'
import {
historyStat,
rateHistoryStat,
historyMarketSevenDay,
historyStatSevenDay
} from '@/api/daikin/base'
import type { EChartsOption } from 'echarts'
import * as echarts from 'echarts'
import {calculateDateIntervals} from '@/utils/format'
import { calculateDateIntervals } from '@/utils/format'
const state = reactive<any>({
type: 'Cu',
type: 'Cu'
})
const state1 = reactive<any>({
currencyCodeFrom:'CNA',
currencyCodeTo:'USD',
currencyCodeFrom: 'CNA',
currencyCodeTo: 'USD'
})
const state2 = reactive<any>({
currencyCodeFrom:'CNA',
currencyCodeTo:'USD',
currencyCodeFrom: 'CNA',
currencyCodeTo: 'USD'
})
const state3 = reactive<any>({
currencyCodeFrom:'USD',
currencyCodeTo:'CNA',
currencyCodeFrom: 'USD',
currencyCodeTo: 'CNA'
})
const state4 = reactive<any>({
number:'Cu',
number: 'Cu',
type: '2',
dateList:calculateDateIntervals('','').list,
startTime:'',
endTime:'',
dateList: calculateDateIntervals('', '').list,
startTime: '',
endTime: ''
})
const state5 = reactive<any>({
currencyCodeFrom:'CNA',
currencyCodeTo:'JPY',
currencyCodeFrom: 'CNA',
currencyCodeTo: 'JPY',
type: '2',
dateList:calculateDateIntervals('','').list,
startTime:'',
endTime:'',
dateList: calculateDateIntervals('', '').list,
startTime: '',
endTime: ''
})
function getDay(){
const today = new Date();
const pastSevenDays = [];
function getDay() {
const today = new Date()
const pastSevenDays = []
for (let i = 6; i >= 0; i--) {
const date = new Date(today);
date.setDate(today.getDate() - i);
pastSevenDays.push(date.toISOString().split('T')[0]);
const date = new Date(today)
date.setDate(today.getDate() - i)
pastSevenDays.push(date.toISOString().split('T')[0])
}
return pastSevenDays;
return pastSevenDays
}
function reverseArray(inputArray: string | any[],star: number,enc: number) {
const reversedArray = [];
function reverseArray(inputArray: string | any[], star: number, enc: number) {
const reversedArray = []
for (let i = 0; i <= inputArray.length - 1; i++) {
reversedArray.push(inputArray[i].substring(star,enc));
reversedArray.push(inputArray[i].substring(star, enc))
}
return reversedArray;
}
export function Chart1() {
const chartRef = ref()
const optionRef = ref()
async function getDat() {
const { data } = await historyMarketSevenDay({ number: state.type })
if (!data) return
let { LME, SMM } = data[state.type]
SMM = SMM.map((item: any) => (item == 0 ? null : item))
LME = LME.map((item: any) => (item == 0 ? null : item))
const option = {
height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['SMM', 'LME'],
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: reverseArray(getDay(), 5, 10)
},
yAxis: [
{
type: 'value'
// name:'1',
},
{
// name:'2',
type: 'value'
}
],
series: [
{
name: 'SMM',
data: SMM,
color: '#8F97F8',
type: 'line',
yAxisIndex: 1,
showDataShadow: true,
connectNulls: true,
label: {
show: true,
position: 'top'
}
},
{
name: 'LME',
data: LME,
type: 'line',
color: '#FF603A',
showDataShadow: true,
connectNulls: true,
label: {
show: true,
position: 'top'
}
}
]
}
optionRef.value = option
}
const ss = computed(() => [state.type])
watch(
() => unref(ss),
async (v) => {
console.log(state.type)
getDat()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state }
return reversedArray
}
export function Chart1(type = state.type) {
const chartRef = ref()
const optionRef = ref()
getDat()
async function getDat() {
const { data } = await historyMarketSevenDay({ number: type })
if (!data) return
let { LME, SMM } = data[type]
SMM = SMM.map((item: any) => (item == 0 ? null : item))
LME = LME.map((item: any) => (item == 0 ? null : item))
const option = {
// width: '100%', // 设置图表宽度为 800 像素
// height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 60,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['SMM', 'LME'],
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: reverseArray(getDay(), 5, 10)
},
yAxis: [
{
type: 'value'
// name:'1',
},
{
// name:'2',
type: 'value'
}
],
series: [
{
name: 'SMM',
data: SMM,
color: '#8F97F8',
type: 'line',
yAxisIndex: 1,
showDataShadow: true,
connectNulls: true,
label: {
show: true,
position: 'top'
}
},
{
name: 'LME',
data: LME,
type: 'line',
color: '#FF603A',
showDataShadow: true,
connectNulls: true,
label: {
show: true,
position: 'top'
}
}
]
}
optionRef.value = option
}
// const ss = computed(() => [state.type])
// watch(
// () => unref(ss),
// async (v) => {
// console.log(state.type)
// getDat()
// },
// { immediate: true, deep: true }
// )
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state }
}
export function Chart3() {
const chartRef = ref()
const optionRef = ref<any>({})
const chartRef = ref()
const optionRef = ref<any>({})
async function getDat() {
const { data } = await historyStatSevenDay({
currencyCodeFrom: state2.currencyCodeFrom,
currencyCodeTo: state2.currencyCodeTo
})
if (!data) return
const dat = (
data[state2.currencyCodeFrom + '-' + state2.currencyCodeTo] || []
).map((item: any) => (item == 0 ? null : item))
async function getDat() {
const { data } = await historyStatSevenDay({
currencyCodeFrom: state2.currencyCodeFrom,
currencyCodeTo: state2.currencyCodeTo
})
if (!data) return
const dat = (data[state2.currencyCodeFrom + '-' + state2.currencyCodeTo] || []).map(
(item: any) => (item == 0 ? null : item)
)
const option = {
height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
legend: {
data: state2.currencyCodeFrom + '-' + state2.currencyCodeTo,
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: reverseArray(getDay(), 8, 10)
},
yAxis: {
type: 'value'
},
series: [
{
name: state2.currencyCodeFrom + '-' + state2.currencyCodeTo,
data: dat,
color: '#8F97F8',
type: 'line',
showDataShadow: true,
connectNulls: true,
label: {
show: true,
position: 'top'
}
}
]
}
const option = {
height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
legend: {
data: state2.currencyCodeFrom + '-' + state2.currencyCodeTo,
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: reverseArray(getDay(), 8, 10)
},
yAxis: {
type: 'value'
},
series: [
{
name: state2.currencyCodeFrom + '-' + state2.currencyCodeTo,
data: dat,
color: '#8F97F8',
type: 'line',
showDataShadow: true,
connectNulls: true,
label: {
show: true,
position: 'top'
}
}
]
}
optionRef.value = option
}
const ss = computed(() => [state2.currencyCodeFrom, state2.currencyCodeTo])
watch(
() => unref(ss),
async (v) => {
console.log(state2.type)
getDat()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state2 }
optionRef.value = option
}
const ss = computed(() => [state2.currencyCodeFrom, state2.currencyCodeTo])
watch(
() => unref(ss),
async (v) => {
console.log(state2.type)
getDat()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state2 }
}
export function Chart4() {
const chartRef = ref()
const optionRef = ref<any>({})
const chartRef = ref()
const optionRef = ref<any>({})
async function getDat() {
const { data } = await historyStatSevenDay({
currencyCodeFrom: state3.currencyCodeFrom,
currencyCodeTo: state3.currencyCodeTo
})
if (!data) return
const dat = (
data[state3.currencyCodeFrom + '-' + state3.currencyCodeTo] || []
).map((item: any) => (item == 0 ? null : item))
async function getDat() {
const { data } = await historyStatSevenDay({
currencyCodeFrom: state3.currencyCodeFrom,
currencyCodeTo: state3.currencyCodeTo
})
if (!data) return
const dat = (data[state3.currencyCodeFrom + '-' + state3.currencyCodeTo] || []).map(
(item: any) => (item == 0 ? null : item)
)
const option = {
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
const option = {
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
height: '150px', // 设置图表高度为 400 像素
height: '150px', // 设置图表高度为 400 像素
tooltip: {
trigger: 'axis'
},
legend: {
data: state3.currencyCodeFrom + '-' + state3.currencyCodeTo,
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: reverseArray(getDay(), 8, 10)
},
yAxis: {
type: 'value'
},
series: [
{
name: state3.currencyCodeFrom + '-' + state3.currencyCodeTo,
data: dat,
color: '#8F97F8',
type: 'line',
showDataShadow: true,
connectNulls: true,
label: {
show: true,
position: 'top'
}
}
]
}
tooltip: {
trigger: 'axis'
},
legend: {
data: state3.currencyCodeFrom + '-' + state3.currencyCodeTo,
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: reverseArray(getDay(), 8, 10)
},
yAxis: {
type: 'value'
},
series: [
{
name: state3.currencyCodeFrom + '-' + state3.currencyCodeTo,
data: dat,
color: '#8F97F8',
type: 'line',
showDataShadow: true,
connectNulls: true,
label: {
show: true,
position: 'top'
}
}
]
}
optionRef.value = option
}
const ss = computed(() => [state3.currencyCodeFrom, state3.currencyCodeTo])
watch(
() => unref(ss),
async (v) => {
console.log(state3.type)
optionRef.value = option
}
const ss = computed(() => [state3.currencyCodeFrom, state3.currencyCodeTo])
watch(
() => unref(ss),
async (v) => {
console.log(state3.type)
getDat()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state3 }
getDat()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state3 }
}
export function Chart5() {
const chartRef = ref()
const optionRef = ref<any>({})
let nameX: string[]
async function dataList() {
let SMM, LME
const { data } = await historyStat({
number: state4.number,
type: state4.type,
dateList: state4.dateList
})
if (data && data[state4.number]) {
SMM = data[state4.number].SMM || []
LME = data[state4.number].LME || []
SMM = SMM.map((item: any) => (item == 0 ? null : item))
LME = LME.map((item: any) => (item == 0 ? null : item))
}
const chartRef = ref()
const optionRef = ref<any>({})
let nameX: string[]
async function dataList() {
let SMM, LME
const { data } = await historyStat({
number: state4.number,
type: state4.type,
dateList: state4.dateList
})
if (data && data[state4.number]) {
SMM = data[state4.number].SMM || []
LME = data[state4.number].LME || []
SMM = SMM.map((item: any) => (item == 0 ? null : item))
LME = LME.map((item: any) => (item == 0 ? null : item))
}
const option = {
// width: '250px', // 设置图表宽度为 800 像素
// height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['SMM', 'LME'],
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: nameX
},
yAxis: [
{
type: 'value'
// name:'1',
},
{
// name:'2',
type: 'value'
}
],
series: [
{
name: 'SMM',
data: SMM,
color: '#FF9307',
type: 'line',
smooth: true,
showDataShadow: true,
connectNulls: true
},
{
name: 'LME',
data: LME,
type: 'line',
color: '#0063ED',
smooth: true,
yAxisIndex: 1,
showDataShadow: true,
connectNulls: true
}
]
}
optionRef.value = option
}
const ss = computed(() => [state4.number, state4.startTime, state4.endTime])
watch(
() => unref(ss),
async (v) => {
// console.log(calculateDateIntervals(state4.startTime,state4.endTime),88888)
const { type, list } = calculateDateIntervals(
state4.startTime,
state4.endTime
)
nameX = list
state4.dateList = list
state4.type = type
console.log(state4.number)
dataList()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state4 }
const option = {
// width: '250px', // 设置图表宽度为 800 像素
// height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['SMM', 'LME'],
right: 20,
top: 10
},
xAxis: {
type: 'category',
data: nameX
},
yAxis: [
{
type: 'value'
// name:'1',
},
{
// name:'2',
type: 'value'
}
],
series: [
{
name: 'SMM',
data: SMM,
color: '#FF9307',
type: 'line',
smooth: true,
showDataShadow: true,
connectNulls: true
},
{
name: 'LME',
data: LME,
type: 'line',
color: '#0063ED',
smooth: true,
yAxisIndex: 1,
showDataShadow: true,
connectNulls: true
}
]
}
optionRef.value = option
}
const ss = computed(() => [state4.number, state4.startTime, state4.endTime])
watch(
() => unref(ss),
async (v) => {
// console.log(calculateDateIntervals(state4.startTime,state4.endTime),88888)
const { type, list } = calculateDateIntervals(state4.startTime, state4.endTime)
nameX = list
state4.dateList = list
state4.type = type
console.log(state4.number)
dataList()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state4 }
}
export function Chart6() {
const chartRef = ref()
const optionRef = ref<any>({})
const chartRef = ref()
const optionRef = ref<any>({})
let nameX: string[]
async function getDat() {
const { data } = await rateHistoryStat({
currencyCodeFrom: state5.currencyCodeFrom,
currencyCodeTo: state5.currencyCodeTo,
type: state5.type,
dateList: state5.dateList
})
const dat = (
data[state5.currencyCodeFrom + '-' + state5.currencyCodeTo] || []
).map((item: any) => (item == 0 ? null : item))
const option = {
// width: '250px', // 设置图表宽度为 800 像素
// height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
// legend: {
// data:state5.currencyCodeFrom-state5.currencyCodeTo,
// right: 20,
// top: 10,
// },
xAxis: {
type: 'category',
data: nameX
},
yAxis: {
type: 'value'
},
series: [
{
name: state5.currencyCodeFrom + '-' + state5.currencyCodeTo,
data: dat,
color: '#89DF75',
type: 'line',
smooth: true,
showDataShadow: true,
connectNulls: true
}
]
}
optionRef.value = option
}
const ss = computed(() => [
state5.currencyCodeFrom,
state5.currencyCodeTo,
state5.startTime,
state5.endTime
])
watch(
() => unref(ss),
async (v) => {
const { type, list } = calculateDateIntervals(
state5.startTime,
state5.endTime
)
let nameX: string[]
async function getDat() {
const { data } = await rateHistoryStat({
currencyCodeFrom: state5.currencyCodeFrom,
currencyCodeTo: state5.currencyCodeTo,
type: state5.type,
dateList: state5.dateList
})
const dat = (data[state5.currencyCodeFrom + '-' + state5.currencyCodeTo] || []).map(
(item: any) => (item == 0 ? null : item)
)
const option = {
// width: '250px', // 设置图表宽度为 800 像素
// height: '150px', // 设置图表高度为 400 像素
grid: {
left: '10',
top: 90,
right: '10',
bottom: '10',
containLabel: true
},
tooltip: {
trigger: 'axis'
},
// legend: {
// data:state5.currencyCodeFrom-state5.currencyCodeTo,
// right: 20,
// top: 10,
// },
xAxis: {
type: 'category',
data: nameX
},
yAxis: {
type: 'value'
},
series: [
{
name: state5.currencyCodeFrom + '-' + state5.currencyCodeTo,
data: dat,
color: '#89DF75',
type: 'line',
smooth: true,
showDataShadow: true,
connectNulls: true
}
]
}
optionRef.value = option
}
const ss = computed(() => [
state5.currencyCodeFrom,
state5.currencyCodeTo,
state5.startTime,
state5.endTime
])
watch(
() => unref(ss),
async (v) => {
const { type, list } = calculateDateIntervals(state5.startTime, state5.endTime)
nameX = list
state5.dateList = list
state5.type = type
getDat()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state5 }
}
nameX = list
state5.dateList = list
state5.type = type
getDat()
},
{ immediate: true, deep: true }
)
watchEffect(() => {
const option = chartRef.value
chartRef.value = option
})
return { chartRef, option: optionRef, state5 }
}

View File

@ -0,0 +1,721 @@
<!-- 市况 -->
<script setup lang="ts">
import { Chart1,Chart11, Chart3, Chart4, Chart5, Chart6 } from './MarketData-new'
import HomeHead from '@/views/home/components/HomeHead.vue'
import AppBlock from '@/components/AppBlock.vue'
import AppNewsBox from '@/components/AppNewsBox.vue'
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import { useDate } from '@/views/home/hooks/useDate'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import { getList, marketPreADD, getMarketUser, saveMarketUser, MarketDownload, MarketPreview, getCurrencyList, getMetalList, fetchExchangeInfo, fetchTimeFuturecenterCu, fetchTimeFuturecenterAl } from '@/api/daikin/base'
import { NModal, NCard } from 'naive-ui'
import { formatDate } from '@/utils/format'
import { message } from '@/utils/message'
import { useUserStore } from '@/stores/modules/user'
import UserList from '@/views/home/intelligence/process/UserPages.vue'
import Amtion from '@/components/amtion.vue'
import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
import { groupBy } from 'lodash-es'
import {
LegendComponent,
TooltipComponent,
GridComponent,
TitleComponent,
} from 'echarts/components'
import { PieChart, BarChart, LineChart, CandlestickChart } from 'echarts/charts'
import { noticeld } from '@/stores/modules/noticeId'
const store = useUserStore()
const stores = noticeld()
const userCode = ['admin', 'shikuang_dandang', 'tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
const userCodes = ['admin', 'huilv_dandang', 'tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
use([
CanvasRenderer,
LegendComponent,
TooltipComponent,
GridComponent,
TitleComponent,
PieChart,
BarChart,
LineChart,
CandlestickChart
])
const { day, week } = useDate()
const { push } = useRouter()
const currentDate = new Date();
const currentDates = new Date();
const value1 = ref<[Date, Date]>([
currentDate.setMonth(currentDate.getMonth() - 11),
new Date()
])
const value2 = ref<[Date, Date]>([
currentDates.setMonth(currentDates.getMonth() - 11),
new Date()
])
const { chartRef: chartRef1, option: chartOption1, cuType } = Chart1()
const { option: chartOption11,alType } = Chart11()
const { chartRef: chartRef3, option: chartOption3, state2 } = Chart3()
const { chartRef: chartRef4, option: chartOption4, state3 } = Chart4()
const { chartRef: chartRef5, option: chartOption5, state4 } = Chart5()
// const { state4 } = Chart5()
const { chartRef: chartRef6, option: chartOption6, state5 } = Chart6()
const listData = ref()
const listDatas = ref()
async function getData() {
const { data } = await getList({ type: 2 })
const { data: ds } = await getList({ type: 1 })
listData.value = data
listDatas.value = ds
}
const metal = ref()
const currency = ref()
onMounted(async () => {
getData()
const { data } = await getCurrencyList()
const { data: dat } = await getMetalList()
if (dat && dat != 'null' && dat.length > 0) {
metal.value = dat
// .filter((item:any) => {
// if(["Fe","lengmei"].includes(item.value)){
// return false
// }else return item
// })
from.value.label.radio = dat[0].value
state4.number = dat[0].value
console.log("🚀 ~ file: Market.vue:56 ~ metal:", metal)
}
if (data && data != 'null' && data.length > 0) {
currency.value = data
from.value.labe2.radio = data[0].value
const dat = data[0].value.split(',')
state5.currencyCodeFrom = dat[0]
state5.currencyCodeTo = dat[1]
state2.currencyCodeFrom = dat[0]
state2.currencyCodeTo = dat[1]
state3.currencyCodeFrom = dat[0]
state3.currencyCodeTo = dat[1]
}
})
const src = ref('');
const srcType = ref()
const showModalRef2 = ref(false)
const lokeFuck = async (n) => {
const { id } = n
if (!id) return
let { data: { url } } = await MarketPreview({ id })
if (!url) {
message.info("没有可预览文件!")
return
}
srcType.value = getLastSubstring(url)
if (['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'pdf'].includes(srcType.value)) {
// src.value = filePath
// pdfShow.value = true
url = 'https://view.xdocin.com/view?src=' + url
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
window.open(url, '', 'width=' + screenWidth + ',height=' + screenHeight + ',top=' + 0 + ',left=' + 0)
}
else {
message.error("文件格式不是 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'")
}
}
function getLastSubstring(str: string): string {
const lastIndex = str.lastIndexOf('.');
if (lastIndex !== -1) {
return str.substring(lastIndex + 1);
} else {
return '';
}
}
async function downloadFile(data: { id: any; title: string }) {
console.log(data)
if (!data.id) return
try {
const response = await MarketDownload({ id: data.id })
console.log(response)
var blob = new Blob([response.data]);
const downloadUrl = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = downloadUrl;
link.download = response.fileName; //
link.click();
URL.revokeObjectURL(downloadUrl);
} catch (error) {
message.error(error);
}
}
const tab = ref(false)
const tab1 = ref(false)
const tab2 = ref(false)
const names = ref('Cu')
const names1 = ref('100USD-CNY')
const names2 = ref('100USD-CNY')
const tabClick1 = (e) => {
console.log(e.target.getAttribute('data-id'))
tab1.value = false
const dat = e.target.getAttribute('data-id').split(',')
names1.value = e.target.innerText
state2.currencyCodeFrom = dat[0]
state2.currencyCodeTo = dat[1]
}
const tabClick2 = (e) => {
console.log(e.target.getAttribute('data-id'))
tab2.value = false
const dat = e.target.getAttribute('data-id').split(',')
names2.value = e.target.innerText
state3.currencyCodeFrom = dat[0]
state3.currencyCodeTo = dat[1]
}
const tabClick = (e) => {
console.log(e.target)
tab.value = false
state.type = e.target.getAttribute('data-id')
// names.value =e.target.innerText
}
const tabShow = (num) => {
console.log(num)
switch (num) {
case 0:
tab.value = tab.value === false ? true : false
break;
case 1:
tab1.value = tab1.value === false ? true : false
break;
case 2:
tab2.value = tab2.value === false ? true : false
break;
}
}
const from = ref({
label: {
radio: ''
},
labe2: {
radio: ''
}
})
const shomk = ref(false)
const sdubList = ref({
title: '',
fileList: [],
})
const shomks = (it) => {
sdubList.value.type = it
// console.log(sdubList.value)
shomk.value = true
}
async function onSubmit() {
const { type, title, fileList } = sdubList.value
let filePath
if (fileList.length > 0) {
// console.log(fileList)
filePath = fileList[0].response.url
}
const { msg, code } = await marketPreADD({ type, title, filePath })
if (code === 200) { message.success("修改成功") }
else message.warning(msg)
window.location.reload();
// console.log(sdubList.value)
}
const handleExceed: UploadProps['onExceed'] = (uploadFile: any, uploadFiles: any) => {
message.warning("当前只支持上传一个文件")
}
const thisCka = (e) => {
if (value1.value) {
state4.startTime = formatDate(value1.value[0]).substring(0, 10)
state4.endTime = formatDate(value1.value[1]).substring(0, 10)
}
state4.number = e
console.log(e)
}
const thisCka2 = (e) => {
const dat = e.split(',')
if (value2.value) {
state5.startTime = formatDate(value2.value[0]).substring(0, 10)
state5.endTime = formatDate(value2.value[1]).substring(0, 10)
}
state5.currencyCodeFrom = dat[0]
state5.currencyCodeTo = dat[1]
}
const timenFirst = (e) => {
// console.log(e)
state4.startTime = formatDate(value1.value[0]).substring(0, 10)
state4.endTime = formatDate(value1.value[1]).substring(0, 10)
}
const timenFirsts = (e) => {
// console.log(e)
state5.startTime = formatDate(value2.value[0]).substring(0, 10)
state5.endTime = formatDate(value2.value[1]).substring(0, 10)
}
const header = { 'token': store.user.token }
const showModal = ref(false)
const flg = ref()
const setUserList = ref()
async function getUser(moduleId: any) {
showModal.value = !showModal.value
flg.value = moduleId
const { data: userArr } = await getMarketUser({ moduleId })
stores.article.reviewSource = '2'
setUserList.value = userArr
}
//
const handleChild = (data: any) => {
console.log(data, 444);
const { showModal: show, multipleSelection } = data
showModal.value = unref(show)
// userList.value = multipleSelection
let userIdList: any[] = []
multipleSelection.value.forEach((i: { userId: any }) => {
// console.log(dataList.value)
userIdList.push(i.userId)
})
saveMarketUser({
moduleId: flg.value,
userIdList: userIdList
})
}
const CloseThiss = (data: boolean) => {
showModal.value = data
}
getHomeExInfo()
const exchangeInfo = ref({})
// getTimeFuturecenter()
const homeExchangeInfo = ref<any>([])
async function getHomeExInfo() {
const { data } = await fetchExchangeInfo()
exchangeInfo.value = groupBy(data,'channel')
console.log('🚀 ~ file: Home.vue:252 ~ }):', exchangeInfo.value)
}
async function getTimeFuturecenter() {
const { data } = await fetchTimeFuturecenterCu()
console.log("🚀 ~ file: Market.vue:293 ~ data:", data)
}
const cuTypeChange = (e) => {
}
</script>
<template>
<HomeHead class="top">
<template #content>
<!-- <HomeHeadSearch /> -->
</template>
</HomeHead>
<div class="h-full relative flex flex-col overflow-y-auto scrollbar-width-1px">
<div class="pl12px mt30px flex w-full h-full gap-30px">
<!-- <img src="./images/shukuang.png" alt="" class="w-full h-full"> -->
<AppBlock class="flex-1 box">
<div class="box-title">市况</div>
<el-button type="primary" v-if="userCode" class="button !mr-30px !mt-[-30px] z-100"
@click="push({ name: 'MarketDataModify' })">数据管理</el-button>
<div class="bgStyle !h250px mt20px">
<div class=" relative w100%">
<span @click="tabShow(0)" class="title bg-#70BFCD pl18px pr24px">{{ names }}
<!-- <el-icon><CaretBottom /></el-icon> -->
</span>
<!-- <span class="absolute right-160px top-14px z-30 text-#000">最近7天数据</span> -->
<span class="absolute right-10px top-6px z-30 text-#000">
<el-radio-group v-model="cuType.type">
<el-radio-button label="SMM" value="cu0000" />
<el-radio-button label="LME" value="LME_CA_3M" />
</el-radio-group></span>
<div v-if="false && tab"
class="tab absolute bg-#fff w100px top-50px z-50 text-#112144 text-center leading-28px text-18px ">
<div v-if="metal"
v-for="im in metal.filter((item: any) => !['Fe', 'lengmei'].includes(item.value))"
class="py5px !rounded-none" :data-id="im.value" @click="tabClick">{{ im.title }}</div>
<!-- <div class="py5px !rounded-none" data-id="Fe" @click="tabClick">Fe</div>
<div class="py5px !rounded-none" data-id="Cu" @click="tabClick">Cu</div>
<div class="py5px !rounded-none" data-id="Re" @click="tabClick"></div> -->
</div>
<VChart class="absolute z-22 left-0 right-0 !w-full" ref="chartRef1" :option="chartOption1"
autoresize />
</div>
<!-- <div>
<span class="title bg-#70BFCD p5px pl10px !pr25px">AI</span>
<VChart class="absolute z-22" ref="chartRef2" :option="chartOption2" autoresize />
</div> -->
</div>
<div class="bgStyle !h250px mt10px">
<div class=" relative w100%">
<span class="title bg-#FF960F pl18px pr28px">{{ 'AI' }}
<!-- <el-icon><CaretBottom /></el-icon> -->
</span>
<!-- <span class="absolute right-160px top-14px z-30 text-#000">最近7天数据</span> -->
<span class="absolute right-10px top-6px z-30 text-#000">
<el-radio-group v-model="alType.type">
<el-radio-button label="SMM" value="al0000" />
<el-radio-button label="LME" value="LME_AH_3M" />
</el-radio-group></span>
<VChart class="absolute z-22 left-0 right-0 !w-full" ref="chartRef11" :option="chartOption11"
autoresize />
</div>
<!-- <div>
<span class="title bg-#70BFCD p5px pl10px !pr25px">AI</span>
<VChart class="absolute z-22" ref="chartRef2" :option="chartOption1" autoresize />
</div> -->
</div>
<div class="bgStyle !h240px mt10px">
<div>
<span class="title bg-#003BB7 !text-16px pl13px pr20px ">历年数据</span>
<VChart class=" absolute z-22" ref="chartRef5" :option="chartOption5" autoresize />
</div>
</div>
<div class="mt8px ml10px">
<div class="flex items-center w-45%">
<span class="text-#000 whitespace-nowrap">日期:</span>
<el-config-provider :locale="zhCn">
<el-date-picker v-model="value1" type="daterange" range-separator=""
start-placeholder="开始时间" end-placeholder="结束时间" size="small"
@change="timenFirst" /></el-config-provider>
</div>
<div class="flex justify-between items-center">
<el-radio-group v-model="from.label.radio" class="ml-4" @change="thisCka">
<el-radio v-if="metal" v-for="im in metal" :label="im.value" size="large">{{ im.title
}}</el-radio>
<!-- <el-radio label="Al" size="large" >Al</el-radio>
<el-radio label="Fe" size="large" >Fe</el-radio>
<el-radio label="Re" size="large" >稀土</el-radio> -->
</el-radio-group>
<el-popover placement="top-end" trigger="click"
:popper-style="{ width: '590px', borderRadius: '10px' }" :teleported="true">
<template #reference>
<div
class="bg-gr h-42px w115px flex justify-center items-center text-#fff rounded-10px text-18px cursor-pointer font-bold">
市况预测 <el-icon class="rotate-270deg">
<CaretBottom />
</el-icon></div>
</template>
<!-- <Teleport to="v-screen-box"> -->
<!-- <VScaleScreen
ref="fitscreenRef"
:width="1920"
:height="1080"
mode="fit"
> -->
<div class="bgStyle h-250px w-690px mt15px mb10px">
<div class="w-full">
<span class="title bg-#003BB7 !text-16px pl13px pr20px b">市况预测</span>
<!-- <el-button type="primary" v-if="userCode" class="button" @click="getUser(1)"></el-button> -->
<el-button type="primary" size="small" v-if="userCode" class="button !mr-2%"
@click="push({ name: 'MarketModifys' })">管理</el-button>
<p class="mt40px p15px !border-none max-h250px overflow-auto">
<p class="!border-none w-98% !flex items-center pb10px news-item !pr30rpx"
v-for="n in listDatas" :key="n">
<AppNewsBox class="flex-1 !border-none" :text="n.title" :date="n.createTime" />
<p class="flex-shrink flex !border-none w35px ml20px">
<el-button size="small" type="primary" @click="lokeFuck(n)"></el-button>
<!-- <el-button type="primary" @click="downloadFile(n)"></el-button> -->
</p>
</p>
</p>
</div>
</div>
<!-- </VScaleScreen> -->
<!-- </Teleport> -->
</el-popover>
</div>
</div>
<div v-if="false" class="mt8px ml10px">
<div class="flex justify-between items-center">
<el-popover placement="top-end" trigger="click"
:popper-style="{ width: '590px', borderRadius: '10px' }" :teleported="true">
<template #reference>
<div
class="bg-gr h-42px w115px ml-auto flex justify-center items-center text-#fff rounded-10px text-18px cursor-pointer font-bold">
市况预测 <el-icon class="rotate-270deg">
<CaretBottom />
</el-icon></div>
</template>
<!-- <Teleport to="v-screen-box"> -->
<!-- <VScaleScreen
ref="fitscreenRef"
:width="1920"
:height="1080"
mode="fit"
> -->
<div class="bgStyle !h-284px w-690px mt15px mb10px">
<div class="w-full">
<span class="title bg-#003BB7 !text-16px pl13px pr20px b">市况预测</span>
<!-- <el-button type="primary" v-if="userCode" class="button" @click="getUser(1)"></el-button> -->
<el-button type="primary" size="small" v-if="userCode" class="button !mr-2%"
@click="push({ name: 'MarketModifys' })">管理</el-button>
<p class="mt40px p15px !border-none max-h250px overflow-auto">
<p class="!border-none w-98% !flex items-center pb10px news-item !pr30rpx"
v-for="n in listDatas" :key="n">
<AppNewsBox class="flex-1 !border-none" :text="n.title" :date="n.createTime" />
<p class="flex-shrink flex !border-none w35px ml20px">
<el-button size="small" type="primary" @click="lokeFuck(n)"></el-button>
<!-- <el-button type="primary" @click="downloadFile(n)"></el-button> -->
</p>
</p>
</p>
</div>
</div>
<!-- </VScaleScreen> -->
<!-- </Teleport> -->
</el-popover>
</div>
</div>
</AppBlock>
<AppBlock class="flex-1 box">
<div class="box-title ">汇率</div>
<div class="bgStyle !h250px mt20px z-100">
<div class="mr25px">
<span @click="tabShow(1)" class="title bg-#FF603A !text-16px pl13px pr20px cursor-pointer !z-100">{{ names1
}}<el-icon>
<CaretBottom />
</el-icon></span>
<div v-if="tab1"
class="tab absolute bg-#fff w100px top-40px z-50 text-#112144 text-center leading-28px text-16px ">
<div v-if="currency" v-for="it in currency" class="py5px !rounded-none" :data-id="it.value"
@click="tabClick1">{{ it.title }}</div>
<!-- <div class="py5px !rounded-none" data-id="CNA,USD" @click="tabClick1">-</div>
<div class="py5px !rounded-none" data-id="JPY,USD" @click="tabClick1">-</div> -->
</div>
<VChart class=" absolute z-22" ref="chartRef3" :option="chartOption3" autoresize />
</div>
<div>
<span @click="tabShow(2)" class="title bg-#70BFCD !text-16px pl13px pr20px !z-100 cursor-pointer">{{ names2
}}<el-icon>
<CaretBottom />
</el-icon></span>
<div v-if="tab2"
class="tab absolute bg-#fff w100px top-40px z-50 text-#112144 text-center leading-28px text-16px ">
<div v-if="currency" v-for="it in currency" class="py5px !rounded-none" :data-id="it.value"
@click="tabClick2">{{ it.title }}</div>
<!-- <div class="py5px !rounded-none" data-id="CNA,USD" @click="tabClick2">-</div>
<div class="py5px !rounded-none" data-id="JPY,USD" @click="tabClick2">-</div> -->
</div>
<VChart class="absolute z-22" ref="chartRef4" :option="chartOption4" autoresize />
</div>
</div>
<div class="bgStyle !h250px mt10px">
<div>
<span class="title bg-#003BB7 !text-16px pl13px pr20px ">历年数据</span>
<VChart class=" absolute z-22" ref="chartRef6" :option="chartOption6" autoresize />
</div>
</div>
<div class="mt10px ml10px">
<div class="flex items-center w-45%">
<span class="text-#000 whitespace-nowrap">日期:</span>
<el-config-provider :locale="zhCn">
<el-date-picker v-model="value2" type="daterange" range-separator=""
start-placeholder="开始时间" end-placeholder="结束时间" size="small"
@change="timenFirsts" /></el-config-provider>
</div>
<div class="h-30px">
<el-radio-group v-model="from.labe2.radio" class="ml-4" @change="thisCka2">
<el-radio v-if="currency" v-for="it in currency" :label="it.value" size="large">{{ it.title
}}</el-radio>
<!-- <el-radio label="JPY,USD" size="large" >日元-美元</el-radio>
<el-radio label="CNA,USD" size="large" >人民币-美元</el-radio> -->
</el-radio-group>
</div>
</div>
<div class="bgStyle !h230px mt15px mb10px">
<div>
<span class="title bg-#003BB7 !text-16px pl13px pr20px ">汇率预测</span>
<!-- <el-button type="primary" v-if="userCode" class="button" @click="getUser(2)"></el-button> -->
<el-button type="primary" v-if="userCodes" class="button"
@click="push({ name: 'MarketModify' })">管理</el-button>
<p class="mt40px p15px !border-none max-h-full overflow-auto">
<p class="!border-none w615px !flex items-center pb10px news-item " v-for="n in listData"
:key="n">
<AppNewsBox class="flex-1 !border-none" :text="n.title" :date="n.createTime" />
<p class="flex-shrink flex !border-none w35px ml20px">
<el-button type="primary" @click="lokeFuck(n)"></el-button>
<!-- <el-button type="primary" @click="downloadFile(n)"></el-button> -->
</p>
</p>
</p>
</div>
</div>
</AppBlock>
</div>
</div>
<!-- <div style="width: 1200px; height:800px ; position: fixed; z-index: 100; top:50px;;">
</div> -->
<n-modal :mask-closable="true" v-model:show="showModalRef2">
<div class="w90% h90% ">
<Amtion :data="src" :datas="srcType" />
</div>
</n-modal>
<n-modal v-model:show="shomk">
<div class="py40px px30px bg-#fff">
<el-form :model="sdubList" label-width="120px" :inline="true">
<el-form-item label="标题">
<el-input v-model="sdubList.title" />
</el-form-item>
<br>
<el-form-item label="文件">
<el-upload v-model:file-list="sdubList.fileList" class="upload-demo" :headers="header"
action="/test-api/common/upload" :on-change="handleChange">
<el-button type="primary">选择文件</el-button>
</el-upload>
</el-form-item>
<br>
<br>
<el-form-item class="ml80px">
<el-button type="primary" @click="onSubmit"></el-button>
</el-form-item>
</el-form>
</div>
</n-modal>
<n-modal v-model:show="showModal">
<UserList :userDataList="setUserList" @clickChild="handleChild" @CloseThis="CloseThiss" />
</n-modal>
</template>
<style scoped lang="less">
.bg-gr {
background: linear-gradient(to left, #34A6D9 0%, #23D1C6 100%);
}
.button {
display: block;
float: right;
margin-right: 20px;
}
::-webkit-scrollbar {
width: 1px;
}
.top {
position: absolute;
right: 30px;
top: -92px;
}
.date-wrapper[data-v-c5c4f420] {
line-height: 1.5;
position: relative;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: middle;
color: #142142;
border: none;
}
.tab {
div:hover {
color: #0036BC;
}
}
.box {
padding: 23px 20px 0 20px;
.box-title {
font-size: 28px;
font-weight: 600;
position: relative;
padding-left: 24px;
color: black;
&::before {
content: " ";
display: block;
width: 8px;
height: 30px;
background-color: #003ab5;
position: absolute;
left: 0;
}
}
}
.bgStyle {
display: flex;
width: 100%;
height: 270px;
position: relative;
padding: 0 5px;
div {
flex: 1;
border: 1px solid rgb(236, 236, 236);
border-radius: 18px;
.title {
// width: 60px;
// height: 60px;
border-radius: 18px 0 50px 0;
color: aliceblue;
line-height: 40px;
font-size: 24px;
font-weight: 500;
z-index: 1;
position: absolute;
}
}
}
</style>

View File

@ -5,8 +5,9 @@ import HomeHead from '@/views/home/components/HomeHead.vue'
import { useMessage, NModal } from 'naive-ui'
import { useUserStore } from '@/stores/modules/user'
import UserList from '@/views/home/intelligence/process/UserPages.vue'
import { pickerOptions } from '@/utils/date'
import { getList, marketPreDelete,marketPreADD } from '@/api/daikin/base'
import { getList, marketPreDelete, marketPreADD } from '@/api/daikin/base'
const message = useMessage()
const store = useUserStore()
@ -15,7 +16,6 @@ const header = { 'token': store.user.token }
const dataA = ref([])
const editA = ref()
const shomkA = ref(false)
async function setDataFiles(arr, _row) {
@ -23,136 +23,155 @@ async function setDataFiles(arr, _row) {
arr.value = _row.map((i: { filePathList: { name: any; originalFileName: any }[] }) => {
if (i.filePathList && i.filePathList.length > 0) {
i.filePathList.forEach((file: { name: any; originalFileName: any }) => {
file.name = file.originalFileName;
});
file.name = file.originalFileName
})
}
return i
})
}
}
const type =ref(2)
const type = ref(2)
async function getDataA() {
const {data} = await getList({type:2})
dataA.value = data
// setDataFiles(dataArr);
const { data } = await getList({ type: 2 })
dataA.value = data
// setDataFiles(dataArr);
}
onMounted(async () => {
getDataA();
getDataA()
})
function computedName(title) {
let index = title.indexOf(".");
let index = title.indexOf('.')
if (index > -1) {
return title.slice(0, index - 1);
return title.slice(0, index - 1)
}
return title;
return title
}
async function onSubmitA(row: { id: any; fileList?: any; title?: any }) {
async function onSubmitA(row: {
id: any
fileList?: any
title?: any
isTop?: any
isPublish?: any
publishTime?: any
}) {
console.log(row, 555)
const { id, title } = row
const { id, title, isTop, isPublish, publishTime } = row
// let moduleId = 1;
let sendData= {}
if(!row.id){
sendData = { title,type:type.value,userIdList:userData.value };
if (row.fileList && row.fileList.length > 0) {
row.fileList.map(item => {
if(item.response) {
sendData.filePath = item.response.url;
// obj.title = title || computedName(item.response.originalFilename);
}
else {
sendData.filePath = item.url;
// obj.title = title || computedName(item.originalFilename);
}
})
let sendData = {}
if (!row.id) {
sendData = {
title,
type: type.value,
userIdList: userData.value,
isTop,
isPublish,
publishTime
}
if (row.fileList && row.fileList.length > 0) {
row.fileList.map((item) => {
if (item.response) {
sendData.filePath = item.response.url
// obj.title = title || computedName(item.response.originalFilename);
} else {
sendData.filePath = item.url
// obj.title = title || computedName(item.originalFilename);
}
})
}
} else {
sendData = {
id,
title,
type: type.value,
userIdList: userData.value,
isTop,
isPublish,
publishTime
}
}
console.log(sendData)
const { code, msg } = await marketPreADD(sendData)
if (code === 200) {
message.success('修改成功!')
} else {
message.error(msg)
}
}
else{
sendData = {id, title,type:type.value,userIdList:userData.value };
}
console.log(sendData)
const {code,msg} = await marketPreADD(sendData)
if (code === 200) { message.success("修改成功!") }
else { message.error(msg) }
shomkA.value = false
getDataA();
getDataA()
}
const handleEditA = (type: string, row: any) => {
console.log(row)
editA.value = {
title: '',
fileList: [],
fileList: []
}
setUserList.value =[]
setUserList.value = []
shomkA.value = true
if (!row) return
editA.value = row
editA.value.fileList = [{
name: row.title,
originalFilename: row.title,
url: row.filePath,
}]
setUserList.value =row.userIdList
editA.value.fileList = [
{
name: row.title,
originalFilename: row.title,
url: row.filePath
}
]
setUserList.value = row.userIdList
}
async function handleDeleteA(index: number, row: any) {
const { id } = row
if (!id) return
const { code, msg } = await marketPreDelete({ id,type:type.value })
if (code === 200) { message.success("删除成功!") }
else { message.error(msg) }
getDataA();
const { code, msg } = await marketPreDelete({ id, type: type.value })
if (code === 200) {
message.success('删除成功!')
} else {
message.error(msg)
}
getDataA()
}
const activeName = ref("first")
const activeName = ref('first')
const userList = ref()
const showModal = ref(false)
const flg = ref()
const setUserList =ref()
const setUserList = ref()
async function getUser(row) {
console.log(row)
showModal.value = !showModal.value
flg.value = row
if(row.id&&row.userIdList){
if (row.id && row.userIdList) {
setUserList.value = row.userIdList
}
// const {data: userArr} = await getBPCUser({moduleId})
// setUserList.value = userArr
}
//
const userData = ref()
const handleChild = (data: any) => {
console.log(data, 444);
const { showModal: show, multipleSelection } = data
showModal.value = unref(show)
let userIdList: any[] =[]
multipleSelection.value.forEach((i: { userId: any })=>{
userIdList.push(i.userId)
})
if(flg.value.id){
flg.value.userIdList = userIdList
marketPreADD(flg.value)
getDataA();
console.log(flg.value)
}
userData.value = userIdList
//
const userData = ref()
const handleChild = (data: any) => {
console.log(data, 444)
const { showModal: show, multipleSelection } = data
showModal.value = unref(show)
let userIdList: any[] = []
multipleSelection.value.forEach((i: { userId: any }) => {
userIdList.push(i.userId)
})
if (flg.value.id) {
flg.value.userIdList = userIdList
marketPreADD(flg.value)
getDataA()
console.log(flg.value)
}
const CloseThiss = (data: boolean)=>{
showModal.value = data
}
userData.value = userIdList
}
const CloseThiss = (data: boolean) => {
showModal.value = data
}
</script>
<template>
<HomeHead class="top">
@ -165,16 +184,25 @@ async function getUser(row) {
<!-- <img src="./images/logo.svg" class="h56px mr21px" /> -->
<div class="text-36px text-#000">汇率内容管理</div>
</div>
<div class=" cont relative w100% h800px overflow-y-auto">
<el-button type="primary" @click="handleEditA" class="my20px">汇率内容新增</el-button>
<el-table :data="dataA" style="width: 95%"
:header-cell-style="{ background: '#2A7BF7', color: '#fff', height: '60px', textAlign: 'center', 'font-size': '24px' }"
:cell-style="{ 'text-align': 'center' }">
<!-- <el-table-column label="级别" prop="status" /> -->
<el-table-column label="名称" prop="title" />
<!--
<div class="cont relative w100% h800px overflow-y-auto">
<el-button type="primary" @click="handleEditA" class="my20px">汇率内容新增</el-button>
<el-table
:data="dataA"
style="width: 95%"
:header-cell-style="{
background: '#2A7BF7',
color: '#fff',
height: '60px',
textAlign: 'center',
'font-size': '24px'
}"
:cell-style="{ 'text-align': 'center' }"
>
<!-- <el-table-column label="级别" prop="status" /> -->
<el-table-column label="名称" prop="title" />
<!--
<el-table-column label="文件列表" prop="filePathList">
<template #default="scope">
<div v-if="scope.row.filePathList" v-for="(it, index) in scope.row.filePathList">
@ -184,22 +212,24 @@ async function getUser(row) {
</template>
</el-table-column> -->
<el-table-column label="查看范围" prop="userIdList">
<template #default="scope">
<!-- <el-button type="primary" class="button" @click="getUser(scope.row)"></el-button> -->
<span v-if="scope.row.userIdList" v-for="it in scope.row.userIdList"> &nbsp;&nbsp; {{it.nickName}}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="180px">
<template #default="scope">
<el-button size="small" @click="handleEditA('edit', scope.row)">编辑</el-button>
<el-button size="small" type="danger" @click="handleDeleteA(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<el-table-column label="查看范围" prop="userIdList">
<template #default="scope">
<!-- <el-button type="primary" class="button" @click="getUser(scope.row)"></el-button> -->
<span v-if="scope.row.userIdList" v-for="it in scope.row.userIdList">
&nbsp;&nbsp; {{ it.nickName }}</span
>
</template>
</el-table-column>
<el-table-column label="操作" width="180px">
<template #default="scope">
<el-button size="small" @click="handleEditA('edit', scope.row)">编辑</el-button>
<el-button size="small" type="danger" @click="handleDeleteA(scope.$index, scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</div>
</AppBlock>
<n-modal v-model:show="shomkA">
@ -212,30 +242,71 @@ async function getUser(row) {
<el-radio label="New" size="large">New</el-radio>
</el-radio-group>
</el-form-item> -->
<br>
<br />
<el-form-item label="标题">
<el-input v-model="editA.title" />
</el-form-item>
<br>
<br />
<el-form-item label="查看范围">
<el-button class="button" @click="getUser(2)"></el-button>
<el-button class="button" @click="getUser(2)"></el-button>
</el-form-item>
<br>
<br />
<el-form-item label="文件">
<el-upload v-model:file-list="editA.fileList" class="upload-demo" :headers="header"
action="/test-api/common/upload" multiple :limit="editA.type == 'add' ? 3 : 1" :on-exceed="handleExceed">
<el-upload
v-model:file-list="editA.fileList"
class="upload-demo"
:headers="header"
action="/test-api/common/upload"
multiple
:limit="editA.type == 'add' ? 3 : 1"
:on-exceed="handleExceed"
>
<el-button type="primary">选择文件</el-button>
</el-upload>
</el-form-item>
<br />
<el-form-item label="是否置顶">
<el-switch
v-model="editA.isTop"
active-text="置顶"
inactive-text="不置顶"
:inactive-value="0"
:active-value="1"
></el-switch>
</el-form-item>
<br />
<el-form-item label="是否定时发送">
<el-switch
v-model="editA.isPublish"
active-text="是"
inactive-text="否"
:inactive-value="0"
:active-value="1"
@change="(val) => (editA.publishTime = val ? pickerOptions.day : '')"
></el-switch>
</el-form-item>
<br />
<el-form-item label="发布时间" v-if="editA.isPublish == 1">
<el-date-picker
v-model="editA.publishTime"
align="right"
type="date"
placeholder="选择日期"
:disabledDate="pickerOptions.disabledDate"
:shortcuts="pickerOptions.shortcuts"
:value-format="pickerOptions.valueFormat"
>
</el-date-picker>
</el-form-item>
</el-form>
<hr class="mb15px border-#f1f1f1">
<hr class="mb15px border-#f1f1f1" />
<el-button class="flex-center" type="primary" @click="onSubmitA(editA)"></el-button>
</div>
</n-modal>
<n-modal v-model:show="showModal">
<UserList :userDataList="setUserList" @clickChild="handleChild" @CloseThis="CloseThiss"/>
<UserList :userDataList="setUserList" @clickChild="handleChild" @CloseThis="CloseThiss" />
</n-modal>
</template>
@ -255,4 +326,4 @@ async function getUser(row) {
justify-content: center;
margin: 0 auto;
}
</style>
</style>

View File

@ -5,8 +5,8 @@ import HomeHead from '@/views/home/components/HomeHead.vue'
import { useMessage, NModal } from 'naive-ui'
import { useUserStore } from '@/stores/modules/user'
import UserList from '@/views/home/intelligence/process/UserPages.vue'
import { getList, marketPreDelete,marketPreADD } from '@/api/daikin/base'
import { pickerOptions } from '@/utils/date'
import { getList, marketPreDelete, marketPreADD } from '@/api/daikin/base'
const message = useMessage()
const store = useUserStore()
@ -15,7 +15,6 @@ const header = { 'token': store.user.token }
const dataA = ref([])
const editA = ref()
const shomkA = ref(false)
async function setDataFiles(arr, _row) {
@ -23,135 +22,154 @@ async function setDataFiles(arr, _row) {
arr.value = _row.map((i: { filePathList: { name: any; originalFileName: any }[] }) => {
if (i.filePathList && i.filePathList.length > 0) {
i.filePathList.forEach((file: { name: any; originalFileName: any }) => {
file.name = file.originalFileName;
});
file.name = file.originalFileName
})
}
return i
})
}
}
const type =ref(1)
const type = ref(1)
async function getDataA() {
const {data} = await getList({type:1})
dataA.value = data
// setDataFiles(dataArr);
const { data } = await getList({ type: 1 })
dataA.value = data
// setDataFiles(dataArr);
}
onMounted(async () => {
getDataA();
getDataA()
})
function computedName(title) {
let index = title.indexOf(".");
let index = title.indexOf('.')
if (index > -1) {
return title.slice(0, index - 1);
return title.slice(0, index - 1)
}
return title;
return title
}
async function onSubmitA(row: { id: any; fileList?: any; title?: any }) {
async function onSubmitA(row: {
id: any
fileList?: any
title?: any
isTop?: any
isPublish?: any
publishTime?: any
}) {
console.log(row, 555)
const { id, title } = row
const { id, title, isTop, isPublish, publishTime } = row
// let moduleId = 1;
let sendData= {}
if(!row.id){
sendData = { title,type:type.value,userIdList:userData.value };
if (row.fileList && row.fileList.length > 0) {
row.fileList.map(item => {
if(item.response) {
sendData.filePath = item.response.url;
// obj.title = title || computedName(item.response.originalFilename);
}
else {
sendData.filePath = item.url;
// obj.title = title || computedName(item.originalFilename);
}
})
let sendData = {}
if (!row.id) {
sendData = {
title,
type: type.value,
userIdList: userData.value,
isTop,
isPublish,
publishTime
}
if (row.fileList && row.fileList.length > 0) {
row.fileList.map((item) => {
if (item.response) {
sendData.filePath = item.response.url
// obj.title = title || computedName(item.response.originalFilename);
} else {
sendData.filePath = item.url
// obj.title = title || computedName(item.originalFilename);
}
})
}
} else {
sendData = {
id,
title,
type: type.value,
userIdList: userData.value,
isTop,
isPublish,
publishTime
}
}
console.log(sendData)
const { code, msg } = await marketPreADD(sendData)
if (code === 200) {
message.success('修改成功!')
} else {
message.error(msg)
}
}
else{
sendData = {id, title,type:type.value,userIdList:userData.value };
}
console.log(sendData)
const {code,msg} = await marketPreADD(sendData)
if (code === 200) { message.success("修改成功!") }
else { message.error(msg) }
shomkA.value = false
getDataA();
getDataA()
}
const handleEditA = (type: string, row: any) => {
console.log(row)
editA.value = {
title: '',
fileList: [],
fileList: []
}
setUserList.value =[]
setUserList.value = []
shomkA.value = true
if (!row) return
editA.value = row
editA.value.fileList = [{
name: row.title,
originalFilename: row.title,
url: row.filePath,
}]
setUserList.value =row.userIdList
editA.value.fileList = [
{
name: row.title,
originalFilename: row.title,
url: row.filePath
}
]
setUserList.value = row.userIdList
}
async function handleDeleteA(index: number, row: any) {
const { id } = row
if (!id) return
const { code, msg } = await marketPreDelete({ id,type:type.value })
if (code === 200) { message.success("删除成功!") }
else { message.error(msg) }
getDataA();
const { code, msg } = await marketPreDelete({ id, type: type.value })
if (code === 200) {
message.success('删除成功!')
} else {
message.error(msg)
}
getDataA()
}
const activeName = ref("first")
const activeName = ref('first')
const userList = ref()
const showModal = ref(false)
const flg = ref()
const setUserList =ref()
const setUserList = ref()
async function getUser(row) {
console.log(row)
showModal.value = !showModal.value
flg.value = row
if(row.id&&row.userIdList){
if (row.id && row.userIdList) {
setUserList.value = row.userIdList
}
// const {data: userArr} = await getBPCUser({moduleId})
// setUserList.value = userArr
}
//
const userData = ref()
const handleChild = (data: any) => {
console.log(data, 444);
const { showModal: show, multipleSelection } = data
showModal.value = unref(show)
let userIdList: any[] =[]
multipleSelection.value.forEach((i: { userId: any })=>{
userIdList.push(i.userId)
})
if(flg.value.id){
flg.value.userIdList = userIdList
console.log(flg.value)
marketPreADD(flg.value)
}
userData.value = userIdList
//
const userData = ref()
const handleChild = (data: any) => {
console.log(data, 444)
const { showModal: show, multipleSelection } = data
showModal.value = unref(show)
let userIdList: any[] = []
multipleSelection.value.forEach((i: { userId: any }) => {
userIdList.push(i.userId)
})
if (flg.value.id) {
flg.value.userIdList = userIdList
console.log(flg.value)
marketPreADD(flg.value)
}
const CloseThiss = (data: boolean)=>{
showModal.value = data
}
userData.value = userIdList
}
const CloseThiss = (data: boolean) => {
showModal.value = data
}
</script>
<template>
<HomeHead class="top">
@ -164,16 +182,25 @@ async function getUser(row) {
<!-- <img src="./images/logo.svg" class="h56px mr21px" /> -->
<div class="text-36px text-#000">市况内容管理</div>
</div>
<div class=" cont relative w100% h800px overflow-y-auto">
<el-button type="primary" @click="handleEditA('add')" class="my20px">市况内容新增</el-button>
<el-table :data="dataA" style="width: 95%"
:header-cell-style="{ background: '#2A7BF7', color: '#fff', height: '60px', textAlign: 'center', 'font-size': '24px' }"
:cell-style="{ 'text-align': 'center' }">
<!-- <el-table-column label="级别" prop="status" /> -->
<el-table-column label="名称" prop="title" />
<!--
<div class="cont relative w100% h800px overflow-y-auto">
<el-button type="primary" @click="handleEditA('add')" class="my20px">市况内容新增</el-button>
<el-table
:data="dataA"
style="width: 95%"
:header-cell-style="{
background: '#2A7BF7',
color: '#fff',
height: '60px',
textAlign: 'center',
'font-size': '24px'
}"
:cell-style="{ 'text-align': 'center' }"
>
<!-- <el-table-column label="级别" prop="status" /> -->
<el-table-column label="名称" prop="title" />
<!--
<el-table-column label="文件列表" prop="filePathList">
<template #default="scope">
<div v-if="scope.row.filePathList" v-for="(it, index) in scope.row.filePathList">
@ -183,22 +210,24 @@ async function getUser(row) {
</template>
</el-table-column> -->
<el-table-column label="查看范围" prop="userIdList">
<template #default="scope">
<!-- <el-button type="primary" class="button" @click="getUser(scope.row)"></el-button> -->
<span v-if="scope.row.userIdList" v-for="it in scope.row.userIdList">&nbsp;&nbsp;{{it.nickName}}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="180px">
<template #default="scope">
<el-button size="small" @click="handleEditA('edit', scope.row)">编辑</el-button>
<el-button size="small" type="danger" @click="handleDeleteA(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<el-table-column label="查看范围" prop="userIdList">
<template #default="scope">
<!-- <el-button type="primary" class="button" @click="getUser(scope.row)"></el-button> -->
<span v-if="scope.row.userIdList" v-for="it in scope.row.userIdList"
>&nbsp;&nbsp;{{ it.nickName }}</span
>
</template>
</el-table-column>
<el-table-column label="操作" width="180px">
<template #default="scope">
<el-button size="small" @click="handleEditA('edit', scope.row)">编辑</el-button>
<el-button size="small" type="danger" @click="handleDeleteA(scope.$index, scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</div>
</AppBlock>
<n-modal v-model:show="shomkA">
@ -211,30 +240,71 @@ async function getUser(row) {
<el-radio label="New" size="large">New</el-radio>
</el-radio-group>
</el-form-item> -->
<br>
<br />
<el-form-item label="标题">
<el-input v-model="editA.title" />
</el-form-item>
<br>
<br />
<el-form-item label="查看范围">
<el-button class="button" @click="getUser(2)"></el-button>
<el-button class="button" @click="getUser(2)"></el-button>
</el-form-item>
<br>
<br />
<el-form-item label="文件">
<el-upload v-model:file-list="editA.fileList" class="upload-demo" :headers="header"
action="/test-api/common/upload" multiple :limit="editA.type == 'add' ? 3 : 1" :on-exceed="handleExceed">
<el-upload
v-model:file-list="editA.fileList"
class="upload-demo"
:headers="header"
action="/test-api/common/upload"
multiple
:limit="editA.type == 'add' ? 3 : 1"
:on-exceed="handleExceed"
>
<el-button type="primary">选择文件</el-button>
</el-upload>
</el-form-item>
<br />
<el-form-item label="是否置顶">
<el-switch
v-model="editA.isTop"
active-text="置顶"
inactive-text="不置顶"
:inactive-value="0"
:active-value="1"
></el-switch>
</el-form-item>
<br />
<el-form-item label="是否定时发送">
<el-switch
v-model="editA.isPublish"
active-text="是"
inactive-text="否"
:inactive-value="0"
:active-value="1"
@change="(val) => (editA.publishTime = val ? pickerOptions.day : '')"
></el-switch>
</el-form-item>
<br />
<el-form-item label="发布时间" v-if="editA.isPublish == 1">
<el-date-picker
v-model="editA.publishTime"
align="right"
type="date"
placeholder="选择日期"
:disabledDate="pickerOptions.disabledDate"
:shortcuts="pickerOptions.shortcuts"
:value-format="pickerOptions.valueFormat"
>
</el-date-picker>
</el-form-item>
</el-form>
<hr class="mb15px border-#f1f1f1">
<hr class="mb15px border-#f1f1f1" />
<el-button class="flex-center" type="primary" @click="onSubmitA(editA)"></el-button>
</div>
</n-modal>
<n-modal v-model:show="showModal">
<UserList :userDataList="setUserList" @clickChild="handleChild" @CloseThis="CloseThiss"/>
<UserList :userDataList="setUserList" @clickChild="handleChild" @CloseThis="CloseThiss" />
</n-modal>
</template>
@ -254,4 +324,4 @@ async function getUser(row) {
justify-content: center;
margin: 0 auto;
}
</style>
</style>

View File

@ -68,9 +68,17 @@ const num = ['', '第一周', '第二周', '第三周', '第四周', '第五周'
function groupDatesByWeek(dates = [], weekStartDay = 1) {
return dates.reduce((acc: any, item: any) => {
const date = dayjs(item.createTime)
const weekStart = date.startOf('week').add(weekStartDay, 'day').format('MM月DD日')
const weekday = date.day() // 01
//
const mondayDistance = (weekday + 6) % 7
//
const sundayDistance = 7 - mondayDistance - 1
//
const weekStart = date.subtract(mondayDistance, 'day').format('MM月DD日')
const weekEnd = date.add(sundayDistance, 'day').format('MM月DD日')
// const weekStart = date.startOf('week').add(weekStartDay, 'day').format('MMDD')
// const weekEnd = date.endOf('week').add(weekStartDay, 'day').format('MMDD')
item.date = date.format('YYYY-MM-DD')
const weekEnd = date.endOf('week').add(weekStartDay, 'day').format('MM月DD日')
const week = getWeekOfMonth(date)
const month = date.format('MM')
const key = `${+month}${num[week]} ${weekStart} - ${weekEnd} `
@ -132,7 +140,6 @@ const codePath = {
const goModule = (item, type) => {
const { moduleCode, id, cateId } = item
const { modulePath, path } = codePath[moduleCode]
console.log('🚀 ~ file: News.vue:128 ~ modulePath, path:', modulePath, path)
if (modulePath) {
if (type === 'module') {
push(modulePath)

View File

@ -4,6 +4,10 @@ import HomeHead from '@/views/home/components/HomeHead.vue'
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import { useDate } from '@/views/home/hooks/useDate'
// import { NTimeline, NTimelineItem } from 'naive-ui'
import { useUserStore } from '@/stores/modules/user'
import { fetchContactList } from '@/api/daikin/base'
import { groupBy } from 'lodash-es'
const store = useUserStore()
const { day, week } = useDate()
const { push } = useRouter()
@ -46,6 +50,25 @@ let flag = ref(false)
const switchImg = () => {
flag.value = !flag.value
}
const userCode = ref(false)
watchEffect(() => {
userCode.value = ['admin', 'cd_dandang', 'tech_service'].some((item) =>
store.user.roleCode?.includes(item)
)
})
const contactList = ref<any>([])
const fetchDataList = async () => {
const { rows = [] } = await fetchContactList({
pageNum: 1,
pageSize: 1000
})
contactList.value = rows
console.log('🚀 ~ file: index.vue:68 ~ rows:', groupBy(rows, 'type'))
}
fetchDataList()
</script>
<template>
@ -74,21 +97,38 @@ const switchImg = () => {
</div>
</div>
</div> -->
<div class="mt30px mr20px flex w100% relative overflow-hidden">
<div class="mt20px flex w100% relative pt-40px overflow-hidden">
<!-- <el-button
v-if="userCode"
type="primary"
class="button absolute top-0px right-50px"
@click="push({ name: 'phoneManage' })"
>数据管理</el-button
> -->
<!-- <img src="../../../assets/images/fzqiet3.png" class="w100%" /> -->
<img
src="../../../assets/images/jjllt.jpg"
class="w100% transition-all duration-500"
:class="flag ? '-translate-x-full' : ''"
/>
<img
src="../../../assets/images/jjllt-right.jpg"
class="w100% transition-all duration-500"
:class="flag ? '-translate-x-full' : ''"
/>
<div class="h-full overflow-hidden w-1500px flex items-center">
<div
class="w-1500px h-full transition-all duration-500 ease-out relative"
:class="flag ? '-translate-x-full' : 'mr0px'"
>
<img src="../../../assets/images/jjllt.jpg" class="w-1500px h-90%" />
<view
class="absolute top-24px right-40px w-300px h30px z-2 bg-#ffffff text-#000 text-end leading-30px text-18px font font-600"
>
更新日{{ new Date().toLocaleDateString() }}
</view>
</div>
<div
class="!w-1500px !h-full transition-all duration-500 ease-out relative"
:class="flag ? '-translate-x-full' : ''"
>
<img src="../../../assets/images/jjllt-right.jpg" class="!w-1500px !h-full" />
</div>
</div>
<!-- 56px -->
<div
@click="switchImg"
class="absolute top-56px right-40px w-300px h50px z-10 cursor-pointer"
class="absolute top-96px right-40px w-300px h50px z-10 cursor-pointer"
></div>
</div>
</template>
@ -100,6 +140,10 @@ const switchImg = () => {
top: -92px;
}
.font {
font-family: '微软雅黑', 'Microsoft YaHei', sans-serif;
}
.g-wrapper {
border-radius: 18px;
border: 1px solid #e7ebf5;

View File

@ -0,0 +1,406 @@
<script setup lang="ts">
import AppBlock from '@/components/AppBlock.vue'
import HomeHead from '@/views/home/components/HomeHead.vue'
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import { useMessage, NModal } from 'naive-ui'
import { useUserStore } from '@/stores/modules/user'
import UserList from '@/views/home/intelligence/process/UserPages.vue'
import dayjs from 'dayjs'
import {
fetchDelHis,
marketPreADD,
getMetalList,
fetchGetHisPage,
fetchUpdateHis,
fetchSaveHis,
fetchContactList,
fetchContactEdit,
fetchContactDel,
fetchContactAdd
} from '@/api/daikin/base'
const message = useMessage()
const store = useUserStore()
const header = { token: store.user.token }
const pageInfo = reactive({
currentPage: 1,
pageSize: 15,
total: 0
})
const dataA = ref<any>([])
const editA = ref<any>({})
const metaList = ref<any>([])
const metaObj = ref<any>({})
const stDateList = ref<any>([])
const shomkA = ref(false)
const type = ref(2)
async function getDataA() {
const { data } = await fetchGetHisPage({})
dataA.value = Object.entries(data).map(([key, value]: any) => {
return {
stDate: key,
yearId: key,
children: value.map((item: any) => {
return {
...item,
numbers: metaObj.value[item.number]
}
})
}
})
// setDataFiles(dataArr);
}
onMounted(async () => {
// const { data = [] } = await getMetalList()
// metaList.value = data
// data.forEach((item: any) => {
// metaObj.value[item.value] = item.title
// })
// getDataA()
fetchDataList()
})
const contactList = ref<any>([])
const fetchDataList = async () => {
const { rows = [] } = await fetchContactList({
pageNum: pageInfo.currentPage,
pageSize: pageInfo.pageSize
})
contactList.value = rows
console.log('🚀 ~ file: manage.vue:66 ~ data:', rows)
}
async function onSubmitA(row: { id: any; fileList?: any; title?: any }) {
console.log(row, 555)
const { id, title } = row
// let moduleId = 1;
let sendData = {}
if (!row.id) {
sendData = { title, type: type.value, userIdList: userData.value }
if (row.fileList && row.fileList.length > 0) {
row.fileList.map((item) => {
if (item.response) {
sendData.filePath = item.response.url
// obj.title = title || computedName(item.response.originalFilename);
} else {
sendData.filePath = item.url
// obj.title = title || computedName(item.originalFilename);
}
})
}
} else {
sendData = { id, title, type: type.value, userIdList: userData.value }
}
const { code, msg } = await marketPreADD(sendData)
if (code === 200) {
message.success('修改成功!')
} else {
message.error(msg)
}
shomkA.value = false
getDataA()
}
const handleEditA = (type: string, row: any = { type: 1 }) => {
if (!row) return
editA.value = { ...row }
// editA.value.stDateList = [row.stDate, row.stDate]
// stDateList.value = [row.stDate, row.stDate]
// setUserList.value =[]
shomkA.value = true
// editA.value.fileList = [{
// name: row.title,
// originalFilename: row.title,
// url: row.filePath,
// }]
// setUserList.value =row.userIdList
}
async function handleDeleteA(index: number, row: any) {
const { id } = row
if (!id) return
const { code, msg } = await fetchContactDel(id)
if (code === 200) {
message.success('删除成功!')
} else {
message.error(msg)
}
fetchDataList()
}
const showModal = ref(false)
const flg = ref()
const setUserList = ref()
async function getUser(row) {
console.log(row)
showModal.value = !showModal.value
flg.value = row
if (row.id && row.userIdList) {
setUserList.value = row.userIdList
}
// const {data: userArr} = await getBPCUser({moduleId})
// setUserList.value = userArr
}
//
const userData = ref()
const handleChild = (data: any) => {
const { showModal: show, multipleSelection } = data
showModal.value = unref(show)
let userIdList: any[] = []
multipleSelection.value.forEach((i: { userId: any }) => {
userIdList.push(i.userId)
})
if (flg.value.id) {
flg.value.userIdList = userIdList
marketPreADD(flg.value)
getDataA()
console.log(flg.value)
}
userData.value = userIdList
}
const CloseThiss = (data: boolean) => {
showModal.value = data
}
const goBacks = () => {
history.back()
}
const editForm = ref(null)
const channelList = ref([
{
label: 'LME',
value: 'LME'
},
{
label: 'SMM',
value: 'SMM'
}
])
const handleClickA = async () => {
const req = { ...editA.value }
let flag = false
try {
} catch (error) {}
if (!req.type) {
message.error('请选择部门')
return
}
req.dept = typeList.find((i) => i.value == req.type)?.label
let res: any = req.id ? await fetchContactEdit(req) : await fetchContactAdd(req)
if (res.code == 200) {
shomkA.value = false
message.success('操作成功!')
fetchDataList()
} else {
message.error(res.msg)
}
}
function generateDateRange() {
const [startDate, endDate] = stDateList.value || []
if (!startDate || !endDate) return []
const dateFormat = 'YYYY-MM-DD'
const dates = []
const start = dayjs(startDate, dateFormat)
const end = dayjs(endDate, dateFormat)
//
dates.push(start.format(dateFormat))
//
let currentDate = start
while (currentDate.isSameOrBefore(end)) {
currentDate = currentDate.add(1, 'day')
dates.push(currentDate.format(dateFormat))
}
return dates
}
// 1 2: DSZ 3: DISH
const typeList = [
{
label: '调达本部',
value: 1
},
{
label: 'DSZ',
value: 2
},
{
label: 'DISH',
value: 3
}
]
const handleClose = (tag: any) => {
editA.value = { type: 1 }
}
</script>
<template>
<HomeHead class="top">
<template #content>
<!-- <HomeHeadSearch /> -->
</template>
</HomeHead>
<AppBlock class="w-full h-full p30px text-#000">
<div class="font-600 flex items-center">
<!-- <img src="./images/logo.svg" class="h56px mr21px" /> -->
<div class="text-36px text-#000">紧急联络人-数据管理</div>
</div>
<div class="cont relative w100% h900px overflow-y-auto">
<el-button type="primary" @click="handleEditA" class="my20px">新增紧急联络人</el-button>
<div
class="rounded-md cursor-pointer float-right mr-30px mt-20px px20px py10px z-200 bg-#f5f5f5 flex items-center justify-center w-100px"
@click="goBacks"
>
<el-icon><ArrowLeftBold size="18" /></el-icon>
</div>
<el-table
:data="contactList"
style="width: 100%"
:header-cell-style="{
background: '#2A7BF7',
color: '#fff',
height: '60px',
textAlign: 'center',
'font-size': '24px'
}"
:cell-style="{ 'text-align': 'center' }"
height="740px"
>
<el-table-column label="部门" prop="dept" />
<el-table-column label="职位" prop="position" />
<el-table-column label="姓名" prop="realname" />
<el-table-column label="手机号" prop="mobile" />
<el-table-column label="行号" prop="rowIndex" />
<el-table-column label="排序" prop="sort" />
<el-table-column label="创建时间" prop="createTime">
<template #default="{ row }">
{{ dayjs(row.createTime).format('YYYY-MM-DD') }}
</template>
</el-table-column>
<!-- <el-table-column label="查看范围" prop="userIdList">
<template #default="scope">
<span v-if="scope.row.userIdList" v-for="it in scope.row.userIdList"> &nbsp;&nbsp; {{it.nickName}}</span>
</template>
</el-table-column> -->
<el-table-column label="操作" width="180px">
<template #default="scope">
<template v-if="!scope.row.children?.length">
<el-button size="small" @click="handleEditA('edit', scope.row)">编辑</el-button>
<el-button size="small" type="danger" @click="handleDeleteA(scope.$index, scope.row)"
>删除</el-button
>
</template>
</template>
</el-table-column>
</el-table>
<div class="absolute bottom-50px left-50% translate-x-[-50%] z-11">
<el-pagination
background
v-model:current-page="pageInfo.currentPage"
v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, total,jumper,->"
:total="pageInfo.total"
@current-change="fetchDataList"
/>
<!-- @size-change="handleSizeChange" -->
</div>
</div>
</AppBlock>
<el-dialog
:z-index="200"
v-model="shomkA"
title=" "
width="30%"
:modal="false"
top="30vh"
@close="handleClose"
>
<div class="bg-#FFF">
<el-form ref="editForm" :model="editA" label-width="100px" size="large">
<el-form-item label="部门" prop="dept">
<!-- <el-input v-model="editA.dept" placeholder="请输入部门"></el-input> -->
<el-select v-model="editA.type" placeholder="选择部门" class="!w-100%">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<br />
<el-form-item label="职位" prop="position">
<el-input v-model="editA.position" placeholder="请输入职位"></el-input>
</el-form-item>
<br />
<el-form-item label="姓名" prop="position">
<el-input v-model="editA.realname" placeholder="请输入职位"></el-input>
</el-form-item>
<br />
<el-form-item label="手机号" prop="mobile">
<el-input v-model="editA.mobile" placeholder="请输入手机号"></el-input>
</el-form-item>
<br />
<el-form-item label="行号" prop="rowIndex">
<el-input-number v-model="editA.rowIndex" :controls="false" class="!w-100%" />
<!-- <el-input v-model="editA.rowIndex" placeholder="请输入行号"></el-input> -->
</el-form-item>
<br />
<el-form-item label="排序" prop="sort">
<el-input-number v-model="editA.sort" :controls="false" class="!w-100%" />
<!-- <el-input v-model="editA.sort" placeholder="请输入排序"></el-input> -->
</el-form-item>
<br />
<div class="text-center">
<el-button type="" @click="shomkA = false" class="mb-20px !mr-50rpx"> 取消</el-button>
<el-button type="primary" @click="handleClickA(editA)" class="mb-20px"> 确认</el-button>
</div>
</el-form>
</div>
</el-dialog>
<n-modal v-model:show="showModal">
<UserList :userDataList="setUserList" @clickChild="handleChild" @CloseThis="CloseThiss" />
</n-modal>
</template>
<style lang="less" scoped>
.demo-tabs > .el-tabs__content {
color: #6b778c;
font-size: 32px;
font-weight: 600;
}
.top {
position: absolute;
right: 30px;
top: -92px;
}
.flex-center {
display: flex;
justify-content: center;
margin: 0 auto;
}
:deep(.el-input-number .el-input__inner) {
text-align: left !important;
}
:deep {
.el-dialog__body {
margin-top: 18px;
padding-top: 10px;
}
}
</style>

View File

@ -1,65 +1,76 @@
import * as echarts from "echarts";
import {topStat} from '@/api/daikin/base'
import {getPreviousMonths} from '@/utils/format'
import * as echarts from 'echarts'
import { topStat } from '@/api/daikin/base'
import { getPreviousMonths } from '@/utils/format'
function formatDate(inputDate: string) {
const dateRegex = /^(\d{4})-(\d{2})$/
const match = inputDate.match(dateRegex)
const dateRegex = /^(\d{4})-(\d{2})$/
const match = inputDate.match(dateRegex)
if (match) {
const year = match[1]
let month = match[2]
if (month.startsWith('0')) {
month = month.substring(1)
}
return `${year}${month}`
} else {
return inputDate
}
if (match) {
const year = match[1]
let month = match[2]
if (month.startsWith('0')) {
month = month.substring(1)
}
return `${year}${month}`
} else {
return inputDate
}
}
export function useChart21() {
const chartRef = ref()
const optionRef = ref()
getData()
async function getData() {
const { data } = await topStat()
const chartRef = ref()
const optionRef = ref()
getData()
async function getData() {
const { data } = await topStat()
const option = {
legend: {},
title: {
text: '件',
textStyle: { fontSize: 14, fontWeight: 500 },
subtext: '数',
subtextStyle: { fontSize: 14, fontWeight: 500, color: '#000' },
top: '45%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
animation: false
}
},
grid: {
left: '6%',
right: '4%',
bottom: '5%',
containLabel: true
},
yAxis: {
type: 'value',
show: true
},
xAxis: {
type: 'category',
data: data[0]?.month
? data[0].month.map((item: any) => {
return formatDate(item)
})
: []
},
series: data
}
optionRef.value = option
}
return { chartRef, option: optionRef }
}
const option = {
legend: {
orient: 'vertical',
right: 0,
top: '40%',
itemgrap: 10,
textStyle: {
width: 50,
overflow: 'break'
},
itemStyle: {}
},
title: {
text: '件',
textStyle: { fontSize: 14, fontWeight: 500 },
subtext: '数',
subtextStyle: { fontSize: 14, fontWeight: 500, color: '#000' },
top: '45%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
animation: false
}
},
grid: {
top: '5%',
left: '6%',
right: '24%',
bottom: '5%',
containLabel: true
},
yAxis: {
type: 'value',
show: true
},
xAxis: {
type: 'category',
data: data[0]?.month
? data[0].month.map((item: any) => {
return formatDate(item)
})
: []
},
series: data
}
optionRef.value = option
}
return { chartRef, option: optionRef }
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -148,11 +148,11 @@ function getFileNameFromUrl(url: string) {
}
const goModule = (item, type) => {
const { moduleCode, id } = item
const { moduleCode, id, cateId } = item
const { modulePath, path } = codePath[moduleCode]
if (modulePath) {
if (type === 'module') {
push(modulePath)
moduleCode === 'App_Database' ? push(modulePath + `?id=${cateId}`) : push(modulePath)
} else {
push(path + id)
}

View File

@ -6,6 +6,7 @@ import { NModal, NPopover } from 'naive-ui'
import { useUserStore } from '@/stores/modules/user'
import Searchs from '@/components/search.vue'
import { report, treeDbList } from '@/api/daikin/base'
// import axios from 'axios'
useTitle('大金中国调达本部 HOMEPAGE')
const { push } = useRouter()
const store = useUserStore()
@ -69,7 +70,8 @@ const Menus = ref([
{
key: 'YCWZ',
name: '调达本部才望子',
link: 'http://172.31.119.37/scripts/cbgrn/grn.exe/portal/index'
isClick: true
// link: 'http://172.31.119.37/scripts/cbgrn/grn.exe/portal/index'
},
{
key: 'GCDB',
@ -112,8 +114,10 @@ async function getDbTree() {
getDbTree()
let flag = false
const onClick = ref(false)
function menuHandler(menu: any, index: number) {
activeMenuKey.value = menu.key
onClick.value = true
console.log(menu, index)
if (menu.key === 'DataBase' && idx.value === index) {
report({ moduleCode: 'App_Database' })
@ -143,6 +147,14 @@ function menuHandler(menu: any, index: number) {
}
push({ name: menu.key })
}
const handleExpand = (m, index) => {
if (m.key === activeMenuKey.value) {
onClick.value = !onClick.value
} else {
menuHandler(m, index)
}
}
const shorm = ref(false)
const { path } = useRoute()
@ -156,6 +168,10 @@ watchEffect(() => {
}, 0)
})
function goChild(menu: any) {
if (menu.isClick) {
goUrl()
return
}
activeItem = menu.key
if (menu.key === 'CODE') {
shorm.value = true
@ -166,6 +182,15 @@ function goChild(menu: any) {
push({ name: menu.key, query: menu.params || {} })
}
}
const goUrl = () => {
const url = store.user?.cwzLoginUrl
const doman = url ? url.split('?')?.shift() : ''
if (!doman) return
fetch(url).then((res) => {
window.open(doman, '_blank')
})
}
var activeItem = 0
</script>
@ -184,15 +209,21 @@ var activeItem = 0
<!-- max-h-636px -->
<div class="pt10px pb10px flex-1 max-h-836px">
<div
class="nav pl36px pr16px py24px m10px mr0 rd-32px rd-r-0 flex flex-col text-#fff cursor-pointer hover:underline"
class="nav pl20px pr16px py24px m10px mr0 rd-32px rd-r-0 flex flex-col text-#fff cursor-pointer hover:underline transition-all111"
v-for="(m, index) in Menus"
:key="m.key"
:class="activeMenuKey === m.key ? (m.children ? 'actives' : 'active') : ''"
@click="() => menuHandler(m, index)"
>
<div :class="activeMenuKey === m.key && 'onActive'">
<img v-if="activeMenuKey === m.key" :src="m.icon1" class="w22px h22px mr16px mt--5px" />
<img v-else :src="m.icon" class="w22px h22px mr16px mt--5px" />
<div class="relative" :class="activeMenuKey === m.key && 'onActive'">
<p class="inline-block">
<img
v-if="activeMenuKey === m.key"
:src="m.icon1"
class="w22px h22px mr12px mt--5px"
/>
<img v-else :src="m.icon" class="w22px h22px mr12px mt--5px" />
</p>
<span
class="text-22px font-900 leading-22px"
:class="
@ -209,9 +240,23 @@ var activeItem = 0
</span>
<span class="text-18px italic font-500" v-if="m.other">{{ m.other }}</span>
</span>
<p
@click.stop="handleExpand(m, index)"
v-if="['DataBase', 'link', 'phone'].includes(m.key)"
class="inline-block ml-auto text-#FFF cursor-pointer p-2 float-right mr--10px mt--2"
:class="activeMenuKey === m.key && '!text-#4977FC'"
>
<el-icon size="26">
<CaretTop v-if="activeMenuKey === m.key && onClick" class="text-#4977FC" />
<CaretBottom v-else />
</el-icon>
</p>
</div>
<div v-if="m.children && idx == index" class="pl40px">
<div
v-if="m.children && idx == index && onClick"
class="pl30px transition-all duration-300"
>
<div
class="my16px pl30px text-#fff activeChildren text-20px"
v-for="(item, ind) in m.children"
@ -256,8 +301,11 @@ var activeItem = 0
</div>
</n-popover>
<div class="p20px w270px rd-20px b-4px bg-#fff/4 b-4px b-solid b-#fff/23 text-14px relative">
<a
href="http://172.31.119.37/scripts/cbgrn/grn.exe/portal/index"
<!-- href="http://106.14.114.146/scripts/cbgrn/grn.exe" -->
<!-- href="http://172.31.119.37/scripts/cbgrn/grn.exe/portal/index" -->
<div
@click="goUrl"
:href="store.user?.cwzLoginUrl"
target="_blank"
class="no-underline text-#fff"
>
@ -273,7 +321,7 @@ var activeItem = 0
src="@/assets/images/zhulj@2x.png"
class="absolute w22px h22px mr10px top--15px right--20px"
/>
</a>
</div>
<div class="mt10px ml-30px opacity-70" @click="(e) => e.stopPropagation()">
请点击上方链接登录cybouzu
</div>
@ -390,7 +438,7 @@ var activeItem = 0
background-color: #fff;
border-radius: 32px 0 0 32px;
padding: 24px 16px 24px 36px;
padding: 24px 16px 24px 20px;
}
}
}

View File

@ -13,6 +13,7 @@ import PurgeIcons from 'vite-plugin-purge-icons'
// https://vitejs.dev/config/
export default defineConfig({
base: '/',
server: {
proxy: {
'/test-api': {