添加首页功能

This commit is contained in:
yangjun 2023-04-10 21:26:47 +08:00
parent 1702dcbe47
commit bcfb206506
12 changed files with 782 additions and 22 deletions

View File

@ -82,7 +82,7 @@
},
},
emits: ['options-change', 'change'],
setup(props, { emit, refs }) {
setup(props, { emit }) {
const dictOptions = ref<any[]>([]);
const attrs = useAttrs();
const [state, , , formItemContext] = useRuleFormItem(props, 'value', 'change');

View File

@ -1,24 +1,37 @@
<template>
<IndexDef v-if="indexStyle === 0"></IndexDef>
<IndexChart v-if="indexStyle === 1"></IndexChart>
<IndexBdc v-if="indexStyle == 2"></IndexBdc>
<IndexTask v-if="indexStyle == 3"></IndexTask>
<div style="width: 100%; text-align: right; margin-top: 20px">
请选择首页样式
<a-radio-group v-model:value="indexStyle">
<a-radio :value="0">默认</a-radio>
<a-radio :value="1">销量统计</a-radio>
<a-radio :value="2">业务统计</a-radio>
<a-radio :value="3">我的任务</a-radio>
</a-radio-group>
<div style="max-width: 1430px;">
<a-row>
<a-col :span="16">
<tpkztj ref="tpkztjModal"></tpkztj>
</a-col>
<a-col :span="8">
<zxdt ref="zxdtModal"></zxdt>
</a-col>
<a-col :span="24">
<tpkfgl ref="tpkfglModal"></tpkfgl>
</a-col>
<a-col :span="24">
<tpkqk ref="tpkqkModal"></tpkqk>
</a-col>
</a-row>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import IndexDef from './homePage/IndexDef.vue';
import IndexChart from './homePage/IndexChart.vue';
import IndexBdc from './homePage/IndexBdc.vue';
import IndexTask from './homePage/IndexTask.vue';
const indexStyle = ref(0);
<script lang="ts" name="kcpingke-pktjmain" setup>
import tpkztj from '/@/views/kc/index/tpkztj/tpkztj.vue'//
import zxdt from '/@/views/kc/tktj/zxdt/zxdt.vue'//
import tpkfgl from '/@/views/kc/index/tpkfgl/tpkfgl.vue'//
import tpkqk from '/@/views/kc/index/tpkqk/tpkqk.vue'//
</script>
<style scoped>
.tktjClass{
background-color: #fff;
margin: 10px;
padding: 10px;
min-height: 420px;
}
</style>

View File

@ -0,0 +1,37 @@
<template>
<div style="max-width: 1430px;">
<a-row>
<a-col :span="16">
<tpkztj ref="tpkztjModal"></tpkztj>
</a-col>
<a-col :span="8">
<zxdt ref="zxdtModal"></zxdt>
</a-col>
<a-col :span="24">
<tpkfgl ref="tpkfglModal"></tpkfgl>
</a-col>
<a-col :span="24">
<tpkqk ref="tpkqkModal"></tpkqk>
</a-col>
</a-row>
</div>
</template>
<script lang="ts" name="kcpingke-pktjmain" setup>
import tpkztj from './tpkztj/tpkztj.vue'//
import zxdt from '/@/views/kc/tktj/zxdt/zxdt.vue'//
import tpkfgl from './tpkfgl/tpkfgl.vue'//
import tpkqk from './tpkqk/tpkqk.vue'//
</script>
<style scoped>
.tktjClass{
background-color: #fff;
margin: 10px;
padding: 10px;
min-height: 420px;
}
</style>

View File

@ -0,0 +1,61 @@
<template>
<div class="tktjClass">
<a-row>
<a-col :span="24" style="text-align: center;"><strong style="font-size: 16px;">听评课周统计</strong></a-col>
<a-col :span="24">
<a-row>
<a-col :span="6">
<a-form-item label="" style="padding: 10px;">
<JDictSelectTag placeholder="课程性质" v-model:value="queryParam.kcxz" dictCode="kc_kcxz" @change="loadData"/>
</a-form-item>
</a-col>
</a-row>
</a-col>
<a-col :span="24">
<div style="margin-top:0px;z-index: 0;">
<tkfglTjt :chartData="barMultiData" height="300px" type="line"></tkfglTjt>
</div>
</a-col>
</a-row>
</div>
</template>
<script lang="ts" name="kcTingke-tpkfgl" setup>
import { ref,reactive,onMounted } from 'vue';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import tkfglTjt from '/@/views/kc/index/tpkfgl/tpkfglTjt.vue';
import { dateFormat } from '/@/utils/common/compUtils';
import { defHttp } from '/@/utils/http/axios';
const barMultiData = reactive<any>([]);
const queryParam = ref<any>({});
const list = (queryParam) => defHttp.get({ url: '/kcTingke/kcTingke/getIndexTpkfglList', params:queryParam });
//
onMounted(() => {
const format = 'yyyy-MM-dd';
const startTime = new Date('2023-02-19');
queryParam.value.startTime = dateFormat(startTime, format)
queryParam.value.endTime = dateFormat(new Date(), format)
loadData()
});
function loadData(){
barMultiData.length = 0
list(queryParam.value).then(res=>{
var list = res
for(var i=0;i<list.length;i++){
barMultiData.push({name: list[i].dwjc, value: parseFloat(list[i].ljtkv), type: '累计听课率', seriesType: 'bar'})
barMultiData.push({name: list[i].dwjc, value: parseFloat(list[i].avgtkv), type: '累计全校平均听课率', seriesType: 'line'})
barMultiData.push({name: list[i].dwjc, value: parseFloat(list[i].pkrc), type: '累计评课率', seriesType: 'bar'})
barMultiData.push({name: list[i].dwjc, value: parseFloat(list[i].ljqxpkrl), type: '累计全校平均评课率', seriesType: 'line'})
barMultiData.push({name: list[i].dwjc, value: parseFloat(list[i].jrtkv), type: '今日听课率', seriesType: 'line'})
barMultiData.push({name: list[i].dwjc, value: parseFloat(list[i].jravgtkv), type: '今日全校平均听课率', seriesType: 'line'})
}
})
}
</script>
<style lang="less" scoped>
</style>

View File

@ -0,0 +1,105 @@
<template>
<div ref="chartRef" :style="{ height, width }"></div>
</template>
<script lang="ts">
import { defineComponent, PropType, ref, Ref, reactive, watchEffect,onMounted } from 'vue';
import { useECharts } from '/@/hooks/web/useECharts';
export default defineComponent({
name: 'lineMulti',
props: {
chartData: {
type: Array,
default: () => [],
required: true,
},
option: {
type: Object,
default: () => ({}),
},
type: {
type: String as PropType<string>,
default: 'bar',
},
width: {
type: String as PropType<string>,
default: '100%',
},
height: {
type: String as PropType<string>,
default: 'calc(100vh - 78px)',
},
},
emits: ['click'],
setup(props, { emit }) {
const chartRef = ref<HTMLDivElement | null>(null);
const { setOptions, getInstance } = useECharts(chartRef as Ref<HTMLDivElement>);
const option = reactive({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
label: {
show: true,
backgroundColor: '#333',
},
},
},
legend: {
bottom: 0,
},
grid: {
top: 10,
bottom: 60,
left: 30,
right: 10,
},
xAxis: {
type: 'category',
data: [],
axisLabel:{interval:0}
},
yAxis: {
type: 'value',
},
series: [],
});
watchEffect(() => {
props.chartData && initCharts();
});
onMounted(() => {
initCharts();
})
function initCharts() {
if (props.option) {
Object.assign(option, props.option);
}
//
let typeArr = Array.from(new Set(props.chartData.map((item) => item.type)));
//
let xAxisData = Array.from(new Set(props.chartData.map((item) => item.name)));
let seriesData = [];
typeArr.forEach((type) => {
let obj = { name: type, type: props.type };
let chartArr = props.chartData.filter((item) => type === item.type);
//data
obj['data'] = chartArr.map((item) => item.value);
seriesData.push(obj);
});
option.series = seriesData;
option.xAxis.data = xAxisData;
setOptions(option);
getInstance()?.off('click', onClick);
getInstance()?.on('click', onClick);
}
function onClick(params) {
emit('click', params);
}
return { chartRef,initCharts };
},
});
</script>

