update
parent
37675c31ad
commit
a10d0e32d1
|
|
@ -12,7 +12,7 @@ import { formatDate } from '@/utils/format'
|
|||
import { Chart1 } from './indexData'
|
||||
import zhCn from 'element-plus/lib/locale/lang/zh-cn'
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
import { NModal } from 'naive-ui'
|
||||
import { NModal } from 'naive-ui'
|
||||
const currentDate = new Date()
|
||||
const currentDates = new Date()
|
||||
const value1 = ref<[Date, Date]>([
|
||||
|
|
@ -36,6 +36,26 @@ const pageInfo = reactive({
|
|||
pageSize: 10,
|
||||
total: 10
|
||||
})
|
||||
const colorList: any = [
|
||||
'#2592F3',
|
||||
'#EF8C43',
|
||||
'#5FCBC5',
|
||||
'#E5B625',
|
||||
'#E74848',
|
||||
'#8E97F8',
|
||||
'#73ECA5',
|
||||
'#E7CD3B',
|
||||
'#E04E89',
|
||||
'#4EA4E0',
|
||||
'#C34EE0',
|
||||
'#8BCF54',
|
||||
'#56B1FD',
|
||||
'#24BFBA',
|
||||
'#44CF8C',
|
||||
'#6266F8',
|
||||
'#FA6B39',
|
||||
'#F05F96'
|
||||
]
|
||||
const moduleCode = ref()
|
||||
const imoduleCode = ref()
|
||||
const visitDay = ref()
|
||||
|
|
@ -112,7 +132,16 @@ const getDat = async () => {
|
|||
xAxisData.push(item.moduleName)
|
||||
siomesData.push(item.visitCount)
|
||||
})
|
||||
chartOption1.value = Chart1(xAxisData, siomesData)
|
||||
chartOption1.value = Chart1(xAxisData)
|
||||
chartOption1.value.series[0] = {
|
||||
data: siomesData,
|
||||
itemStyle: {
|
||||
color: function (params: any) {
|
||||
return colorList[params.dataIndex] || '#8F97F8'
|
||||
}
|
||||
},
|
||||
type: 'bar'
|
||||
}
|
||||
}
|
||||
|
||||
const externalList = ref<any>([])
|
||||
|
|
@ -123,17 +152,26 @@ const getExternalTimeStat = async () => {
|
|||
let xAxisData: any[] = []
|
||||
let siomesData: any[] = []
|
||||
data.forEach(
|
||||
(item: { moduleName: any; visitCount: any; moduleCode: any }) => {
|
||||
(
|
||||
item: { moduleName: any; visitCount: any; moduleCode: any },
|
||||
i: number
|
||||
) => {
|
||||
externalObj.value[item.moduleCode] = item.moduleName
|
||||
externalObj.value[item.moduleCode + 'color'] = colorList[9 + i]
|
||||
xAxisData.push(item.moduleName)
|
||||
siomesData.push(item.visitCount)
|
||||
}
|
||||
)
|
||||
chartOption2.value = Chart1(xAxisData, siomesData)
|
||||
console.log(
|
||||
'🚀 ~ file: index.vue:131 ~ Chart1(xAxisData, siomesData):',
|
||||
Chart1(xAxisData, siomesData)
|
||||
)
|
||||
chartOption2.value = Chart1(xAxisData)
|
||||
chartOption2.value.series[0] = {
|
||||
data: siomesData,
|
||||
itemStyle: {
|
||||
color: function (params: any) {
|
||||
return colorList[9 + params.dataIndex] || '#8F97F8'
|
||||
}
|
||||
},
|
||||
type: 'bar'
|
||||
}
|
||||
// chartOption2.value.height=3000
|
||||
// chartOption2.value.width=1000
|
||||
}
|
||||
|
|
@ -270,15 +308,26 @@ const barOption = {
|
|||
containLabel: true
|
||||
},
|
||||
yAxis: {
|
||||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun','hour','month','year'],
|
||||
data: [
|
||||
'Mon',
|
||||
'Tue',
|
||||
'Wed',
|
||||
'Thu',
|
||||
'Fri',
|
||||
'Sat',
|
||||
'Sun',
|
||||
'hour',
|
||||
'month',
|
||||
'year'
|
||||
],
|
||||
axisLabel: {
|
||||
show: false, // 隐藏原始的 x 轴标签
|
||||
interval: 0,
|
||||
interval: 0
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
type: 'value'
|
||||
},
|
||||
label: {
|
||||
show: true,
|
||||
position: 'inside',
|
||||
|
|
@ -307,11 +356,11 @@ const barOption = {
|
|||
},
|
||||
series: [
|
||||
{
|
||||
data: [120, 200, 150, 80, 70, 110, 130,123,50,80],
|
||||
data: [120, 200, 150, 80, 70, 110, 130, 123, 50, 80],
|
||||
type: 'bar',
|
||||
itemStyle: {
|
||||
color: function (params: any) {
|
||||
return echartsItemColor[params.dataIndex]
|
||||
return colorList[params.dataIndex]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -327,7 +376,6 @@ const handleChild = async (data: any) => {
|
|||
multipleSelection.value.forEach((i: { userId: any }) => {
|
||||
userIdList.push(i.userId)
|
||||
})
|
||||
console.log("🚀 ~ file: index.vue:328 ~ userIdList:", userIdList)
|
||||
}
|
||||
const CloseThiss = (data?: boolean) => {
|
||||
showModal.value = data || false
|
||||
|
|
@ -449,9 +497,10 @@ const isDev = false
|
|||
<div class="overflow-auto h-720px">
|
||||
<div class="mt20px w-full">
|
||||
<span
|
||||
class="cardfoot text-#000 p30px mx10px my10px text-center text-18px font-bold"
|
||||
v-for="(i, e) in dataList"
|
||||
class="cardfoot text-#fff bg-box p30px mx10px my10px text-center text-20px font-bold"
|
||||
:style="{ 'background-color': colorList[e % colorList.length] }"
|
||||
v-if="dataList"
|
||||
v-for="i in dataList"
|
||||
>
|
||||
<span>{{ i.moduleName }}</span
|
||||
><br />
|
||||
|
|
@ -477,41 +526,37 @@ const isDev = false
|
|||
<VChart key="yyy" ref="chartRef1" :option="chartOption1" />
|
||||
</div>
|
||||
<div class="mt-30px">
|
||||
<div class="flex items-center" v-if="isDev">
|
||||
<span class="text-#000 mr-10px">模块: </span>
|
||||
<el-select
|
||||
v-model="moduleCode"
|
||||
placeholder="选择模块"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="item in externalList"
|
||||
:key="item.id"
|
||||
:label="item.moduleName"
|
||||
:value="item.moduleCode"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="Search"
|
||||
size="small"
|
||||
class="ml20px"
|
||||
@click="handleClick({ paneName: activeName })"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="Search"
|
||||
size="small"
|
||||
class="ml20px"
|
||||
@click="showModal = true"
|
||||
>部长以上人员足迹</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="flex items-center" v-if="isDev">
|
||||
<span class="text-#000 mr-10px">模块: </span>
|
||||
<el-select v-model="moduleCode" placeholder="选择模块" clearable>
|
||||
<el-option
|
||||
v-for="item in externalList"
|
||||
:key="item.id"
|
||||
:label="item.moduleName"
|
||||
:value="item.moduleCode"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="Search"
|
||||
size="small"
|
||||
class="ml20px"
|
||||
@click="handleClick({ paneName: activeName })"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="Search"
|
||||
size="small"
|
||||
class="ml20px"
|
||||
@click="showModal = true"
|
||||
>部长以上人员足迹</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="pb-14px" v-if="isDev">
|
||||
<div class=" flex flex-wrap mb-30px" >
|
||||
<div class="flex flex-wrap mb-30px">
|
||||
<div
|
||||
class=" m-4 flex items-center justify-between w-45% h-full"
|
||||
class="m-4 flex items-center justify-between w-45% h-full"
|
||||
v-for="i in 10"
|
||||
:key="i"
|
||||
>
|
||||
|
|
@ -522,7 +567,11 @@ const isDev = false
|
|||
<p class="text-center mt-10">测试 {{ i }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<VChart class="h-300px w-65% pb-10px ml-auto" key="yyy1" :option="barOption" />
|
||||
<VChart
|
||||
class="h-300px w-65% pb-10px ml-auto"
|
||||
key="yyy1"
|
||||
:option="barOption"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="absolute bottom-2px right-30px z-20 bg-#fff">
|
||||
|
|
@ -659,9 +708,10 @@ const isDev = false
|
|||
<div>
|
||||
<div class="mt20px w-full">
|
||||
<span
|
||||
class="cardfoot text-#000 p30px mx10px my10px text-center text-18px font-bold"
|
||||
class="cardfoot text-#fff p30px mx10px my10px text-center text-18px font-bold"
|
||||
:style="{ 'background-color': colorList[9 + e] }"
|
||||
v-if="externalList"
|
||||
v-for="i in externalList"
|
||||
v-for="(i, e) in externalList"
|
||||
>
|
||||
<span>{{ i.moduleName }}</span
|
||||
><br />
|
||||
|
|
@ -678,21 +728,30 @@ const isDev = false
|
|||
</div>
|
||||
</div>
|
||||
<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 lang="less" scoped>
|
||||
// .bg-box{
|
||||
// background-image: url('@/views/home/images/bei.png');
|
||||
// background-repeat: no-repeat;
|
||||
// background-size: 100% 100%;
|
||||
// background-position: center right;
|
||||
// }
|
||||
.cardfoot {
|
||||
display: inline-block;
|
||||
height: 120px;
|
||||
width: 220px;
|
||||
background-image: url('@/assets/images/bg-card.svg');
|
||||
background-size: cover;
|
||||
// background-image: url('@/assets/images/bg-card.svg');
|
||||
background-image: url('@/views/home/images/bei.png');
|
||||
background-size: 60% 100%;
|
||||
background-position: center right;
|
||||
background-repeat: no-repeat;
|
||||
border-radius: 18px;
|
||||
box-shadow: 0px 6px 10px -2px rgba(43, 42, 42, 0.25);
|
||||
}
|
||||
|
|
@ -700,7 +759,9 @@ const isDev = false
|
|||
.cardfoot:hover {
|
||||
background-color: #fff;
|
||||
box-shadow: 0px 9px 20px 7px rgba(92, 78, 218, 0.25);
|
||||
color: #2042b4;
|
||||
// color: #2042b4;
|
||||
color: currentColor;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.top {
|
||||
|
|
|
|||
|
|
@ -86,32 +86,39 @@ const states = reactive<any>({
|
|||
// return { chartRef, option: optionRef, states }
|
||||
// }
|
||||
|
||||
export function Chart1(xAxisData:any =[],siomesData:any=[],options={}) {
|
||||
const option = {
|
||||
width: '100%',
|
||||
// height: '450px', // 设置图表高度为 400 像素
|
||||
grid: { left: '10', top: 90, right: '10', bottom: '10', containLabel: true },
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data:xAxisData
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value'
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
data: siomesData,
|
||||
color: '#8F97F8',
|
||||
type: 'bar',
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
return {...option,...options}
|
||||
export function Chart1(xAxisData: any = [], color = []) {
|
||||
const option = {
|
||||
width: '100%',
|
||||
// height: '450px', // 设置图表高度为 400 像素
|
||||
grid: {
|
||||
left: '10',
|
||||
top: 90,
|
||||
right: '10',
|
||||
bottom: '10',
|
||||
containLabel: true
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: xAxisData
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value'
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
data: [],
|
||||
color: function (params: any) {
|
||||
return color[params.dataIndex] || '#8F97F8'
|
||||
},
|
||||
type: 'bar'
|
||||
}
|
||||
]
|
||||
}
|
||||
return { ...option }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,9 +52,14 @@ onMounted(async ()=>{
|
|||
const {data} =await getCurrencyList()
|
||||
const {data:dat} =await getMetalList()
|
||||
if(dat&&dat!='null'&&dat.length>0){
|
||||
metal.value = dat
|
||||
from.value.label.radio = dat[0].value
|
||||
state4.number = dat[0].value
|
||||
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
|
||||
|
|
|
|||
|
|
@ -59,350 +59,415 @@ function reverseArray(inputArray: string | any[],star: number,enc: number) {
|
|||
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
|
||||
})
|
||||
|
||||
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]
|
||||
|
||||
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,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top'
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'LME',
|
||||
data: LME,
|
||||
type: 'line',
|
||||
color: '#FF603A',
|
||||
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 { 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]
|
||||
|
||||
const option = {
|
||||
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))
|
||||
|
||||
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',
|
||||
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]
|
||||
|
||||
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',
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
},
|
||||
{
|
||||
name: 'LME',
|
||||
data: LME,
|
||||
type: 'line',
|
||||
color: '#0063ED',
|
||||
smooth: true,
|
||||
yAxisIndex: 1,
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
}
|
||||
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]
|
||||
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
|
||||
},
|
||||
]
|
||||
}
|
||||
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 }
|
||||
}
|
||||
Loading…
Reference in New Issue