update 样式

This commit is contained in:
lb 2023-01-16 17:01:14 +08:00
parent 795fb5642e
commit 712b5937da
7 changed files with 78 additions and 23 deletions

View File

@ -38,7 +38,7 @@
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^4.4.6", "@vue/cli-plugin-babel": "^4.4.6",
"@vue/cli-service": "^4.4.6", "@vue/cli-service": "^4.4.6",
"element-theme-chalk": "^2.15.7", "element-theme-chalk": "^2.15.12",
"natives": "^1.1.6", "natives": "^1.1.6",
"vue-template-compiler": "^2.6.11" "vue-template-compiler": "^2.6.11"
}, },

View File

@ -1,7 +1,19 @@
<!-- 这里单纯的配置表格就好了--> <!-- 这里单纯的配置表格就好了-->
<template> <template>
<div class="base-list-table w-full"> <div class="base-list-table w-full">
<el-table :data="tableData" v-bind="tableConfig" ref="base-list-table"> <el-table
:data="tableData"
v-bind="tableConfig"
ref="base-list-table"
:cell-style="{ padding: 0 }"
:header-cell-style="/** 重写表格样式 **/ {
padding: '8px 0',
}"
:header-row-style="/** 重写表格样式 **/ {
color: 'red',
background: 'black',
}"
>
<!-- @cell-mouse-enter="(row, col, cell, event) => $emit('cell-mouse-enter', row, col, cell, event)"> --> <!-- @cell-mouse-enter="(row, col, cell, event) => $emit('cell-mouse-enter', row, col, cell, event)"> -->
<!-- @cell-mouse-leave="(row, col, cell, event) => $emit('cell-mouse-leave', row, col, cell, event)"> --> <!-- @cell-mouse-leave="(row, col, cell, event) => $emit('cell-mouse-leave', row, col, cell, event)"> -->
<!-- 表格头定义 --> <!-- 表格头定义 -->
@ -22,7 +34,8 @@
} }
: null : null
" "
v-bind="head.more"></el-table-column> v-bind="head.more"
></el-table-column>
<!-- 普通的表头 --> <!-- 普通的表头 -->
<el-table-column <el-table-column
v-else v-else
@ -36,7 +49,8 @@
:tooltip-effect="head.tooltipEffect || 'light'" :tooltip-effect="head.tooltipEffect || 'light'"
filter-placement="top" filter-placement="top"
:align="head.align || null" :align="head.align || null"
v-bind="head.more"> v-bind="head.more"
>
<!-- 子组件 --> <!-- 子组件 -->
<template v-if="head.prop" slot-scope="scope"> <template v-if="head.prop" slot-scope="scope">
<component <component
@ -44,9 +58,12 @@
:is="head.subcomponent" :is="head.subcomponent"
:key="idx + 'sub'" :key="idx + 'sub'"
:inject-data="{ ...scope.row, head }" :inject-data="{ ...scope.row, head }"
@emit-data="handleSubEmitData" /> @emit-data="handleSubEmitData"
/>
<!-- 直接展示数据或应用过滤器 --> <!-- 直接展示数据或应用过滤器 -->
<span v-else>{{ scope.row[head.prop] | commonFilter(head.filter) }}</span> <span v-else>{{
scope.row[head.prop] | commonFilter(head.filter)
}}</span>
</template> </template>
<!-- 多级表头 --> <!-- 多级表头 -->
@ -54,7 +71,8 @@
<TableHead <TableHead
v-for="(subhead, subindex) in head.children" v-for="(subhead, subindex) in head.children"
:key="'subhead-' + idx + '-subindex-' + subindex" :key="'subhead-' + idx + '-subindex-' + subindex"
:opt="subhead" /> :opt="subhead"
/>
</template> </template>
</el-table-column> </el-table-column>
</template> </template>
@ -63,13 +81,13 @@
</template> </template>
<script> <script>
import TableHead from './TableHead.vue'; import TableHead from "./TableHead.vue";
// 1. / // 1. /
// 2. ' // 2. '
// 3. more... // 3. more...
export default { export default {
name: 'BaseListTable', name: "BaseListTable",
components: { TableHead }, components: { TableHead },
filters: { filters: {
commonFilter: (source, filterType = (a) => a) => { commonFilter: (source, filterType = (a) => a) => {
@ -88,14 +106,14 @@ export default {
tableData: { tableData: {
type: Array, type: Array,
default: () => [], default: () => [],
} },
}, },
inject: ['urls'], inject: ["urls"],
data() { data() {
return { return {
page: 1, page: 1,
size: 20, // 20 size: 20, // 20
dataList: [] dataList: [],
}; };
}, },
watch: { watch: {
@ -108,8 +126,8 @@ export default {
}, },
methods: { methods: {
handleSubEmitData(payload) { handleSubEmitData(payload) {
console.log('[component] BaseListTable handleSubEmitData(): ', payload); console.log("[component] BaseListTable handleSubEmitData(): ", payload);
this.$emit('operate-event', payload); this.$emit("operate-event", payload);
}, },
}, },
}; };

View File

@ -1,5 +1,6 @@
<template> <template>
<el-row class="base-search-form rounded"> <el-row class="base-search-form">
<div class="brand-color-line"></div>
<el-form :inline="true" :model="searchForm" :rules="headConfig.rules"> <el-form :inline="true" :model="searchForm" :rules="headConfig.rules">
<!-- <el-col :span="opt.span ? +opt.span : 4" v-for="opt in options" :key="opt.id"> --> <!-- <el-col :span="opt.span ? +opt.span : 4" v-for="opt in options" :key="opt.id"> -->
<el-form-item <el-form-item
@ -40,7 +41,10 @@
<el-button type="primary">上传文件</el-button> <el-button type="primary">上传文件</el-button>
</el-upload> </el-upload>
<el-button <el-button
v-if="opt.button && (!opt.button.permission || $hasPermission(opt.button.permission))" v-if="
opt.button &&
(!opt.button.permission || $hasPermission(opt.button.permission))
"
:key="'button' + Math.random().toString()" :key="'button' + Math.random().toString()"
:type="opt.button.type" :type="opt.button.type"
@click="handleBtnClick(opt.button.name)" @click="handleBtnClick(opt.button.name)"
@ -164,4 +168,21 @@ export default {
}; };
</script> </script>
<style scoped></style> <style scoped>
.base-search-form {
display: flex;
/* align-items: center; */
/* position: relative; */
}
.brand-color-line {
display: inline-block;
height: 20px;
width: 6px;
margin-right: 8px;
margin-top: 10px;
border-radius: 2px;
background: #0b58ff;
/* position: absolute; */
}
</style>

View File

@ -6,7 +6,7 @@
:distory-on-close="true" :distory-on-close="true"
> >
<!-- title --> <!-- title -->
<div slot="title" class=""> <div slot="title" class="dialog-title">
<h1 class="">编辑</h1> <h1 class="">编辑</h1>
</div> </div>
<!-- menu --> <!-- menu -->
@ -430,4 +430,9 @@ export default {
.el-select { .el-select {
width: 100% !important; width: 100% !important;
} }
.dialog-with-menu >>> .el-dialog__header {
padding: 10px 20px 10px;
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), white);
}
</style> </style>

View File

@ -72,7 +72,7 @@ export default {
h('el-button', h('el-button',
{ {
props: { type: 'text' }, props: { type: 'text' },
style: { color: this.colors[opt.name] || '#409EFF' }, style: { color: this.colors[opt.name] || '#0b58ff' },
on: { click: this.emit.bind(null, opt) } on: { click: this.emit.bind(null, opt) }
}, },
this.text[opt.name] this.text[opt.name]
@ -85,7 +85,7 @@ export default {
h('el-button', h('el-button',
{ {
props: { type: 'text' }, props: { type: 'text' },
style: { color: this.colors[opt] || '#409EFF' }, style: { color: this.colors[opt] || '#0b58ff' },
on: { click: this.emit.bind(null, opt) } on: { click: this.emit.bind(null, opt) }
}, },
this.text[opt] this.text[opt]

View File

@ -40,7 +40,7 @@ export default {
return h('el-tag', return h('el-tag',
{ {
props: props:
{ type: this.isEnabled ? this.statusType[0] : this.statusType[1] } { size: 'small', type: this.isEnabled ? this.statusType[0] : this.statusType[1] }
}, },
this.isEnabled ? this.statusText[0] : this.statusText[1]) this.isEnabled ? this.statusText[0] : this.statusText[1])
} }

View File

@ -1,6 +1,8 @@
<!-- 表格页加上搜索条件 --> <!-- 表格页加上搜索条件 -->
<template> <template>
<div class="bg-white rounded-lg shadow-lg w-full h-full p-5"> <div
class="list-view-with-head"
>
<!-- <head-form :form-config="headFormConfig" @headBtnClick="btnClick" /> --> <!-- <head-form :form-config="headFormConfig" @headBtnClick="btnClick" /> -->
<BaseSearchForm :head-config="headConfig" @btn-click="handleBtnClick" /> <BaseSearchForm :head-config="headConfig" @btn-click="handleBtnClick" />
@ -226,4 +228,13 @@ export default {
}; };
</script> </script>
<style scoped></style> <style scoped>
.list-view-with-head {
background: white;
/* height: 100%; */
min-height: inherit;
border-radius: 6px;
padding: 16px;
box-shadow: 0 0 2px 1px rgba(0, 0, 0, 0.125);
}
</style>