View File

@ -0,0 +1,72 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/kcTingke/kcTingke/getKkdwlist',
save='/kcTingke/kcTingke/add',
edit='/kcTingke/kcTingke/edit',
deleteOne = '/kcTingke/kcTingke/delete',
deleteBatch = '/kcTingke/kcTingke/deleteBatch',
importExcel = '/kcTingke/kcTingke/importExcel',
exportXls = '/kcTingke/kcTingke/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
* @param params
* @param handleSuccess
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
* @param handleSuccess
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
* @param isUpdate
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params }, { isTransformResponse: false });
}

View File

@ -0,0 +1,94 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '行号',
align: "center",
dataIndex: '$no',
width: '50px',
customRender: (r) => {
return r.index+1;
}
},
{
title: '开课单位',
align: "center",
dataIndex: 'kkdw'
},
{
title: '开课课堂数',
align: "center",
dataIndex: 'kkkts'
},
{
title: '听课课堂数',
children: [
{
title: '总数',
dataIndex: 'tkkts',
key: 'tkkts',
},
{
title: '本单位数',
dataIndex: 'bdwtks',
key: 'bdwtks',
},
],
},
{
title: '评课课堂数',
children: [
{
title: '总数',
dataIndex: 'pkkts',
key: 'pkkts',
},
{
title: '本单位数',
dataIndex: 'bdwpks',
key: 'bdwpks',
},
],
},
{
title: '听课人次数',
children: [
{
title: '总人次数',
dataIndex: 'tkrcs',
key: 'tkrcs',
},
{
title: '本单位人次数',
dataIndex: 'bdwtkrcs',
key: 'bdwtkrcs',
},
],
},
{
title: '评课人次数',
children: [
{
title: '总人次数',
dataIndex: 'pkrcs',
key: 'pkrcs',
},
{
title: '本单位人次数',
dataIndex: 'bdwpkrcs',
key: 'bdwpkrcs',
},
],
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
];

