feat: 优化表格和样式
1. 更新 YlTable 组件,添加圆角和斑马纹样式 2. 修改搜索框边框颜色为绿色(#70b937) 3. 调整分析页面表格列宽和样式 4. 启用首页的我的任务组件 5. 优化分析信息组件的标签样式
This commit is contained in:
1
components.d.ts
vendored
1
components.d.ts
vendored
@@ -24,6 +24,7 @@ declare module 'vue' {
|
|||||||
ElSpace: typeof import('element-plus/es')['ElSpace']
|
ElSpace: typeof import('element-plus/es')['ElSpace']
|
||||||
ElTable: typeof import('element-plus/es')['ElTable']
|
ElTable: typeof import('element-plus/es')['ElTable']
|
||||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
||||||
|
ElTableV2: typeof import('element-plus/es')['ElTableV2']
|
||||||
ElTag: typeof import('element-plus/es')['ElTag']
|
ElTag: typeof import('element-plus/es')['ElTag']
|
||||||
ElText: typeof import('element-plus/es')['ElText']
|
ElText: typeof import('element-plus/es')['ElText']
|
||||||
Index: typeof import('./src/components/Analysis/Index.vue')['default']
|
Index: typeof import('./src/components/Analysis/Index.vue')['default']
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ function handleSearchActino() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
border-radius: 18px;
|
border-radius: 18px;
|
||||||
border: solid 2px var(--primary-color);
|
border: solid 2px #70b937;
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
|
|
||||||
//width: 100vw;
|
//width: 100vw;
|
||||||
|
|||||||
@@ -1,18 +1,60 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const data = defineModel<unknown[]>('data', { default: [] })
|
import { RowAlign, type ColumnStyle } from 'element-plus';
|
||||||
const props = defineModel<{
|
import type { CSSProperties } from 'vue';
|
||||||
prop: any,
|
|
||||||
label: any,
|
const data = defineModel<unknown[]>('data', { default: [] });
|
||||||
width: any
|
const props = defineModel<
|
||||||
}[]>("props")
|
{
|
||||||
|
prop: any;
|
||||||
|
label: any;
|
||||||
|
width: any;
|
||||||
|
}[]
|
||||||
|
>('props');
|
||||||
|
|
||||||
// 是否只显示单行
|
// 是否只显示单行
|
||||||
const singleLine = defineModel<boolean>('singleLine', { default: false })
|
const singleLine = defineModel<boolean>('singleLine', { default: false });
|
||||||
|
const rowStyle = defineModel<ColumnStyle<any>>('rowStyle', {
|
||||||
|
default: {}
|
||||||
|
});
|
||||||
|
const headerStyle = defineModel<ColumnStyle<any>>('headerStyle', {
|
||||||
|
default: {
|
||||||
|
background: 'red'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const rounded = defineModel('rounded', { default: true });
|
||||||
|
const stripeColor = defineModel('stripeColor', { default: 'red' });
|
||||||
|
|
||||||
|
// (data: { row: any; rowIndex: number; }) => string
|
||||||
|
function setStripeColor(rowData: { row: any; rowIndex: number }): string {
|
||||||
|
const { rowIndex } = rowData;
|
||||||
|
return rowIndex % 2 === 0 ? 'even-row' : 'odd-row';
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-table :data="data" style="width: 100%">
|
<div :style="{ borderRadius: rounded ? '10px' : '0', overflow: 'hidden' }">
|
||||||
<el-table-column v-for="item in props" :prop="item.prop" :label="item.label" :width="item.width"
|
<el-table
|
||||||
show-overflow-tooltip />
|
:header-cell-style="{ background: '#f2f8ee' }"
|
||||||
|
:row-class-name="setStripeColor"
|
||||||
|
:data="data"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
v-for="item in props"
|
||||||
|
:prop="item.prop"
|
||||||
|
:label="item.label"
|
||||||
|
:width="item.width"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(.even-row) {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
:deep(.odd-row) {
|
||||||
|
background-color: #fafbfa;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ function handleSearchClick() {
|
|||||||
<!--底部新建问卷-->
|
<!--底部新建问卷-->
|
||||||
<NewSurvey />
|
<NewSurvey />
|
||||||
|
|
||||||
<!-- <mine-task /> -->
|
<mine-task />
|
||||||
|
|
||||||
<navigation />
|
<navigation />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -280,6 +280,7 @@ function copyItem(item: SurveyItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.wrap {
|
.wrap {
|
||||||
|
margin-left: 5px;
|
||||||
padding: 1px 3px;
|
padding: 1px 3px;
|
||||||
border: 2px solid #f5f5f5;
|
border: 2px solid #f5f5f5;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import { currentSurvey, fetchSingleSurvey } from '@/views/Survey/hooks/useSurveyData';
|
import { currentSurvey, fetchSingleSurvey } from '@/views/Survey/hooks/useSurveyData';
|
||||||
import SurveyItem from '@/views/Survey/components/SurveyItem.vue';
|
import SurveyItem from '@/views/Survey/components/SurveyItem.vue';
|
||||||
import LogicInfo from '@/views/Survey/views/Analysis/components/LogicInfo/Index.vue';
|
import LogicInfo from '@/views/Survey/views/Analysis/components/LogicInfo/Index.vue';
|
||||||
import AiInsightResults from '@/views/Survey/views/Analysis/components/AiInsightResults/Index.vue';
|
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import {
|
import {
|
||||||
useFetchAnalysis,
|
useFetchAnalysis,
|
||||||
@@ -47,11 +46,7 @@ useFetchAnalysis(route.query.sn as string);
|
|||||||
</template>
|
</template>
|
||||||
</van-cell>
|
</van-cell>
|
||||||
<!-- 逻辑配额、随机题组配额、循环体配额 表格部分-->
|
<!-- 逻辑配额、随机题组配额、循环体配额 表格部分-->
|
||||||
<van-cell class="logic-info">
|
<logic-info />
|
||||||
<template #extra>
|
|
||||||
<logic-info />
|
|
||||||
</template>
|
|
||||||
</van-cell>
|
|
||||||
|
|
||||||
<van-cell v-if="aiInsightsConfig.message.length > 0" class="ai-insight" :key="route">
|
<van-cell v-if="aiInsightsConfig.message.length > 0" class="ai-insight" :key="route">
|
||||||
<template #extra>
|
<template #extra>
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<section v-for="analysis in questionAnalysis" :key="analysis.stem" class="mt10">
|
<section v-for="analysis in questionAnalysis" :key="analysis.stem" class="mt10">
|
||||||
<el-tag>{{ questionTypeMap.get(analysis.question_type as number) }}</el-tag>
|
<el-tag type="success" size="small">{{
|
||||||
|
questionTypeMap.get(analysis.question_type as number)
|
||||||
|
}}</el-tag>
|
||||||
{{ analysis.stem }}
|
{{ analysis.stem }}
|
||||||
|
|
||||||
<chart-msg :series="formatData(analysis)" v-if="showChart.includes(analysis.question_type)" />
|
<chart-msg :series="formatData(analysis)" v-if="showChart.includes(analysis.question_type)" />
|
||||||
@@ -10,7 +12,7 @@
|
|||||||
:props="getTableHeadProps(analysis.head)"
|
:props="getTableHeadProps(analysis.head)"
|
||||||
:data="analysis.option"
|
:data="analysis.option"
|
||||||
v-if="analysis.head"
|
v-if="analysis.head"
|
||||||
></yl-table>
|
/>
|
||||||
|
|
||||||
<!-- {{ analysis }}-->
|
<!-- {{ analysis }}-->
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import {
|
import {
|
||||||
updateDate, cycle, loading, quota, random
|
updateDate,
|
||||||
|
cycle,
|
||||||
|
loading,
|
||||||
|
quota,
|
||||||
|
random
|
||||||
} from '@/views/Survey/views/Analysis/components/LogicInfo/hooks/useLogicInfo';
|
} from '@/views/Survey/views/Analysis/components/LogicInfo/hooks/useLogicInfo';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import YlTable from '@/components/YlTable/Index.vue';
|
import YlTable from '@/components/YlTable/Index.vue';
|
||||||
@@ -11,46 +15,69 @@ const route = useRoute();
|
|||||||
updateDate(route.query.sn as string);
|
updateDate(route.query.sn as string);
|
||||||
|
|
||||||
const activeTab = ref(0);
|
const activeTab = ref(0);
|
||||||
const tabs = ref<LogicInfoTab[]>([{
|
const tabs = ref<LogicInfoTab[]>([
|
||||||
title: '逻辑配额',
|
{
|
||||||
props: [
|
title: '逻辑配额',
|
||||||
{ prop: 'question_title', label: '题号', width: 120 },
|
props: [
|
||||||
{ prop: 'logic_text', label: '选项', width: 90 },
|
{ prop: 'question_title', label: '题号', width: 120 },
|
||||||
{ prop: 'sample_number', label: '样本量', width: 90 },
|
{ prop: 'logic_text', label: '选项', width: 90 },
|
||||||
{ prop: 'percent', label: '进度', width: 90 }
|
{ prop: 'sample_number', label: '样本量', width: 90 },
|
||||||
],
|
{ prop: 'percent', label: '进度', width: 90 }
|
||||||
data: quota
|
],
|
||||||
}, {
|
data: quota as any
|
||||||
title: '随机题组配额',
|
},
|
||||||
props: [
|
{
|
||||||
{ prop: 'title', label: '题组', width: 120 },
|
title: '随机题组配额',
|
||||||
{ prop: 'group_info', label: '题组位置', width: 120 },
|
props: [
|
||||||
{ prop: 'sample_num', label: '样本量', width: 120 },
|
{ prop: 'title', label: '题组', width: 120 },
|
||||||
{ prop: 'precent', label: '进度', width: 120 }
|
{ prop: 'group_info', label: '题组位置', width: 120 },
|
||||||
],
|
{ prop: 'sample_num', label: '样本量', width: 120 },
|
||||||
data: random
|
{ prop: 'precent', label: '进度', width: 120 }
|
||||||
}, {
|
],
|
||||||
title: '循环题组配额',
|
data: random as any
|
||||||
props: [
|
},
|
||||||
{ prop: 'question_title', label: '关联题目', width: 120 },
|
{
|
||||||
{ prop: 'group_info', label: '题组', width: 120 },
|
title: '循环题组配额',
|
||||||
{ prop: 'sample_num', label: '样本量', width: 120 },
|
props: [
|
||||||
{ prop: 'precent', label: '进度', width: 120 }
|
{ prop: 'question_title', label: '关联题目', width: 150 },
|
||||||
],
|
{ prop: 'group_info', label: '题组', width: 100 },
|
||||||
data: cycle
|
{ prop: 'sample_num', label: '样本量', width: 80 },
|
||||||
}]);
|
{ prop: 'precent', label: '进度', width: 120 }
|
||||||
|
],
|
||||||
|
data: cycle as any
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
const currentTabs = computed(() => {
|
||||||
|
return tabs.value.filter((item) => {
|
||||||
|
return item.data.length > 0;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 自动计算是否有 card 区域
|
||||||
|
const visibleQuestionConfig = computed(() => {
|
||||||
|
return tabs.value.filter((item) => {
|
||||||
|
return item.data.length > 0;
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section style="width:86vw" v-loading="loading">
|
<van-cell class="logic-info" v-if="visibleQuestionConfig">
|
||||||
<!-- tabs 选项列表 -->
|
<template #extra>
|
||||||
<van-tabs v-model:active="activeTab">
|
<section style="width: 86vw" v-loading="loading">
|
||||||
<van-tab v-for="tab in tabs" :key="tab.title">
|
<!-- tabs 选项列表 -->
|
||||||
<template #title>
|
<van-tabs v-model:active="activeTab">
|
||||||
<el-text size="small">{{ tab.title }}</el-text>
|
<van-tab v-for="tab in currentTabs" :key="tab.title">
|
||||||
</template>
|
<template #title>
|
||||||
</van-tab>
|
<el-text size="small">{{ tab.title }}</el-text>
|
||||||
</van-tabs>
|
</template>
|
||||||
<yl-table :data="tabs[activeTab].data" :props="tabs[activeTab].props"></yl-table>
|
</van-tab>
|
||||||
</section>
|
</van-tabs>
|
||||||
|
<yl-table
|
||||||
|
:data="currentTabs[activeTab]?.data"
|
||||||
|
:props="currentTabs[activeTab]?.props"
|
||||||
|
></yl-table>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
</van-cell>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
type LogicInfoTab = {
|
type LogicInfoTab = {
|
||||||
title: string,
|
title: string,
|
||||||
props: unknown,
|
props: unknown,
|
||||||
data: unknown
|
data: [] | any[]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user