Compare commits
4 Commits
19fa389986
...
a75ff2af9a
Author | SHA1 | Date | |
---|---|---|---|
a75ff2af9a | |||
![]() |
8fa1f6e1fe | ||
![]() |
1cb948bd99 | ||
ea072afc8a |
@ -7,6 +7,8 @@ import { baseUrlHost } from '../baseUrlHost';
|
||||
*
|
||||
* 登录api接口集合
|
||||
* @method getlogList 获取日志列表
|
||||
* @method getaiabilityList 获取统计AI能力列表
|
||||
* @method getbaseUserList 获取统计基础信息列表
|
||||
*/
|
||||
|
||||
export function logApi() {
|
||||
@ -18,5 +20,18 @@ export function logApi() {
|
||||
params,
|
||||
});
|
||||
},
|
||||
getabilityList: (params:object) => {
|
||||
return request({
|
||||
url: baseUrlHost + '/acLog/AiAbility',
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
},
|
||||
getbaseUserList: () => {
|
||||
return request({
|
||||
url: baseUrlHost + '/acLog/basicInformation',
|
||||
method: 'get',
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import { pixelUrlHost } from '/@/api/baseUrlHost';
|
||||
*
|
||||
* 登录api接口集合
|
||||
* @method getRecommendList 获取推荐作品列表
|
||||
* @method saveRecommend 保存推荐作品
|
||||
* @method deleteRecommend 删除推荐作品
|
||||
*/
|
||||
|
||||
export function recommendApi() {
|
||||
@ -18,5 +20,18 @@ export function recommendApi() {
|
||||
params,
|
||||
});
|
||||
},
|
||||
saveRecommend: (data: object) => {
|
||||
return request({
|
||||
url: pixelUrlHost + '/paRecommend',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
},
|
||||
deleteRecommend: (id: Number) => {
|
||||
return request({
|
||||
url: pixelUrlHost + `/paRecommend/${id}`,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -74,7 +74,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="article">
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { onActivated, onMounted, reactive, ref } from 'vue';
|
||||
import { articleApi } from '/@/api/article';
|
||||
import { ElMessage, ElMessageBox, TableColumnCtx } from 'element-plus';
|
||||
import { useRouter } from 'vue-router';
|
||||
@ -255,6 +255,10 @@ const onHandleCurrentChange = (val: number) => {
|
||||
getTableData();
|
||||
};
|
||||
|
||||
onActivated(() => {
|
||||
getTableData();
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getTableData();
|
||||
getModuleList();
|
||||
|
@ -42,7 +42,7 @@
|
||||
<el-row :gutter="35">
|
||||
<el-col :xs="24" :sm="10" :md="8" :lg="8" :xl="8" class="mb20">
|
||||
<el-form-item label="价格:" prop="price">
|
||||
<el-input-number v-model="state.data.price" :min="0" controls-position="right">
|
||||
<el-input-number v-model="state.data.price" :min="0" disabled controls-position="right">
|
||||
<template #prefix><span>¥</span></template>
|
||||
</el-input-number>
|
||||
</el-form-item>
|
||||
@ -72,7 +72,7 @@
|
||||
<el-col :xs="24" :sm="16" :md="16" :lg="16" :xl="16" class="mb20" v-if="state.data.options&&state.data.options.length>0">
|
||||
<el-form-item label="选项:">
|
||||
<div class="tags-option">
|
||||
<el-tag v-for="option in state.data.options" :key="option.id" :disable-transitions="false">{{ option.optionName }}</el-tag>
|
||||
<el-tag v-for="option in state.data.options" :title="option.optionName" :key="option.id" :disable-transitions="false">{{ option.optionName }}</el-tag>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -119,7 +119,7 @@ const state:any = reactive({
|
||||
name: { required: true, message: '请输入应用名称', trigger: 'blur' },
|
||||
api: { required: true, message: '请输入接口名', trigger: 'blur' },
|
||||
tips: { required: true, message: '请输入提示词', trigger: 'blur' },
|
||||
price: { required: true, message: '请输入价格', trigger: 'blur' },
|
||||
// price: { required: true, message: '请输入价格', trigger: 'blur' },
|
||||
position: { required: true, message: '请输入排序号', trigger: 'blur' },
|
||||
type: { required: true, message: '请选择应用类型', trigger: 'blur' },
|
||||
},
|
||||
@ -320,5 +320,10 @@ defineExpose({
|
||||
grid-template-columns: repeat(auto-fill, minmax(50px,100px) );
|
||||
grid-gap: 0.4em 0.8em;
|
||||
// grid-auto-flow: column dense;
|
||||
::v-deep .el-tag__content{
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -129,8 +129,8 @@ const state: any = reactive({
|
||||
id: 1,
|
||||
children: [
|
||||
{id: '-1',label: '全部',active: true,},
|
||||
{id: '0',label: '上架',active: false,},
|
||||
{id: '1',label: '下架',active: false,}
|
||||
{id: '1',label: '上架',active: false,},
|
||||
{id: '0',label: '下架',active: false,}
|
||||
],
|
||||
}
|
||||
],
|
||||
@ -154,9 +154,19 @@ const onSelItem = (val: FilteringRowType, v: FilteringChilType) => {
|
||||
val.children.map((v: FilteringChilType) => (v.active = false));
|
||||
v.active = true;
|
||||
state.tableData.loading = true;
|
||||
setTimeout(() => {
|
||||
state.tableData.loading = false;
|
||||
}, 500);
|
||||
const isd = Number(v.id);
|
||||
if(val.id === 0){
|
||||
state.tableData.param.type = isd;
|
||||
isd === -1 ? delete state.tableData.param.type : '' ;
|
||||
}else{
|
||||
state.tableData.param.publish = isd;
|
||||
isd === -1 ? delete state.tableData.param.publish : '' ;
|
||||
}
|
||||
state.tableData.param.current = 1;
|
||||
getTableData();
|
||||
// setTimeout(() => {
|
||||
// state.tableData.loading = false;
|
||||
// }, 500);
|
||||
};
|
||||
// 当前列表项点击
|
||||
const onTableItemClick = (v: FilterListType) => {
|
||||
|
@ -4,9 +4,9 @@
|
||||
<div class="system-dept-search mb15">
|
||||
<!-- 发布者:<el-input size="default" placeholder="请输入发布用户名称" v-model="state.tableData.param.userName"
|
||||
class="ml10 mr10" style="max-width: 180px" clearable></el-input> -->
|
||||
作品类型:<el-select size="default" v-model="state.tableData.param.serviceId" placeholder="请选择作品类型"
|
||||
作品类型:<el-select size="default" v-model="state.tableData.param.serviceName" placeholder="请选择作品类型"
|
||||
clearable class="ml10 mr10" style="max-width: 180px">
|
||||
<el-option v-for="(item,index) in state.special.data" :key="index" :label="item.name" :value="item.id"></el-option>
|
||||
<el-option v-for="(item,index) in state.special.data" :key="index" :label="item.name" :value="item.name"></el-option>
|
||||
</el-select>
|
||||
|
||||
<el-button @click="getTableData" size="default" type="primary" class="ml10">
|
||||
@ -21,13 +21,26 @@
|
||||
</el-icon>
|
||||
重置
|
||||
</el-button>
|
||||
<el-button size="default" type="success" class="ml10">
|
||||
<el-icon>
|
||||
<ele-FolderAdd />
|
||||
</el-icon>
|
||||
添加推荐作品
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
|
||||
<el-table-column align="center" type="index" label="序号" width="100"/>
|
||||
<el-table-column align="center" prop="name" label="作品">
|
||||
<el-table-column align="center" prop="sourcePath" label="原图">
|
||||
<template #default="scope">
|
||||
<el-image :src="scope.row.path" lazy
|
||||
preview-teleported="true" :preview-src-list="[scope.row.path]"/>
|
||||
<el-image v-if="scope.row.sourcePath" :src="getImagePath(scope.row.sourcePath)" lazy
|
||||
preview-teleported="true" :preview-src-list="[getImagePath(scope.row.sourcePath)]"/>
|
||||
<div v-else>暂无</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="path" label="作品">
|
||||
<template #default="scope">
|
||||
<el-image :src="getImagePath(scope.row.path)" lazy
|
||||
preview-teleported="true" :preview-src-list="[getImagePath(scope.row.path)]"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="serviceName" align="center" label="服务名" show-overflow-tooltip></el-table-column>
|
||||
@ -35,7 +48,7 @@
|
||||
<el-table-column label="操作" width="200" align="center">
|
||||
<template #default="scope">
|
||||
<!-- <el-button size="small" text type="primary" @click="toShowDetail(scope.row.id)">查看详情</el-button> -->
|
||||
<el-button size="small" text type="danger" @click="toPublic(scope.row)">取消推荐</el-button>
|
||||
<el-button size="small" text type="danger" @click="deleteRecommend(scope.row.id)">删除</el-button>
|
||||
<!-- <el-button size="small" v-else text type="primary" @click="audit(scope.row)">重新审核</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -87,7 +100,7 @@ const state = reactive<any>({
|
||||
param: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
serviceId: ''
|
||||
serviceName: ''
|
||||
},
|
||||
},
|
||||
special: {
|
||||
@ -125,6 +138,13 @@ const getSpecialList = async() => {
|
||||
}
|
||||
};
|
||||
|
||||
// 图片格式化
|
||||
const getImagePath = (path: string) => {
|
||||
if(!path) return;
|
||||
let index = path?.indexOf('?');
|
||||
return path?.includes('://') ? path.substring(0,(!index||index===-1) ? path.length : index) : encodeURI(path);
|
||||
}
|
||||
|
||||
// 获取表格数据
|
||||
const getTableData = async() => {
|
||||
try {
|
||||
@ -137,17 +157,41 @@ const getTableData = async() => {
|
||||
ElMessage.error('推荐作品列表获取失败!');
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('推荐作品列表获取失败!');
|
||||
} finally {
|
||||
state.tableData.loading = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 删除推荐
|
||||
const deleteRecommend = (id:Number) =>{
|
||||
ElMessageBox.confirm('是否确定删除该推荐?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(async() => {
|
||||
try {
|
||||
state.tableData.loading = true;
|
||||
let res = await redApi.deleteRecommend(id);
|
||||
if(res?.success){
|
||||
await getTableData();
|
||||
ElMessage.success('推荐作品删除成功!');
|
||||
} else ElMessage.error('推荐作品删除失败!');
|
||||
} catch(e) {
|
||||
ElMessage.error('处理失败!');
|
||||
} finally {
|
||||
state.tableData.loading = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 重置
|
||||
const reset = () =>{
|
||||
state.tableData.param = {
|
||||
current: 1,
|
||||
size: 10,
|
||||
serviceId: ''
|
||||
serviceName: ''
|
||||
}
|
||||
getTableData();
|
||||
}
|
||||
@ -181,12 +225,13 @@ const toPublic = (row: any) => {
|
||||
// 日期格式化
|
||||
const dateFormatter = (row: any, column: TableColumnCtx<String>) => {
|
||||
if(row.createtime === null) return '暂无';
|
||||
let mount = row.createtime[1];
|
||||
let day = row.createtime[2];
|
||||
let hour = row.createtime[3];
|
||||
let minute = row.createtime[4];
|
||||
let second = row.createtime[5];
|
||||
return `${row.createtime[0]}-${mount < 10 ? '0' : ''}${mount}-${day < 10 ? '0' : ''}${day} ${hour < 10 ? '0' : ''}${hour}:${minute < 10 ? '0' : ''}${minute}:${second < 10 ? '0' : ''}${second}`;
|
||||
let date = new Date(row.createtime);
|
||||
let mount = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
let hour = date.getHours();
|
||||
let minute = date.getMinutes();
|
||||
let second = date.getSeconds();
|
||||
return `${date.getFullYear()}-${mount < 10 ? '0' : ''}${mount}-${day < 10 ? '0' : ''}${day} ${hour < 10 ? '0' : ''}${hour}:${minute < 10 ? '0' : ''}${minute}:${second < 10 ? '0' : ''}${second}`;
|
||||
}
|
||||
|
||||
// 分页改变
|
||||
|
@ -35,9 +35,11 @@
|
||||
<el-table-column prop="reviewStatus" align="center" label="审核结果" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.reviewStatus === 1" type="warning">审核中</el-tag>
|
||||
<el-tag v-else-if="scope.row.reviewStatus === 2" type="success">通过</el-tag>
|
||||
<el-tag v-else-if="scope.row.reviewStatus === 3" type="danger">未通过</el-tag>
|
||||
<el-tag v-else>未发布</el-tag>
|
||||
<el-tag v-else-if="scope.row.reviewStatus === null||scope.row.reviewStatus === 0">未发布</el-tag>
|
||||
<el-tag v-else-if="scope.row.reviewStatus === 2" type="success">通过</el-tag>
|
||||
<el-tag v-else-if="scope.row.reviewStatus === 4" type="success">已推荐</el-tag>
|
||||
<el-tag v-else-if="scope.row.reviewStatus === 5" type="warning">取消推荐</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createtime" align="center" label="时间" :formatter="dateFormatter" show-overflow-tooltip></el-table-column>
|
||||
@ -46,8 +48,9 @@
|
||||
<!-- <el-button size="small" text type="primary" @click="toShowDetail(scope.row.id)">查看详情</el-button> -->
|
||||
<el-button size="small" v-if="scope.row.reviewStatus === 1" text type="primary" @click="audit(scope.row)">审核</el-button>
|
||||
<el-button size="small" v-else-if="scope.row.reviewStatus === null||scope.row.reviewStatus === 0" text type="primary" @click="toPublic(scope.row)">发布</el-button>
|
||||
<el-button size="small" v-else text type="primary" @click="audit(scope.row)">重新审核</el-button>
|
||||
<!-- <el-button size="small" v-if="scope.row.reviewStatus === 2" text type="primary" @click="toPublicHome(scope.row)">首页推荐</el-button> -->
|
||||
<el-button size="small" v-else-if="scope.row.reviewStatus === 2||scope.row.reviewStatus === 3||scope.row.reviewStatus === 5" text type="primary" @click="audit(scope.row)">重新审核</el-button>
|
||||
<el-button size="small" v-if="scope.row.reviewStatus === 2||scope.row.reviewStatus === 5" text type="primary" @click="toPublicHome(scope.row)">首页推荐</el-button>
|
||||
<el-button size="small" v-else-if="scope.row.reviewStatus === 4" text type="danger" @click="toCancelPublic(scope.row)">取消推荐</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -123,6 +126,8 @@ const statusList = ref([
|
||||
{label: '审核中', value: 1},
|
||||
{label: '通过', value: 2},
|
||||
{label: '未通过', value: 3},
|
||||
{label: '已推荐', value: 4},
|
||||
{label: '取消推荐', value: 5},
|
||||
]);
|
||||
|
||||
// 引入 api 请求接口
|
||||
@ -185,6 +190,32 @@ const toPublic = (row: any) => {
|
||||
})
|
||||
}
|
||||
|
||||
// 取消推荐
|
||||
const toCancelPublic = (row: any) => {
|
||||
ElMessageBox.confirm('是否确定取消推荐该作品?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(async() => {
|
||||
try {
|
||||
state.auditDialog.form.id = row.id;
|
||||
state.auditDialog.form.status = 5;
|
||||
state.tableData.loading = true;
|
||||
let res = await shareApi.auditRelease(state.auditDialog.form);
|
||||
if(res?.success){
|
||||
ElMessage.success('作品取消推荐成功!');
|
||||
state.auditDialog.show = false;
|
||||
getTableData();
|
||||
}else{ElMessage.error('作品取消推荐失败!');}
|
||||
} catch(e) {
|
||||
ElMessage.error('处理失败!');
|
||||
} finally {
|
||||
state.tableData.loading = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 首页推荐
|
||||
const toPublicHome = (row: any) => {
|
||||
ElMessageBox.confirm('确定要推荐该作品吗?', '提示', {
|
||||
@ -194,18 +225,15 @@ const toPublicHome = (row: any) => {
|
||||
})
|
||||
.then(async() => {
|
||||
try {
|
||||
state.auditDialog.form.id = row.id;
|
||||
state.auditDialog.form.status = 4;
|
||||
state.tableData.loading = true;
|
||||
const form = {
|
||||
labelName: '首页推荐',
|
||||
moduleName: '首页推荐',
|
||||
path: row.path
|
||||
}
|
||||
console.log(form);
|
||||
|
||||
// let res = await shareApi.saveRelease({ creationId: row.creationId });
|
||||
// if(res?.success){
|
||||
// ElMessage.success('推荐成功!');
|
||||
// } else ElMessage.error('推荐失败!');
|
||||
let res = await shareApi.auditRelease(state.auditDialog.form);
|
||||
if(res?.success){
|
||||
ElMessage.success('作品推荐成功!');
|
||||
state.auditDialog.show = false;
|
||||
getTableData();
|
||||
}else{ElMessage.error('作品推荐失败!');}
|
||||
} catch(e) {
|
||||
ElMessage.error('处理失败!');
|
||||
} finally {
|
||||
@ -244,7 +272,12 @@ const commitAudit = async() => {
|
||||
const dateFormatter = (row: any, column: TableColumnCtx<String>) => {
|
||||
if(row.createtime === null) return '暂无';
|
||||
let date = new Date(row.createtime);
|
||||
return `${date.getFullYear()}-${date.getMonth()+1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
|
||||
let mount = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
let hour = date.getHours();
|
||||
let minute = date.getMinutes();
|
||||
let second = date.getSeconds();
|
||||
return `${date.getFullYear()}-${mount < 10 ? '0' : ''}${mount}-${day < 10 ? '0' : ''}${day} ${hour < 10 ? '0' : ''}${hour}:${minute < 10 ? '0' : ''}${minute}:${second < 10 ? '0' : ''}${second}`;
|
||||
}
|
||||
|
||||
// 分页改变
|
||||
|
@ -3,19 +3,20 @@
|
||||
<el-row :gutter="15" class="home-card-one mb15">
|
||||
<el-col
|
||||
:xs="24"
|
||||
:sm="12"
|
||||
:md="12"
|
||||
:lg="6"
|
||||
:xl="6"
|
||||
:sm="24"
|
||||
:md="24"
|
||||
:lg="8"
|
||||
:xl="8"
|
||||
v-for="(v, k) in state.homeOne"
|
||||
:key="k"
|
||||
:class="{ 'home-media home-media-lg': k > 1, 'home-media-sm': k === 1 }"
|
||||
class="home-media-sm"
|
||||
>
|
||||
<!-- :class="{ 'home-media home-media-lg': k > 1, 'home-media-sm': k === 1 }" -->
|
||||
<div class="home-card-item flex">
|
||||
<div class="flex-margin flex w100" :class="` home-one-animation${k}`">
|
||||
<div class="flex-auto">
|
||||
<span class="font30">{{ v.num1 }}</span>
|
||||
<span class="ml5 font16" :style="{ color: v.color1 }">{{ v.num2 }}%</span>
|
||||
<!-- <span class="ml5 font16" :style="{ color: v.color1 }">{{ v.num2 }}%</span> -->
|
||||
<div class="mt10">{{ v.num3 }}</div>
|
||||
</div>
|
||||
<div class="home-card-item-icon flex" :style="{ background: `var(${v.color2})` }">
|
||||
@ -25,40 +26,29 @@
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="15" class="home-card-two mb15">
|
||||
<el-col :xs="24" :sm="14" :md="14" :lg="16" :xl="16">
|
||||
<el-row :gutter="15" class="home-card-two mb15" >
|
||||
<el-col
|
||||
:xs="24"
|
||||
:sm="24"
|
||||
:md="24"
|
||||
:lg="24"
|
||||
:xl="24"
|
||||
>
|
||||
<div class="home-card-item">
|
||||
<div style="height: 100%" ref="homeLineRef"></div>
|
||||
<!-- 添加日期范围选择框 -->
|
||||
<div class="date-picker-container">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
@change="handleDateChange"
|
||||
/>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="10" :md="10" :lg="8" :xl="8" class="home-media">
|
||||
<div class="home-card-item">
|
||||
<div style="height: 100%" ref="homePieRef"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="15" class="home-card-three">
|
||||
<el-col :xs="24" :sm="10" :md="10" :lg="8" :xl="8">
|
||||
<div class="home-card-item">
|
||||
<div class="home-card-item-title">快捷导航工具</div>
|
||||
<div class="home-monitor">
|
||||
<div class="flex-warp">
|
||||
<div class="flex-warp-item" v-for="(v, k) in state.homeThree" :key="k">
|
||||
<div class="flex-warp-item-box" :class="`home-animation${k}`">
|
||||
<div class="flex-margin">
|
||||
<i :class="v.icon" :style="{ color: v.iconColor }"></i>
|
||||
<span class="pl5">{{ v.label }}</span>
|
||||
<div class="mt10">{{ v.value }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="14" :md="14" :lg="16" :xl="16" class="home-media">
|
||||
<div class="home-card-item">
|
||||
<div style="height: 100%" ref="homeBarRef"></div>
|
||||
<div style="height: 100%; width: 100%" ref="homeBarRef"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -71,11 +61,16 @@ import * as echarts from 'echarts';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useThemeConfig } from '/@/stores/themeConfig';
|
||||
import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
|
||||
import { logApi } from '/@/api/log';
|
||||
|
||||
const logapi = logApi();
|
||||
|
||||
// 定义变量内容
|
||||
const homeLineRef = ref();
|
||||
const homePieRef = ref();
|
||||
const homeBarRef = ref();
|
||||
const dateRange = ref('');
|
||||
const defaultTime1 = new Date(2000, 1, 1, 0, 0, 0) // '12:00:00'
|
||||
const storesTagsViewRoutes = useTagsViewRoutes();
|
||||
const storesThemeConfig = useThemeConfig();
|
||||
const { themeConfig } = storeToRefs(storesThemeConfig);
|
||||
@ -88,42 +83,42 @@ const state = reactive({
|
||||
dispose: [null, '', undefined],
|
||||
} as any,
|
||||
homeOne: [
|
||||
{
|
||||
num1: '125,12',
|
||||
num2: '-12.32',
|
||||
num3: '订单统计信息',
|
||||
num4: 'fa fa-meetup',
|
||||
color1: '#FF6462',
|
||||
color2: '--next-color-primary-lighter',
|
||||
color3: '--el-color-primary',
|
||||
},
|
||||
{
|
||||
num1: '653,33',
|
||||
num2: '+42.32',
|
||||
num3: '月度计划信息',
|
||||
num4: 'iconfont icon-ditu',
|
||||
color1: '#6690F9',
|
||||
color2: '--next-color-success-lighter',
|
||||
color3: '--el-color-success',
|
||||
},
|
||||
{
|
||||
num1: '125,65',
|
||||
num2: '+17.32',
|
||||
num3: '年度计划信息',
|
||||
num4: 'iconfont icon-zaosheng',
|
||||
color1: '#6690F9',
|
||||
color2: '--next-color-warning-lighter',
|
||||
color3: '--el-color-warning',
|
||||
},
|
||||
{
|
||||
num1: '520,43',
|
||||
num2: '-10.01',
|
||||
num3: '访问统计信息',
|
||||
num4: 'fa fa-github-alt',
|
||||
color1: '#FF6462',
|
||||
color2: '--next-color-danger-lighter',
|
||||
color3: '--el-color-danger',
|
||||
},
|
||||
// {
|
||||
// num1: '125,12',
|
||||
// num2: '-12.32',
|
||||
// num3: '订单统计信息',
|
||||
// num4: 'fa fa-meetup',
|
||||
// color1: '#FF6462',
|
||||
// color2: '--next-color-primary-lighter',
|
||||
// color3: '--el-color-primary',
|
||||
// },
|
||||
// {
|
||||
// num1: '653,33',
|
||||
// num2: '+42.32',
|
||||
// num3: '月度计划信息',
|
||||
// num4: 'iconfont icon-ditu',
|
||||
// color1: '#6690F9',
|
||||
// color2: '--next-color-success-lighter',
|
||||
// color3: '--el-color-success',
|
||||
// },
|
||||
// {
|
||||
// num1: '125,65',
|
||||
// num2: '+17.32',
|
||||
// num3: '年度计划信息',
|
||||
// num4: 'iconfont icon-zaosheng',
|
||||
// color1: '#6690F9',
|
||||
// color2: '--next-color-warning-lighter',
|
||||
// color3: '--el-color-warning',
|
||||
// },
|
||||
// {
|
||||
// num1: '520,43',
|
||||
// num2: '-10.01',
|
||||
// num3: '访问统计信息',
|
||||
// num4: 'fa fa-github-alt',
|
||||
// color1: '#FF6462',
|
||||
// color2: '--next-color-danger-lighter',
|
||||
// color3: '--el-color-danger',
|
||||
// },
|
||||
],
|
||||
homeThree: [
|
||||
{
|
||||
@ -189,6 +184,47 @@ const state = reactive({
|
||||
},
|
||||
});
|
||||
|
||||
const getList = async() =>{
|
||||
try{
|
||||
const res = await logapi.getbaseUserList();
|
||||
if (res?.success) {
|
||||
const data = res.data;
|
||||
// 动态构建 homeOne 数组
|
||||
state.homeOne = [
|
||||
{
|
||||
num1: data.userTotalCount,
|
||||
// num2: "12.32", // 示例百分比变化值
|
||||
num3: "总用户数",
|
||||
color1: '#FF6462',
|
||||
color2: '--next-color-primary-lighter',
|
||||
color3: '--el-color-primary',
|
||||
num4: "iconfont icon-zaosheng", // 示例图标类
|
||||
},
|
||||
{
|
||||
num1: data.userTodayCount,
|
||||
// num2: "42.32", // 示例百分比变化值
|
||||
num3: "今日用户数",
|
||||
color1: '#6690F9',
|
||||
color2: '--next-color-success-lighter',
|
||||
color3: '--el-color-success',
|
||||
num4: "iconfont icon-ditu",
|
||||
},
|
||||
{
|
||||
num1: data.homeviewCount,
|
||||
// num2: "17.32", // 示例百分比变化值
|
||||
num3: "首页浏览数",
|
||||
color1: '#6690F9',
|
||||
color2: '--next-color-warning-lighter',
|
||||
color3: '--el-color-warning',
|
||||
num4: "iconfont icon-zaosheng",
|
||||
},
|
||||
];
|
||||
}
|
||||
}catch(error){
|
||||
console.error(error)
|
||||
}
|
||||
};
|
||||
|
||||
// 折线图
|
||||
const initLineChart = () => {
|
||||
if (!state.global.dispose.some((b: any) => b === state.global.homeChartOne)) state.global.homeChartOne.dispose();
|
||||
@ -356,131 +392,88 @@ const initPieChart = () => {
|
||||
state.global.homeChartTwo.setOption(option);
|
||||
state.myCharts.push(state.global.homeChartTwo);
|
||||
};
|
||||
|
||||
//获取柱状图的数据
|
||||
const fetchChartData = async (start?: string, end?: string) => {
|
||||
try {
|
||||
const params = start && end ? { start, end } : {}; // 参数
|
||||
const response = await logapi.getabilityList(params); // 调用接口获取数据
|
||||
if (response && response.data) {
|
||||
initBarChart(response.data); // 调用图表初始化函数并传入数据
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取柱状图数据失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// 处理日期范围变化
|
||||
const handleDateChange = () => {
|
||||
if (dateRange.value.length === 2) {
|
||||
const [start, end] = dateRange.value; // 已是 yyyy-MM-dd HH:mm:ss 格式
|
||||
fetchChartData(start, end); // 将选择后的日期范围传递给图表数据接口
|
||||
} else {
|
||||
fetchChartData(); // 日期范围清空时的操作
|
||||
}
|
||||
};
|
||||
|
||||
// 柱状图
|
||||
const initBarChart = () => {
|
||||
if (!state.global.dispose.some((b: any) => b === state.global.homeCharThree)) state.global.homeCharThree.dispose();
|
||||
const initBarChart = (data:any = []) => {
|
||||
if (!state.global.dispose.some((b) => b === state.global.homeCharThree))
|
||||
state.global.homeCharThree.dispose();
|
||||
|
||||
state.global.homeCharThree = markRaw(echarts.init(homeBarRef.value, state.charts.theme));
|
||||
|
||||
const abilities = data.length ? data.map((item) => item.ability) : ['无数据'];
|
||||
const numbers = data.length ? data.map((item) => item.num) : [0];
|
||||
|
||||
const option = {
|
||||
backgroundColor: state.charts.bgColor,
|
||||
title: {
|
||||
text: '地热开发利用',
|
||||
text: 'AI能力使用统计',
|
||||
x: 'left',
|
||||
textStyle: { fontSize: '15', color: state.charts.color },
|
||||
},
|
||||
tooltip: { trigger: 'axis' },
|
||||
legend: { data: ['供温', '回温', '压力值(Mpa)'], right: 0 },
|
||||
grid: { top: 70, right: 80, bottom: 30, left: 80 },
|
||||
grid: { top: 100, right: 30, bottom: 100, left: 50 },
|
||||
xAxis: [
|
||||
{
|
||||
type: 'category',
|
||||
data: ['1km', '2km', '3km', '4km', '5km', '6km'],
|
||||
boundaryGap: true,
|
||||
data: abilities,
|
||||
axisTick: { show: false },
|
||||
axisLabel: {
|
||||
color: state.charts.color,
|
||||
interval: 0,
|
||||
rotate: 30,
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: { color: state.charts.color },
|
||||
},
|
||||
},
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
name: '供回温度(℃)',
|
||||
nameLocation: 'middle',
|
||||
nameTextStyle: { padding: [3, 4, 50, 6] },
|
||||
type: 'value',
|
||||
name: '使用次数',
|
||||
nameTextStyle: { padding: [0, 0, 10, 0] },
|
||||
splitLine: { show: true, lineStyle: { type: 'dashed', color: '#f5f5f5' } },
|
||||
axisLine: { show: false },
|
||||
axisTick: { show: false },
|
||||
axisLabel: { color: state.charts.color, formatter: '{value} ' },
|
||||
},
|
||||
{
|
||||
name: '压力值(Mpa)',
|
||||
nameLocation: 'middle',
|
||||
nameTextStyle: { padding: [50, 4, 5, 6] },
|
||||
splitLine: { show: false },
|
||||
axisLine: { show: false },
|
||||
axisTick: { show: false },
|
||||
axisLabel: { color: state.charts.color, formatter: '{value} ' },
|
||||
axisLabel: { color: state.charts.color, formatter: '{value}' },
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '供温',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
showSymbol: true,
|
||||
// 矢量画五角星
|
||||
symbol: 'path://M150 0 L80 175 L250 75 L50 75 L220 175 Z',
|
||||
symbolSize: 12,
|
||||
yAxisIndex: 0,
|
||||
areaStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{ offset: 0, color: 'rgba(250,180,101,0.3)' },
|
||||
{ offset: 1, color: 'rgba(250,180,101,0)' },
|
||||
]),
|
||||
shadowColor: 'rgba(250,180,101,0.2)',
|
||||
shadowBlur: 20,
|
||||
},
|
||||
itemStyle: { color: '#FF8000' },
|
||||
// data中可以使用对象,value代表相应的值,另外可加入自定义的属性
|
||||
data: [
|
||||
{ value: 1, stationName: 's1' },
|
||||
{ value: 3, stationName: 's2' },
|
||||
{ value: 4, stationName: 's3' },
|
||||
{ value: 9, stationName: 's4' },
|
||||
{ value: 3, stationName: 's5' },
|
||||
{ value: 2, stationName: 's6' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '回温',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
showSymbol: true,
|
||||
symbol: 'emptyCircle',
|
||||
symbolSize: 12,
|
||||
yAxisIndex: 0,
|
||||
areaStyle: {
|
||||
color: new echarts.graphic.LinearGradient(
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
[
|
||||
{ offset: 0, color: 'rgba(199, 237, 250,0.5)' },
|
||||
{ offset: 1, color: 'rgba(199, 237, 250,0.2)' },
|
||||
],
|
||||
false
|
||||
),
|
||||
},
|
||||
name: '使用次数',
|
||||
type: data.length ? 'bar' : 'line', // 无数据时显示为一条线
|
||||
barWidth: '40%',
|
||||
itemStyle: {
|
||||
color: '#3bbc86',
|
||||
color: data.length ? new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{ offset: 0, color: 'rgba(108,80,243,0.8)' },
|
||||
{ offset: 1, color: 'rgba(108,80,243,0.3)' },
|
||||
]) : undefined, // 符合bar和line样式
|
||||
borderRadius: [5, 5, 0, 0],
|
||||
},
|
||||
data: [
|
||||
{ value: 31, stationName: 's1' },
|
||||
{ value: 36, stationName: 's2' },
|
||||
{ value: 54, stationName: 's3' },
|
||||
{ value: 24, stationName: 's4' },
|
||||
{ value: 73, stationName: 's5' },
|
||||
{ value: 22, stationName: 's6' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '压力值(Mpa)',
|
||||
type: 'bar',
|
||||
barWidth: 30,
|
||||
yAxisIndex: 1,
|
||||
itemStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{ offset: 0, color: 'rgba(108,80,243,0.3)' },
|
||||
{ offset: 1, color: 'rgba(108,80,243,0)' },
|
||||
]),
|
||||
//柱状图圆角
|
||||
borderRadius: [30, 30, 0, 0],
|
||||
},
|
||||
data: [
|
||||
{ value: 11, stationName: 's1' },
|
||||
{ value: 34, stationName: 's2' },
|
||||
{ value: 54, stationName: 's3' },
|
||||
{ value: 39, stationName: 's4' },
|
||||
{ value: 63, stationName: 's5' },
|
||||
{ value: 24, stationName: 's6' },
|
||||
],
|
||||
data: numbers,
|
||||
},
|
||||
],
|
||||
};
|
||||
@ -504,6 +497,8 @@ const initEchartsResize = () => {
|
||||
// 页面加载时
|
||||
onMounted(() => {
|
||||
initEchartsResize();
|
||||
getList();
|
||||
fetchChartData(); // 初始加载无参数调用
|
||||
});
|
||||
// 由于页面缓存原因,keep-alive
|
||||
onActivated(() => {
|
||||
@ -551,7 +546,7 @@ $homeNavLengh: 8;
|
||||
.home-card-three {
|
||||
.home-card-item {
|
||||
width: 100%;
|
||||
height: 130px;
|
||||
height: auto;
|
||||
border-radius: 4px;
|
||||
transition: all ease 0.3s;
|
||||
padding: 20px;
|
||||
@ -593,7 +588,8 @@ $homeNavLengh: 8;
|
||||
.home-card-two,
|
||||
.home-card-three {
|
||||
.home-card-item {
|
||||
height: 400px;
|
||||
// height: 600px;
|
||||
height: 700px;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
.home-monitor {
|
||||
@ -630,4 +626,15 @@ $homeNavLengh: 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.date-picker-container {
|
||||
margin-bottom: 10px; /* 添加与标题的间距 */
|
||||
}
|
||||
|
||||
.chart-title {
|
||||
margin-bottom: 0px; /* 标题与图表之间的间距 */
|
||||
font-size: 16px; /* 可调整为合适大小 */
|
||||
font-weight: bold; /* 字体加粗,增强可读性 */
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
</style>
|
@ -40,12 +40,12 @@
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-form-item label="手机号" >
|
||||
<el-input v-model="state.ruleForm.phone" placeholder="请输入手机号" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="邮箱" prop="mail">
|
||||
<el-form-item label="邮箱" >
|
||||
<el-input v-model="state.ruleForm.mail" placeholder="请输入" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -123,8 +123,8 @@ const state = reactive({
|
||||
rules:{
|
||||
username:{ required: true, message: '请输入账户名称', trigger:'blur'},
|
||||
acgroup:{ required: true, message: '请选择关联角色', trigger:'change'},
|
||||
phone:{ required: true, message: '请输入手机号', trigger:'blur'},
|
||||
mail:{ required: true, message: '请输入邮箱', trigger:'blur'},
|
||||
// phone:{ required: true, message: '请输入手机号', trigger:'blur'},
|
||||
// mail:{ required: true, message: '请输入邮箱', trigger:'blur'},
|
||||
password:{ required: true, message: '请输入账户密码', trigger:'blur'},
|
||||
},
|
||||
// deptData: [] as DeptTreeType[], // 部门数据
|
||||
|
Loading…
Reference in New Issue
Block a user