View File

@ -0,0 +1,152 @@
<template>
<div class="tktjClass">
<!--查询区域-->
<a-form @keyup.enter.native="searchQuery" :model="queryParam" >
<a-row :gutter="24">
<a-col :span="3">
<a-form-item label="">
<JDictSelectTag placeholder="开课单位" v-model:value="queryParam.kkdw" :dictCode="`kc_kkdw_view,kkdw,kkdw`"/>
</a-form-item>
</a-col>
<a-col :span="3">
<a-form-item label="">
<a-date-picker
:showTime="false"
valueFormat="YYYY-MM-DD"
:placeholder="'请选择开始时间'"
v-model:value="queryParam.startTime"
></a-date-picker>
</a-form-item>
</a-col>
<a-col :span="3">
<a-form-item label="">
<a-date-picker
:showTime="false"
valueFormat="YYYY-MM-DD"
:placeholder="'请选择结束时间'"
v-model:value="queryParam.endTime"
></a-date-picker>
</a-form-item>
</a-col>
<a-col :span="3">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
<!--引用表格-->
<BasicTable @register="registerTable">
</BasicTable>
<!-- 表单区域 -->
</div>
</template>
<script lang="ts" name="kcTingke-kkdw" setup>
import { ref, reactive, onMounted } from 'vue';
import { BasicTable} from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns } from './tpkqk.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './tpkqk.api';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { dateFormat } from '/@/utils/common/compUtils';
const queryParam = ref<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
// title: '',
api: list,
columns,
canResize:true,
useSearchForm: false,
showActionColumn: false,
clickToRowSelect: true,
pagination: {
pageSize: 5
},
beforeFetch: (params) => {
params.column = '',params.order = '';
return Object.assign(params, queryParam.value);
},
},
exportConfig: {
name: "开课单位统计",
url: getExportUrl,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload, }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs: { span: 24 },
sm: { span: 7 },
});
const wrapperCol = reactive({
xs: { span: 24 },
sm: { span: 16 },
});
//
onMounted(() => {
const format = 'yyyy-MM-dd';
const startTime = new Date();
startTime.setTime(startTime.getTime()-60000*60*24*7)
queryParam.value.startTime = dateFormat(startTime, format)
queryParam.value.endTime = dateFormat(new Date(), format)
});
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
queryParam.value = {};
selectedRowKeys.value = [];
//
reload();
}
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust{
width: calc(50% - 15px);
min-width: 100px !important;
}
.query-group-split-cust{
width: 30px;
display: inline-block;
text-align: center
}
}
</style>

