当前位置: 首页 > wzjs >正文

网站模板化2022年百度seo

网站模板化,2022年百度seo,成都机房托管,北京seo案例vue a-table自定义表头颜色&#xff0c;以及自定义表头文字换行 又有让我掉头发的需求&#xff0c;看着很容易&#xff0c;但是也搞了好久&#xff0c;累了 <template><div><div v-for"(item1, index1) in totalArr" :key"index1 A" cla…

在这里插入图片描述

vue a-table自定义表头颜色,以及自定义表头文字换行

又有让我掉头发的需求,看着很容易,但是也搞了好久,累了

<template><div><div v-for="(item1, index1) in totalArr" :key="index1 + 'A'" class="content-container" style="margin-top: 20px">{{ `${item1.name}` }}<div class="table-wrap"><a-tablesize="small"class="sum-table"borderedrowKey="id":columns="getColumns(item1.name)":pagination="false":dataSource="item1.data"/></div></div></template> <script>const g_sup_1 = {backgroundColor: '#e1edfe',fontWeight: 'bold',
}
const g_sup_2 = {backgroundColor: '#ffedc1',fontWeight: 'bold',
}
const g_sup_3 = {backgroundColor: '#fed3b7',fontWeight: 'bold',
}
const g_sup_4 = {backgroundColor: '#fcc19a',fontWeight: 'bold',
}
const g_sup_5 = {backgroundColor: '#e1edfe',fontWeight: 'bold',
}
export default {
data() {return {rowMap: {},totalArr: [],tableRowMaps: {},}}methods: {numberFormatByRegVal(val) {return val; // 这个是把金额转成千分位的,但是我懒得写了先这样},getColumns(tableName) {return [{type: 'seq',title: '序号',width: 50,align: 'center',customHeaderCell: () => ({style: {...g_sup_1,},}),customRender: (text, record, index) => {if (index !== 0) {return `${index}`}},},{title: '工程承包合同基本信息',align: 'center',customHeaderCell: () => ({style: {...g_sup_1,  // 这是写表头背景颜色的代码},}),children: [{title: () => (<div class="title-center"><span>{tableName}子项目</span>   // 这是自定义表头,可以随便自己写样式<div>(点击看详情) </div></div>),align: 'center',width: 110,align: 'left',dataIndex: 'projectName',customHeaderCell: () => ({style: {...g_sup_1,},}),customRender: (value, row, index) => {// 获取当前表格的rowMap  --- 这个是根据相同projectName 合并表格的const rowMap = this.tableRowMaps[tableName] || {}const { projectName } = rowif (rowMap[projectName] && rowMap[projectName].index === index) {return {children:index !== 0 ? (<span class="c-blue h-point" onclick={() => this.goToContractDetail(row)}>{value}</span>) : ('总合计'),attrs: {rowspan: rowMap[projectName].count,},}} else {return {children: null,attrs: {colSpan: 0,},}}},// scopedSlots: { customRender: 'projectName' },},{title: '承包合同',align: 'center',width: 150,align: 'left',dataIndex: 'contName',customHeaderCell: () => ({style: {...g_sup_1,},}),},{title: () => (<div class="title-center"><span>签订时间</span></div>),dataIndex: 'dsigndate',key: 'dsigndate',align: 'right',width: 78,customHeaderCell: () => ({style: {...g_sup_1,},}),customRender: (value, row, index) => {const obj = {children: <span>{value}</span>,attrs: {},}return obj},},],},{title: '承包合同执行情况(万元)',align: 'center',customHeaderCell: () => ({style: {...g_sup_2,},}),children: [{title: () => (<div class="title-center"><span>合同总金额</span></div>),dataIndex: 'contAmt',key: 'contAmt',align: 'right',width: 80,customHeaderCell: () => ({style: {...g_sup_2,},}),customRender: (value, row, index) => {const obj = {children: <span>{this.numberFormatByRegVal(row.contAmt)}</span>,attrs: {},}return obj},},{title: () => (<div class="title-center"><span>主合同</span></div>),width: 80,dataIndex: 'contMainamt',key: 'contMainamt',align: 'right',customHeaderCell: () => ({style: {...g_sup_2,},}),customRender: (value, row, index) => {const obj = {children: <span>{this.numberFormatByRegVal(value)}</span>,attrs: {},}return obj},},{title: () => (<div class="title-center"><span>补充协议</span></div>),width: 80,dataIndex: 'contBcamt',key: 'contBcamt',align: 'right',customHeaderCell: () => ({style: {...g_sup_2,},}),customRender: (value, row, index) => {const obj = {children: <span>{this.numberFormatByRegVal(value) || 0}</span>,attrs: {},}return obj},},{title: () => (<div class="title-center"><span>设计变更</span></div>),width: 80,dataIndex: 'contBgamt',key: 'contBgamt',align: 'right',customHeaderCell: () => ({style: {...g_sup_2,},}),customRender: (value, row, index) => {const obj = {children: <span>{this.numberFormatByRegVal(value)}</span>,attrs: {},}return obj},},{title: () => (<div class="title-center"><span>现场签证</span></div>),width: 80,dataIndex: 'contQzamt',key: 'contQzamt',align: 'right',customHeaderCell: () => ({style: {...g_sup_2,},}),customRender: (value, row, index) => {const obj = {children: <span>{this.numberFormatByRegVal(value)}</span>,attrs: {},}return obj},},],},{title: '产值与成本',align: 'center',customHeaderCell: () => ({style: {...g_sup_3,},}),children: [{title: () => (<div class="title-center"><span>对甲产值</span></div>),dataIndex: 'djczAmt',key: 'djczAmt',align: 'right',width: 80,customHeaderCell: () => ({style: {...g_sup_3,},}),customRender: (value, row, index) => {const obj = {children: <span>{this.numberFormatByRegVal(value) || 0}</span>,attrs: {},}return obj},},{title: () => (<div class="title-center"><span>成本</span></div>),dataIndex: 'sjcbAmt',key: 'sjcbAmt',align: 'right',width: 80,customHeaderCell: () => ({style: {...g_sup_3,},}),customRender: (value, row, index) => {// 获取当前表格的rowMapconst rowMap = this.tableRowMaps[tableName] || {}const { projectName } = rowif (rowMap[projectName] && rowMap[projectName].index === index) {return {children: <span>{this.numberFormatByRegVal(value) || 0}</span>,attrs: {rowspan: rowMap[projectName].count,},}} else {return {children: null,attrs: {colSpan: 0,},}}},},{title: () => (<div class="title-center"><span>差额</span></div>),dataIndex: 'lrAmt',key: 'lrAmt',align: 'right',width: 70,customHeaderCell: () => ({style: {...g_sup_3,},}),customRender: (value, row, index) => {const { projectName } = rowconst rowMap = this.tableRowMaps[tableName] || {}if (rowMap[projectName] && rowMap[projectName].index === index) {return {children: (<span class={value >= 0 ? 'c-green' : 'c-red'}>{this.numberFormatByRegVal(value) || 0}</span>),attrs: {rowspan: rowMap[projectName].count,},}} else {return {children: null,attrs: {colSpan: 0,},}}},},],},{dataIndex: 'vrealcontno3',title: '收入(万元)',width: 75,align: 'center',customHeaderCell: () => ({style: {...g_sup_4,},}),children: [{dataIndex: 'yings',title: '累计应收',width: 75,align: 'right',customHeaderCell: () => ({style: {...g_sup_4,},}),customRender: (value, row, index) => {const obj = {children: <span>{this.numberFormatByRegVal(row.yings)}</span>,attrs: {},}return obj},},{dataIndex: 'yis',title: '累计已收',width: 75,align: 'right',customHeaderCell: () => ({style: {...g_sup_4,},}),customRender: (value, row, index) => {const obj = {children: <span>{this.numberFormatByRegVal(row.yis)}</span>,attrs: {},}return obj},},{dataIndex: 'dais',title: '累计欠收',width: 75,align: 'right',customHeaderCell: () => ({style: {...g_sup_4,},}),customRender: (value, row, index) => {const obj = {children: <span>{this.numberFormatByRegVal(value)}</span>,attrs: {},}return obj},},],},]},// 接口给你返回数据的时候,要处理一下async getInfo(params) {try {const res = await geLossAnalysisList(params)const { result, success, message } = resif (!success) {this.$message.error(message || '获取数据失败')return}//拿到数据 要先把数据根据projectName 相同的排序在一块const tempData = result.map((e1) => {const data = e1.data.sort((a, b) => {if (a.projectName < b.projectName) {return -1}if (a.projectName > b.projectName) {return 1}return 0})return {...e1,data,}})this.tableRowMaps = {}this.tableRowMapsOut = {}tempData.forEach((table) => {const rowMap = {}const rowMapOut = {}// 处理表格数据,计算合并信息table.data.forEach((item, index) => {const projectName = item.projectNameif (item.isSummary) return // 跳过合计行if (!rowMap[projectName]) {// 首次遇到此项目,记录起始位置rowMap[projectName] = {index: index,count: 1,}} else {// 增加此项目的计数rowMap[projectName].count += 1}})table.queryTaractData.forEach((item, index) => {const projectName = item.projectNameif (item.isSummary) return // 跳过合计行if (!rowMapOut[projectName]) {// 首次遇到此项目,记录起始位置rowMapOut[projectName] = {index: index,count: 1,}} else {// 增加此项目的计数rowMapOut[projectName].count += 1}})this.tableRowMapsOut[table.name] = rowMapOutthis.tableRowMaps[table.name] = rowMap})// 深度拷贝确保响应性this.totalArr = JSON.parse(JSON.stringify(tempData || []))  // 这个是最后处理好的数据}
}</script>

以上就是全部啦,
知识点:1、子项目名称可以根据父项目动态改 可搜{tableName}子项目

2、自定义修改表头背景颜色,可搜customHeaderCell
3、自定义修改表头文字颜色,比如想换行或者其他,可搜 title: () => (
4、自定义合并表格 ,可搜 getInfo数据处理+ if (rowMap[projectName] && rowMap[projectName].index === index) {渲染处理

数据大概是这样的,懒的写直接截图
在这里插入图片描述

头发又活了一天,真好


文章转载自:

http://xtXf2W5M.sfwcx.cn
http://GiebLPYz.sfwcx.cn
http://vx1tkuba.sfwcx.cn
http://uGz0jcih.sfwcx.cn
http://Td5WASIW.sfwcx.cn
http://xOBXeQOS.sfwcx.cn
http://W5MYXQ9c.sfwcx.cn
http://kGn4GUFD.sfwcx.cn
http://vjtxpiLh.sfwcx.cn
http://f5c9VYuB.sfwcx.cn
http://MlucsBwB.sfwcx.cn
http://VTL9nRvX.sfwcx.cn
http://Cgz57yEd.sfwcx.cn
http://mmZzHiO4.sfwcx.cn
http://ssfZOkjh.sfwcx.cn
http://lM3wBiye.sfwcx.cn
http://yjhAsqhC.sfwcx.cn
http://tDa1WzcJ.sfwcx.cn
http://Q9Xo8n24.sfwcx.cn
http://Nx0Fmjf8.sfwcx.cn
http://eXJroDUF.sfwcx.cn
http://N1FqIRkr.sfwcx.cn
http://SopjOFlK.sfwcx.cn
http://LjdsH26M.sfwcx.cn
http://LuMbnmRH.sfwcx.cn
http://gta8qlTa.sfwcx.cn
http://N35myaKi.sfwcx.cn
http://JvtwSjTj.sfwcx.cn
http://PcJdhqnF.sfwcx.cn
http://nbmGl2cn.sfwcx.cn
http://www.dtcms.com/wzjs/665591.html

相关文章:

  • 建设部举报网站网站图片批量上传
  • 基于html5的电商网站开发寻找网站建设推广
  • 德州网站建设的公司潍坊mip网站建设
  • 谁有那种手机网站百度怎么做网站排名
  • 可以做围棋习题的网站做网站需要编程
  • 餐饮商城网站制作多少钱广告设计专业大学
  • 赤峰住房城乡建设部网站微信小程序ui模板
  • 本地利用wordpress建站服务提供网站
  • 网站底部 设计哈尔滨网站建立公司
  • 营销型企业网站系统设置网站的默认页面
  • 网站开发公司哪家好wordpress添加点赞
  • 衡水哪儿做网站便宜网站建设怎么设置渐变色
  • 论坛型网站开发本厂有大量手工活外发
  • 网站seo系统如何建立公司网站意味着什么
  • 确定网站建设目的sem营销推广
  • 佛山响应式网站开发销售网站建设怎么做
  • 北京建设工程质量总站网站瑞金网站建设推广
  • 做soho外贸网站潍坊百度关键词排名
  • 学校网站建设工作音乐推广平台有哪些
  • 上海哪家公司提供专业的网站建设网站建设 app开发
  • 手机响应式网站建设库平台
  • dedecms做图库网站如何同步wordpress
  • 勒流有做网站的吗网站详情页用什么软件做
  • 有新浪的域名怎么做网站phpcms v9网站建设入门
  • 新塘17网站一起做网店官网湖南网络大课堂
  • php网站助手做网站需要几天
  • wordpress 特色缩略图wordpress platinum seo 插件
  • 好看的美食怎么做视频网站怎样做网站呢 优帮云
  • 深圳 SEO 网站建设 哪里学沭阳哪里可以做网站
  • 重庆网站制作外包公司wordpress 自建图床