更新表格样式

This commit is contained in:
王博冉
2022-11-15 11:55:26 +08:00
parent e0bde94e5d
commit a60a8a1240
29 changed files with 102 additions and 94 deletions

View File

@@ -60,7 +60,7 @@ export default function useGeneratorTableColumns(columns, options = {}) {
dataIndex: key,
width: key === options.left_fixed_key ? 100 : includeSpecialType(value.question_type) ? 300 : 200,
fixed: key === options.fixed,
align: 'center',
// align: 'center',
slots: { customRender: key }
}))
return previousValue.concat(arr)

View File

@@ -19,7 +19,7 @@
</div>
</div>
<div>
<a-table :columns="columns" :data-source="dataSource" :pagination="false" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :rowKey="(record,index)=> record.id">
<a-table class="pro-table" :columns="columns" :data-source="dataSource" :pagination="false" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :rowKey="(record,index)=> record.id">
<template #action="{ record }">
<a-button type="link" @click="checkInfo($event,record)">查看</a-button>
<a-dropdown>
@@ -81,7 +81,7 @@ const columns = [
title: "分析名称",
key: "title",
dataIndex: "title",
align: "center",
// align: "center",
slots: {
customRender: "titles",
},
@@ -90,7 +90,7 @@ const columns = [
title: "交叉行/列",
key: "question_index",
dataIndex: "question_index",
align: "center",
// align: "center",
slots: {
customRender: "tag",
},
@@ -99,7 +99,7 @@ const columns = [
title: "提交时间",
key: "created_at",
dataIndex: "created_at",
align: "center",
// align: "center",
sorter: (a, b) => { return a.time> b.time? 1 : -1 },
slots: {
customRender: "createdAt",
@@ -109,13 +109,13 @@ const columns = [
title: "样本数量",
key: "sample_num",
dataIndex: "sample_num",
align: "center",
// align: "center",
},
{
title: "操作",
dataIndex: "action",
key: "action",
align: "center",
// align: "center",
slots: {
customRender: "action",
},
@@ -319,10 +319,14 @@ setup(props) {
}
}
.pagination {
display: inline-flex;
position: relative;
left: 100%;
transform: translateX(-100%);
margin-top: 0;
display: inline-flex;
position: relative;
left: 100%;
transform: translateX(-100%);
margin-top: 0;
}
.pro-table:deep(.ant-btn) {
padding: 0;
padding-right: 10px;
}
</style>

View File

@@ -54,7 +54,7 @@ const tableColumns = computed(() => {
key: item.key,
slots: { customRender: item.key },
width: 100,
align: 'center'
// align: 'center'
}
})
})

View File

@@ -91,7 +91,7 @@ export default defineComponent({
key: "index",
dataIndex: "index",
width: 50,
align: "center",
// align: "center",
},
{
title: () => (
@@ -107,7 +107,7 @@ export default defineComponent({
key: "title",
dataIndex: "title",
slots: { customRender: "title" },
align: "center",
// align: "center",
},
{
title: "操作",
@@ -115,7 +115,7 @@ export default defineComponent({
dataIndex: "operation",
slots: { customRender: "operation" },
width: 160,
align: "center",
// align: "center",
},
]);

View File

@@ -105,7 +105,7 @@ function init(data) {
sorter: setSort(item, data.head),
slots: { customRender: item.key },
width: 140,
align: "center",
// align: "center",
};
});
}

View File

@@ -187,7 +187,7 @@ export default defineComponent({
dataIndex: item.key,
slots: { customRender: item.key },
width: 100,
align: "center",
// align: "center",
fixed: index === 0 ? 'left' : null
};
});

View File

@@ -121,7 +121,7 @@ export default defineComponent({
key: item.key,
slots: { customRender: item.key },
width: 100,
align: "center",
// align: "center",
fixed: index === 0 ? "left" : null,
};
}) || [];

View File

@@ -131,7 +131,7 @@ export default defineComponent({
key: item.key,
slots: { customRender: item.key },
width: 100,
align: "center",
// align: "center",
fixed: index === 0 ? "left" : null,
};
});

View File

@@ -132,7 +132,7 @@ watch(
key: item.key,
slots: { customRender: item.key },
width: 100,
align: "center",
// align: "center",
fixed: index === 0 ? "left" : null,
};
});

View File

@@ -135,7 +135,7 @@ watch(
key: item.key,
slots: { customRender: item.key },
width: 100,
align: "center",
// align: "center",
fixed: index === 0 ? "left" : null,
};
});

View File

@@ -127,7 +127,7 @@ watch(
key: item.key,
slots: { customRender: item.key },
width: 100,
align: "center",
// align: "center",
fixed: index === 0 ? "left" : null,
};
});

View File