View File

@ -0,0 +1,66 @@
<template>
<div class="tktjClass">
<a-row>
<a-col :span="24" style="text-align: center;"><strong style="font-size: 16px;">听评课周统计</strong></a-col>
<a-col :span="24">
<a-row>
<a-col :span="6">
<a-form-item label="" style="padding: 10px;">
<JDictSelectTag placeholder="开课单位" v-model:value="queryParam.kkdw" :dictCode="`kc_kkdw_view,kkdw,kkdw`" @change="loadData"/>
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item label="" style="padding: 10px;">
<JDictSelectTag placeholder="课程性质" v-model:value="queryParam.kcxz" dictCode="kc_kcxz" @change="loadData"/>
</a-form-item>
</a-col>
</a-row>
</a-col>
<a-col :span="24">
<div style="margin-top:0px;z-index: 0;">
<tkztjTjt :chartData="barMultiData" height="300px" type="line"></tkztjTjt>
</div>
</a-col>
</a-row>
</div>
</template>
<script lang="ts" name="kcTingke-tkztj" setup>
import { ref,reactive,onMounted } from 'vue';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import tkztjTjt from '/@/views/kc/index/tpkztj/tpkztjTjt.vue';
import { dateFormat } from '/@/utils/common/compUtils';
import { defHttp } from '/@/utils/http/axios';
const barMultiData = reactive<any>([]);
const queryParam = ref<any>({});
const list = (queryParam) => defHttp.get({ url: '/kcTingke/kcTingke/getIndexTpkztjList', params:queryParam });
//
onMounted(() => {
const format = 'yyyy-MM-dd';
const startTime = new Date();
startTime.setTime(startTime.getTime()-60000*60*24*7)
queryParam.value.startTime = dateFormat(startTime, format)
queryParam.value.endTime = dateFormat(new Date(), format)
loadData()
});
function loadData(){
barMultiData.length = 0
list(queryParam.value).then(res=>{
console.log(`🚀 ~ file: tkztj.vue:59 ~ list ~ res:`, res)
var list = res
for(var i=0;i<list.length;i++){
barMultiData.push({name: list[i].skrq, value: parseInt(list[i].kssl), type: '开课课堂数', seriesType: 'bar'})
barMultiData.push({name: list[i].skrq, value: parseInt(list[i].tkkts), type: '听课课堂数', seriesType: 'line'})
barMultiData.push({name: list[i].skrq, value: parseInt(list[i].tkrcs), type: '听课人次', seriesType: 'line'})
barMultiData.push({name: list[i].skrq, value: parseInt(list[i].pkrc), type: '评课人次', seriesType: 'line'})
}
console.log(`🚀 ~ file: tkztj.vue:67 ~ list ~ barMultiData:`, barMultiData)
})
}
</script>
<style lang="less" scoped>
</style>

View File

@ -0,0 +1,105 @@
<template>
<div ref="chartRef" :style="{ height, width }"></div>
</template>
<script lang="ts">
import { defineComponent, PropType, ref, Ref, reactive, watchEffect,onMounted } from 'vue';
import { useECharts } from '/@/hooks/web/useECharts';
export default defineComponent({
name: 'lineMulti',
props: {
chartData: {
type: Array,
default: () => [],
required: true,
},
option: {
type: Object,
default: () => ({}),
},
type: {
type: String as PropType<string>,
default: 'bar',
},
width: {
type: String as PropType<string>,
default: '100%',
},
height: {
type: String as PropType<string>,
default: 'calc(100vh - 78px)',
},
},
emits: ['click'],
setup(props, { emit }) {
const chartRef = ref<HTMLDivElement | null>(null);
const { setOptions, getInstance } = useECharts(chartRef as Ref<HTMLDivElement>);
const option = reactive({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
label: {
show: true,
backgroundColor: '#333',
},
},
},
legend: {
bottom: 0,
},
grid: {
top: 10,
bottom: 60,
left: 30,
right: 10,
},
xAxis: {
type: 'category',
data: [],
axisLabel:{interval:0}
},
yAxis: {
type: 'value',
},
series: [],
});
watchEffect(() => {
props.chartData && initCharts();
});
onMounted(() => {
initCharts();
})
function initCharts() {
if (props.option) {
Object.assign(option, props.option);
}
//
let typeArr = Array.from(new Set(props.chartData.map((item) => item.type)));
//
let xAxisData = Array.from(new Set(props.chartData.map((item) => item.name)));
let seriesData = [];
typeArr.forEach((type) => {
let obj = { name: type, type: props.type };
let chartArr = props.chartData.filter((item) => type === item.type);
//data
obj['data'] = chartArr.map((item) => item.value);
seriesData.push(obj);
});
option.series = seriesData;
option.xAxis.data = xAxisData;
setOptions(option);
getInstance()?.off('click', onClick);
getInstance()?.on('click', onClick);
}
function onClick(params) {
emit('click', params);
}
return { chartRef,initCharts };
},
});
</script>

View File

@ -1,7 +1,7 @@
<template>
<div class="tktjClass">
<a-row>
<a-col :span="24" style="text-align: center;"><strong style="font-size: 16px;">听课周统计</strong></a-col>
<a-col :span="24" style="text-align: center;"><strong style="font-size: 16px;">评课覆盖率</strong></a-col>
<a-col :span="24">
<a-row>
<a-col :span="6">

View File

@ -3,7 +3,23 @@
<a-row>
<a-col :span="24"><strong style="font-size: 16px;margin-left: 20px;">最新动态</strong></a-col>
<a-col :span="24"><p style="width:100%;height:1px;margin:0px auto;padding:0px;background-color:#D5D5D5;overflow:hidden;margin-top: 5px;"></p></a-col>
<a-col :span="24" style="text-align: center;"><strong style="font-size: 16px;margin-left: 20px;margin-top: 10px;">暂无数据</strong></a-col>
<a-col :span="24" style="text-align: center;" v-show="listData.length==0"><strong style="font-size: 16px;margin-left: 20px;margin-top: 10px;">暂无数据</strong></a-col>
<a-col :span="24" v-show="listData.length>0">
<div style="height: 330px;overflow-y: auto;">
<div style="font-size: 16px;margin-left: 20px;margin-top: 10px;" v-for="(item,index) in listData">
<div v-if="item.type == '1'">
{{item.username}},{{item.kkdw}}的课程
</div>
<div v-else-if="item.type == '2'">
{{item.username}}{{item.kkdw}} 主讲{{item.kcmc}}提交了错误报告
</div>
</div>
</div>
<div style="text-align: center;margin-top: 10px;" v-show="pageNo>0">
<a @click="funMore">更多</a>
</div>
</a-col>
</a-row>
@ -11,8 +27,47 @@
</template>
<script lang="ts" name="kcTingke-zxdt" setup>
import { ref, reactive, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/kcTingke/kcTingke/getHtindexTkmxlist',
}
const list = (params) => defHttp.get({ url: Api.list, params });
const queryParam = ref<any>({});
let listData = ref<any>([]);
let lslist = ref<any>([]);
let pageKs = ref<any>(0);
let pageJs = ref<any>(5);
let pageNo = ref<any>(1);
//
onMounted(() => {
queryParam.value.skrq = '2023-02-19'
queryParam.value.pageKs = pageKs.value
queryParam.value.pageJs = pageJs.value
loadData()
});
function funMore(){
let djy = pageNo.value
queryParam.value.pageKs = djy*5
queryParam.value.pageJs = pageJs.value
console.log(`🚀 ~ file: zxdt.vue:55 ~ funMore ~ queryParam:`, queryParam)
loadData()
}
function loadData(){
list(queryParam.value).then(res => {
lslist = res
console.log(`🚀 ~ file: zxdt.vue:31 ~ list ~ lslist:`, lslist)
if(lslist.length==5){
pageNo.value++;
} else{
pageNo.value = 0;
}
listData.value.push(...lslist)
console.log(`🚀 ~ file: zxdt.vue:43 ~ list ~ listData:`, listData)
})
}
</script>
<style lang="less" scoped>