@@ -135,7 +135,7 @@ watch(
key: item.key,
slots: { customRender: item.key },
width: 100,
align: "center",
// align: "center",
fixed: index === 0 ? "left" : null,
};
});

View File

@@ -135,7 +135,7 @@ watch(
key: item.key,
slots: { customRender: item.key },
width: 100,
align: "center",
// align: "center",
fixed: index === 0 ? "left" : null,
};
});

View File

@@ -14,14 +14,14 @@ import {ref} from 'vue'
const style1 ={color: '#d3d3d3'}
const style ={color:'#1890ff'}
const mockData = []
const mockColumns = [{title: '做答ID', dataIndex: 'id', key: 'id', width: 200, align: 'center', fixed: 'left'}]
const mockColumns = [{title: '做答ID', dataIndex: 'id', key: 'id', width: 200, fixed: 'left'}]
for(let i = 0; i<30; i++) {
mockColumns.push({
title: `场景${i}`,
dataIndex: `scene${i}`,
key: `scene${i}`,
width: 200,
align: 'center',
// align: 'center',
customCell: (record) => {
for(let k in record) {
return {

View File

@@ -18,13 +18,13 @@ const tableColumns = ref([
dataIndex: 'id',
key: 'id',
width: 200,
align: 'center',
// align: 'center',
},
{
title: '选项名称',
dataIndex: 'name',
key: 'name',
align: 'center',
// align: 'center',
customCell: () => {
return {
style: {
@@ -37,7 +37,7 @@ const tableColumns = ref([
title: '效用值',
dataIndex: 'percent',
key: 'percent',
align: 'center',
// align: 'center',
customCell: (record) => {
return {
style: {

View File

@@ -20,7 +20,7 @@ watch(() => props.info, (info) => {
return {
...item,
width: 200,
align: 'center',
// align: 'center',
dataIndex: item.key,
fixed: item.key === "answer_id" ? 'left' : null
}

View File

@@ -103,33 +103,33 @@ const columns= [
title: '不喜欢(1分)',
dataIndex: 'one',
key: 'one',
align:'center',
// align:'center',
slots: { customRender: 'one' }
},{
title: '能忍受(2分)',
dataIndex: 'two',
key: 'two',
align:'center',
// align:'center',
slots: { customRender: 'two' }
},{
title: '无所谓(3分)',
dataIndex: 'three',
key: 'three',
align:'center',
// align:'center',
slots: { customRender: 'three' }
},{
title: '理应如此(4分)',
dataIndex: 'four',
key: 'four',
align:'center',
// align:'center',
slots: { customRender: 'four' }
},{
title: '喜欢(5分)',
dataIndex: 'five',
key: 'five',
align:'center',
// align:'center',
slots: { customRender: 'five' }
}]

View File

@@ -247,14 +247,14 @@ const columns = [
dataIndex: "title",
key: "title",
slots: { customRender: "title" },
align: "center",
// align: "center",
},
{
title: "状态",
dataIndex: "status_str",
key: "status_str",
slots: { customRender: "status_str" },
align: "center",
// align: "center",
width: 200,
},
{
@@ -263,13 +263,13 @@ const columns = [
key: "finished_at",
slots: { customRender: "finished_at" },
sorter: true,
align: "center",
// align: "center",
},
{
title: "操作",
key: "action",
slots: { customRender: "action" },
align: "center",
// align: "center",
},
];

View File

@@ -24,7 +24,7 @@
<div class="table-container" v-if="true" :style="total <= 0 ? 'margin: 20px 0 0 0;' : ''">
<DataTable :has-selection="false" :params="searchParams" :per-page="per_page" :page="page" :sn="sn" :table-columns="columns" :table-source="tableData" :total="total" @change="onPageChange" @select="onSelectChange" @sign="Sign">
<template #operation="{ record }">
<a @click="openDetailModal(record)">查看</a>
<a @click="openDetailModal(record)" style="margin-right:5px">查看</a>
<!-- <a style="margin: 10px" @click="openDetailModal(record)">编辑</a> -->
<a-dropdown :trigger="['click']">
<a class="ant-dropdown-link" @click.prevent>

View File

@@ -154,7 +154,7 @@ const columns = ref([
title: '问卷标题',
key: 'project_name',
dataIndex: 'project_name',
align: 'center',
// align: 'center',
width: 110,
fixed: 'left',
slots: {
@@ -165,7 +165,7 @@ const columns = ref([
title: '问卷标签',
key: 'tag[0].title',
dataIndex: 'tag[0].title',
align: 'center',
// align: 'center',
width: 110,
slots: {
customRender: 'tag'
@@ -175,7 +175,7 @@ const columns = ref([
title: '问卷状态',
key: 'status_txt',
dataIndex: 'status_txt',
align: 'center',
// align: 'left',
width: 110,
slots: {
customRender: 'status_txt'
@@ -186,13 +186,13 @@ const columns = ref([
key: 'owner_name',
dataIndex: 'owner_name',
width: 100,
align: 'center'
// align: 'center'
},
{
title: '所属事业部',
key: 'business_name',
dataIndex: 'business_name',
align: 'center',
// align: 'center',
width: 130
// slots: {
// customRender: "business_name",
@@ -203,7 +203,7 @@ const columns = ref([
key: 'dept_name',
dataIndex: 'dept_name',
width: 110,
align: 'center'
// align: 'center'
// slots: {
// customRender: "dept_name",
// },
@@ -213,21 +213,21 @@ const columns = ref([
key: 'created_at',
dataIndex: 'created_at',
width: 110,
align: 'center'
// align: 'center'
},
{
title: '样本回收总量',
key: 'answer_count',
dataIndex: 'answer_count',
width: 125,
align: 'center'
// align: 'center'
},
{
title: '有效回收数量',
key: 'answer_valid_complete_count',
dataIndex: 'answer_valid_complete_count',
width: 125,
align: 'center'
// align: 'center'
}
])
const checked = ref(0)
@@ -564,7 +564,7 @@ const countColor = (value) => {
.status-text {
font-size: 14px;
display: flex;
justify-content: center;
// justify-content: center;
align-items: center;
&::before {
content: '';

View File

@@ -45,7 +45,7 @@ const columns = [
title: "文件名称",
key: "file_name",
dataIndex: "file_name",
align: "center",
// align: "center",
slots: {
customRender: "file_name",
},
@@ -54,7 +54,7 @@ const columns = [
title: "时间",
key: "created_at",
dataIndex: "created_at",
align: "center",
// align: "center",
// sorter: true,
sorter: (a, b) => { return a.time> b.time? 1 : -1 },
},
@@ -62,7 +62,7 @@ const columns = [
title: "文件大小",
key: "file_size",
dataIndex: "file_size",
align: "center",
// align: "center",
slots: {
customRender: "file_size",
},
@@ -71,7 +71,7 @@ const columns = [
title: "状态",
dataIndex: "status_str",
key: "status_str",
align: "center",
// align: "center",
slots: {
customRender: "status_str",
},

View File

@@ -40,14 +40,14 @@ export default defineComponent({
title: '模版标题',
key: 'title',
dataIndex: 'title',
align: 'center',
// align: 'center',
sorter: true
},
{
title: '创建人',
key: 'created_user',
dataIndex: 'created_user',
align: 'center'
// align: 'center'
// sorter: true,
},
@@ -55,14 +55,14 @@ export default defineComponent({
title: '创建时间',
key: 'created_at',
dataIndex: 'created_at',
align: 'center',
// align: 'center',
sorter: true
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
align: 'center',
// align: 'center',
slots: {
customRender: 'action'
}

View File

@@ -269,9 +269,9 @@ const columns = [
title: "问卷名称",
key: "project_name",
dataIndex: "project_name",
align: "center",
// align: "center",
sorter: true,
width: 150,
width: 260,
slots: {
customRender: "titles",
},
@@ -280,7 +280,7 @@ const columns = [
title: "问卷标签",
key: "tag[0].title",
dataIndex: "tag[0].title",
align: "center",
// align: "center",
slots: {
customRender: "tag",
},
@@ -290,7 +290,7 @@ const columns = [
title: "问卷状态",
key: "status",
dataIndex: "status",
align: "center",
// align: "center",
width: 120,
sorter: true,
slots: {
@@ -302,28 +302,28 @@ const columns = [
key: "answer_num",
width: 100,
dataIndex: "answer_num",
align: "center",
// align: "center",
},
{
title: "所有者",
key: "owner",
width: 100,
dataIndex: "owner",
align: "center",
// align: "center",
},
{
title: "最近编辑",
key: "updated_user",
width: 100,
dataIndex: "updated_user",
align: "center",
// align: "center",
},
{
title: "创建时间",
key: "created_at",
width: 150,
dataIndex: "created_at",
align: "center",
// align: "center",
sorter: true,
},
{
@@ -331,7 +331,7 @@ const columns = [
key: "updated_at",
width: 150,
dataIndex: "updated_at",
align: "center",
// align: "center",
sorter: true,
},
{
@@ -339,7 +339,7 @@ const columns = [
width: 200,
dataIndex: "action",
key: "action",
align: "center",
// align: "center",
fixed: "right",
slots: {
customRender: "action",
@@ -795,7 +795,7 @@ export default defineComponent({
.status-text {
font-size: 14px;
display: flex;
justify-content: center;
// justify-content: center;
align-items: center;
&::before {
content: "";

View File

@@ -182,21 +182,21 @@ export default {
{
title: "应用名称",
dataIndex: "applicationChineseName",
align: "center",
// align: "center",
key: "applicationChineseName",
isShow: false,
},
{
title: "应用名称(英文)",
dataIndex: "applicationName",
align: "center",
// align: "center",
key: "applicationName",
isShow: false,
},
{
title: "应用负责人(及电话)",
dataIndex: "systemAdministrator",
align: "center",
// align: "center",
key: "systemAdministrator",
slots: { customRender: "systemAdministrator" },
isShow: false,

View File

@@ -179,14 +179,14 @@ export default {
{
title: "接收应用",
dataIndex: "applicationChineseName",
align: "center",
// align: "center",
width: "25%",
key: "applicationChineseName",
},
{
title: "已有样本数量",
dataIndex: "answer_samples",
align: "center",
// align: "center",
width: "25%",
slots: { customRender: "answer_samples" },
key: "answer_samples",
@@ -194,7 +194,7 @@ export default {
{
dataIndex: "num",
key: "num",
align: "center",
// align: "center",
slots: { title: "numTitle", customRender: "num" },
align: "right",
},

View File

@@ -94,20 +94,20 @@ export default {
{
title: "接收应用",
dataIndex: "applicationChineseName",
align: "center",
// align: "center",
key: "applicationChineseName",
},
{
title: "应用负责人电话",
dataIndex: "systemAdministratorPhone",
align: "center",
// align: "center",
slots: { customRender: "systemAdministrator" },
key: "systemAdministratorPhone",
},
{
dataIndex: "num",
key: "num",
align: "center",
// align: "center",
slots: { title: "numTitle", customRender: "num" },
align: "right",
},
@@ -128,7 +128,7 @@ export default {
dataIndex: "action",
key: "action",
width: "80px",
align: "center",
// align: "center",
slots: { customRender: "action" },
});
}

View File

@@ -102,20 +102,20 @@ export default {
{
title: "创建人",
dataIndex: "creater",
align: "center",
// align: "center",
key: "creater",
},
{
title: "创建时间",
dataIndex: "created_at",
align: "center",
// align: "center",
key: "created_at",
},
{
title: "操作",
dataIndex: "action",
key: "action",
align: "center",
// align: "center",
width: "200px",
slots: { customRender: "action" },
},

View File

@@ -92,14 +92,14 @@
<template #action="{ record }">
<!-- <a style="margin-right: 10px;" @click="showDrawer($event,record)">查看详情</a> -->
<a @click="editClick(record)" style="margin-right: 12px">编辑</a>
<a @click="editStateClick(record)" v-if="record.status == 1" style="margin-right: 12px"
<a @click="editClick(record)" style="margin-right: 10px">编辑</a>
<a @click="editStateClick(record)" v-if="record.status == 1" style="margin-right: 10px"
>暂停</a
>
<a @click="editStateClick(record)" v-if="record.status == 0" style="margin-right: 12px"
<a @click="editStateClick(record)" v-if="record.status == 0" style="margin-right: 10px"
>启动</a
>
<a @click="delClick(record.id)" style="margin-right: 12px">删除</a>
<a @click="delClick(record.id)" style="margin-right: 10px">删除</a>
<!-- <a-dropdown>
<a
class="ant-dropdown-link"

View File

@@ -66,7 +66,7 @@
<a
class="ant-dropdown-link"
:class="{ 'ant-dropdown-link-disable': record.type === 1 }"
style="display: inline-block"
style="display: inline-block;"
@click.prevent
>
更多
@@ -185,7 +185,7 @@ const columns = [
width: 300,
key: "title",
dataIndex: "title",
align: "center",
// align: "center",
sorter: true,
slots: {
customRender: "title",
@@ -194,7 +194,7 @@ const columns = [
{
title: "模板标签",
width: 300,
align: "center",
// align: "center",
slots: {
customRender: "tag",
},
@@ -204,7 +204,7 @@ const columns = [
width: 200,
key: "created_user",
dataIndex: "created_user",
align: "center",
// align: "center",
// sorter: true,
},
{
@@ -212,15 +212,15 @@ const columns = [
width: 300,
key: "created_at",
dataIndex: "created_at",
align: "center",
// align: "center",
sorter: true,
},
{
title: "操作",
width: 300,
width: 200,
dataIndex: "action",
key: "action",
align: "center",
// align: "center",
fixed: "right",
slots: {
customRender: "action",
@@ -586,6 +586,10 @@ export default defineComponent({
color: #434343;
background: #f5f5f5;
}
.pro-table:deep(.ant-btn) {
padding: 0;
padding-right: 10px;
}
.pro-cont {
padding: 0 32px;
}