Compare commits
34 Commits
e33fcb33fe
...
dev_sh
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4a03fb756 | ||
|
|
f4eca63a29 | ||
|
|
b07c03b00a | ||
|
|
f2c856b61c | ||
|
|
d6d5f75fb6 | ||
|
|
c8d152f595 | ||
|
|
a441538178 | ||
|
|
7e57cfb871 | ||
|
|
c5ff4c263f | ||
|
|
eeb6f27d47 | ||
|
|
b2a130930c | ||
|
|
b35b04452a | ||
|
|
081544019c | ||
|
|
e545aa36ca | ||
|
|
85f7484c57 | ||
|
|
cb77ad837b | ||
|
|
03c8d49a9c | ||
|
|
201a4464bb | ||
|
|
e8fce71d0e | ||
|
|
774895f901 | ||
|
|
386fb026b5 | ||
|
|
280ff0837f | ||
|
|
6625e0c1a3 | ||
|
|
354f839b4e | ||
|
|
5b95cc85f0 | ||
|
|
cf511deeef | ||
|
|
2217b14377 | ||
|
|
d57c46b531 | ||
|
|
b6d970175e | ||
|
|
b9c60b8c48 | ||
|
|
fbe8c8ba4e | ||
| 4260e35018 | |||
| 89b3c978c5 | |||
| ccfb06113a |
@@ -89,4 +89,7 @@ export const batchGetTableList = (reportCodes: string, data?) => {
|
||||
return request.post({ url: `/lideeyunji/report-data/batch/list/${reportCodes}`, data })
|
||||
}
|
||||
|
||||
|
||||
//获取综合销售报表合计
|
||||
export const getAggMonthTotalDetail = (data) => {
|
||||
return request.post({ url: `lideeyunji/agg/month/total/detail`, data })
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ defineProps({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ElCard :class="[prefixCls, 'mb-15px']" shadow="never">
|
||||
<ElCard :class="[prefixCls]" shadow="never">
|
||||
<template v-if="title" #header>
|
||||
<div class="flex items-center">
|
||||
<span class="text-16px font-700">{{ title }}</span>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
class="low-reoprt"
|
||||
:class="[`low-report__${reportCode}`, { summary: tableOption.showSummary }]"
|
||||
>
|
||||
<div v-if="isSearch" style="margin-bottom:6px">查询:</div>
|
||||
|
||||
<avue-crud
|
||||
ref="crudRef"
|
||||
v-model:search="tableSearch"
|
||||
@@ -13,6 +13,8 @@
|
||||
:option="tableOption"
|
||||
v-bind="crudBind"
|
||||
:summary-method=summaryMethod1
|
||||
:row-style="rowStyleMethod"
|
||||
:cell-class-name="cellClassNameMethod"
|
||||
@search-change="searchChange"
|
||||
@search-reset="resetChange"
|
||||
@refresh-change="refreshChange"
|
||||
@@ -21,6 +23,9 @@
|
||||
@selection-change="selectionChange"
|
||||
@sort-change="sortChange"
|
||||
>
|
||||
<template #search>
|
||||
<!-- <div v-if="isSearch" style="margin-bottom:6px">查询:</div> -->
|
||||
</template>
|
||||
<!-- 自定义表格头部操作 -->
|
||||
<template #menu-left="{ size }">
|
||||
<ElButton
|
||||
@@ -39,6 +44,31 @@
|
||||
<Icon :size="14" icon="clarity:export-line"></Icon>
|
||||
<span>{{ t('Avue.crud.excelBtn') }}</span>
|
||||
</ElButton>
|
||||
<div ref="tableHeightRef"></div>
|
||||
</template>
|
||||
<template v-for="prop in searchReportSlots" :key="prop" #[`${prop}-search`]="scope" >
|
||||
<div>
|
||||
<el-select
|
||||
v-model="tableSearch[prop]"
|
||||
:multiple="scope.column.multiple"
|
||||
filterable
|
||||
remote
|
||||
remote-show-suffix
|
||||
clearable
|
||||
:disabled="loading"
|
||||
:collapse-tags="scope.column.collapseTags"
|
||||
:collapse-tags-tooltip="scope.column.collapseTagsTooltip"
|
||||
:placeholder="'请选择'+scope.column.label"
|
||||
:remote-method="(query) => remoteMethod(query, scope.column)"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item,index) in scope.column.dicData"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
<template v-for="prop in numberRange" :key="prop" #[`${prop}-search`]="scope">
|
||||
<InputNumberRange
|
||||
@@ -69,14 +99,14 @@
|
||||
></InputTimeRange>
|
||||
</template>
|
||||
<template #header v-if="Object.keys(dimensionFields)?.length">
|
||||
<div style="display:flex;align-items:center;border-top:1px solid #eee;margin-bottom:10px;padding-top:10px;">
|
||||
<div style="display:flex;align-items:center;border-top:1px solid #eee;margin-bottom:10px;padding-top:10px;">
|
||||
<span style="margin-right:10px;">维度:</span>
|
||||
<el-checkbox-group
|
||||
@change="searchDimension" v-model="tableSearch['Group by']"
|
||||
placeholder="请选择内容">
|
||||
<template v-for="(item,key) in dimensionFields">
|
||||
<el-checkbox
|
||||
v-if="tableSearch['Group by']&&tableSearch['Group by'].includes(key)||!tableSearch['Group by']?.length"
|
||||
v-if="1"
|
||||
:key="key"
|
||||
:value="key"
|
||||
:label="item.label"></el-checkbox>
|
||||
@@ -92,11 +122,13 @@ v-if="tableSearch['Group by']&&tableSearch['Group by'].includes(key)||!tableSear
|
||||
import * as ReportApi from '@/api/design/report'
|
||||
import { InputNumberRange,InputDateRange ,InputDateTimeRange,InputTimeRange} from '../shareControl/index'
|
||||
import download from '@/utils/download'
|
||||
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { useWindowSize } from '@vueuse/core'
|
||||
import { assembleLengObj } from '@/utils/lowDesign'
|
||||
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
|
||||
import Avue from '@smallwei/avue'
|
||||
import { Console } from 'console'
|
||||
defineOptions({ name: 'LowReport' })
|
||||
|
||||
interface Props {
|
||||
@@ -116,24 +148,34 @@ const { wsCache } = useCache()
|
||||
const route = useRoute()
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { mergeLocaleMessage, t } = useI18n() // 国际化
|
||||
|
||||
const defualtSearch=ref<any>({})
|
||||
const transferFields={
|
||||
'zoneName':'salezonename',
|
||||
'saleTypeName':'saletypename',
|
||||
'salerName':'salername',
|
||||
'goodsName':'goodsname',
|
||||
'customName':'customname',
|
||||
'dosageName':'dosagename',
|
||||
|
||||
}
|
||||
const loading = ref(false) // 列表的加载中
|
||||
const isInit = ref(false)
|
||||
const isSearch = ref(false)
|
||||
|
||||
|
||||
const tableHeightRef = ref<any>(null)
|
||||
const tableOption = ref<any>({})
|
||||
const tableData = ref<any>([])
|
||||
const tableSearch = ref({
|
||||
'Group by':[]
|
||||
})
|
||||
const tablePage = ref<any>({ currentPage: 1, pageSize: 100, total: 0 })
|
||||
const tablePage = ref<any>({ currentPage: 1, pageSize: 50, total: 0 })
|
||||
const tableSelect = ref<any>([])
|
||||
const tableSort = ref({ column: '', order: '' })
|
||||
const tableInfo = ref<any>({})
|
||||
const timerObj = ref<any>({})
|
||||
const numberRange = ref<string[]>([])
|
||||
const dateRange=ref<string[]>([])
|
||||
const searchReportSlots=ref<string[]>([])
|
||||
const hideColumns=ref<string[]>([])
|
||||
const dateTimeRange=ref<string[]>([])
|
||||
const timeRange=ref<string[]>([])
|
||||
@@ -144,22 +186,77 @@ const dimensionFields=ref<any>({})
|
||||
const exportLoading = ref(false)
|
||||
const fieldList = ref<any[]>([]) // 添加fieldList引用
|
||||
const hideFeilds= ref<any>({})
|
||||
const hideCols=ref<any>([])
|
||||
const dictFieldList=ref<any>([])
|
||||
const textAlignFiels=ref<any>({})
|
||||
const permissions =
|
||||
wsCache.get(CACHE_KEY.USER).lideeYunjipermissions?.[route.meta.menuDataId as string] || false
|
||||
const selectIds = computed(() => {
|
||||
return tableSelect.value.map((item) => item['id'])
|
||||
})
|
||||
const remoteMethod= async(query,column)=>{
|
||||
if(!query){
|
||||
return
|
||||
}
|
||||
let params={
|
||||
pageSize: 100,
|
||||
pageNo:1,
|
||||
}
|
||||
params[transferFields[column.prop]?transferFields[column.prop]:column.prop]=query
|
||||
|
||||
let data = await ReportApi.getTableList(column.reportCode,params)
|
||||
column.dicData=column.formatterDic(data)
|
||||
}
|
||||
const crudBind = computed(() => {
|
||||
const obj = {}
|
||||
if (tableInfo.value.isPage) obj['page'] = tablePage.value
|
||||
return obj
|
||||
})
|
||||
|
||||
function getElementToBodyTop(el) {
|
||||
if (!el || !(el instanceof HTMLElement)) return 0;
|
||||
|
||||
// 1. 获取元素相对于视口的位置(top是元素顶部到视口顶部的距离)
|
||||
const rect = el.getBoundingClientRect();
|
||||
// 2. 视口顶部到body顶部的距离 = 页面滚动的距离(window.scrollY)
|
||||
// 最终距离 = 元素视口top + 页面滚动距离 - body的margin/padding(可选,根据场景)
|
||||
const bodyTop = document.body.getBoundingClientRect().top; // body自身的偏移(通常为0)
|
||||
return rect.top - bodyTop + window.scrollY;
|
||||
}
|
||||
const tableHeight=ref(0)
|
||||
watch(()=>tableHeightRef.value,()=>{
|
||||
if(tableHeightRef.value){
|
||||
setTimeout(()=>{
|
||||
observeHeightChange(document.querySelector('.avue-crud__search'))
|
||||
if(tableOption.value.showSummary&&tableOption.value.index&&tableOption.value.selection){
|
||||
document.querySelector('tfoot tr td').colSpan="2"
|
||||
document.querySelectorAll('tfoot tr td')[1].style.display="none"
|
||||
}
|
||||
|
||||
},2000)
|
||||
}
|
||||
})
|
||||
let resizeObserver = null;
|
||||
const observeHeightChange = (targetEl) => {
|
||||
// 确保元素已挂载
|
||||
if (!targetEl) return;
|
||||
// 创建ResizeObserver实例
|
||||
resizeObserver = new ResizeObserver((entries) => {
|
||||
const calcH= getElementToBodyTop(tableHeightRef.value)
|
||||
tableHeight.value= ('calc(100vh - '+(parseInt(calcH+160))+"px)")
|
||||
if(document.querySelector('.el-table').style){
|
||||
document.querySelector('.el-table').style.height=tableHeight.value
|
||||
}
|
||||
});
|
||||
// 开始监听目标元素
|
||||
resizeObserver.observe(targetEl);
|
||||
};
|
||||
const setLastAmountRowClass=(row,rowIndex)=>{
|
||||
if(row.isAmount===true){
|
||||
return 'lastAmountRow'
|
||||
}
|
||||
}
|
||||
|
||||
const summaryMethod1=({columns,data})=>{
|
||||
// 1. 初始化汇总结果数组(和表格列数量一致)
|
||||
const result = new Array(columns.length).fill("");
|
||||
@@ -173,6 +270,21 @@ const summaryMethod1=({columns,data})=>{
|
||||
})
|
||||
return result;
|
||||
}
|
||||
const rowStyleMethod=({row,rowIndex})=>{
|
||||
let styleObj={}
|
||||
dictFieldList.value.forEach(item=>{
|
||||
if(row[item.prop]){
|
||||
styleObj['color']=item.dicData.find(d=>d.value===row[item.prop]).cssClass
|
||||
}
|
||||
})
|
||||
return styleObj
|
||||
}
|
||||
|
||||
const cellClassNameMethod=({row,column,rowIndex,columnIndex})=>{
|
||||
if(textAlignFiels.value[column.property]){
|
||||
return 'textAlignCell'
|
||||
}
|
||||
}
|
||||
function getCurrentDate() {
|
||||
const now = new Date();
|
||||
// 补零函数:小于10则前面加0
|
||||
@@ -204,19 +316,20 @@ const initTable = async () => {
|
||||
hideColumns.value=[]
|
||||
tableInfo.value = { ...reportVo, isPage, isHeight, isPermi, isHideExport }
|
||||
tableOption.value = {
|
||||
selection: !isHideExport,
|
||||
selection: false,
|
||||
reserveSelection: true,
|
||||
menu: false,
|
||||
addBtn: false,
|
||||
height: isHeight ? 'auto' : undefined,
|
||||
calcHeight: isHeight ? 10 : '',
|
||||
calcHeight: isHeight ?10 : '',
|
||||
index: reportVo.tableConfig.includes('index'),
|
||||
indexLabel: '序号',
|
||||
indexWidth: 54,
|
||||
border: reportVo.tableConfig.includes('border'),
|
||||
stripe: reportVo.tableConfig.includes('stripe'),
|
||||
// stripe: reportVo.tableConfig.includes('stripe'),
|
||||
showSummary:false,
|
||||
|
||||
stripe:true,
|
||||
|
||||
searchBtnText:'查询',
|
||||
column: {}
|
||||
}
|
||||
|
||||
@@ -229,6 +342,7 @@ const initTable = async () => {
|
||||
const fixedFields = apiFieldList.filter(f => f.isFixedColumn === 'Y')
|
||||
const dynamicFields = apiFieldList.filter(f => f.isFixedColumn !== 'Y')
|
||||
|
||||
|
||||
// 处理固定列
|
||||
fixedFields.forEach((item) => {
|
||||
const config: any = {
|
||||
@@ -259,9 +373,8 @@ const initTable = async () => {
|
||||
|
||||
// }
|
||||
// 处理动态列(暂不构建children,等数据返回后动态生成)
|
||||
dynamicFields.forEach((item, index) => {
|
||||
dynamicFields.forEach(async (item, index) => {
|
||||
if (item.parentFieldCode && item.parentFieldCode !== '') return
|
||||
|
||||
const config: any = {
|
||||
prop: item.fieldCode,
|
||||
label: t(`${props.reportCode}.${item.fieldCode}`),
|
||||
@@ -276,7 +389,7 @@ const initTable = async () => {
|
||||
if(item.queryIsWeb == 'Y'&&item.isHideSearch !== 'Y') isSearch.value=true
|
||||
if(!!item.searchDefaultValue){
|
||||
if(['年','年度','年份'].includes(item.fieldName)&&item.searchDefaultValue=='本年'){
|
||||
tableSearch.value[config.prop]=getCurrentDate().year
|
||||
tableSearch.value[config.prop]=getCurrentDate().year.toString()
|
||||
}else if( ['月','月度','月份'].includes(item.fieldName)&&item.searchDefaultValue=='本月'){
|
||||
tableSearch.value[config.prop]=new Date().getMonth() + 1
|
||||
}else if(item.fieldType=='Date'&&item.searchDefaultValue=='当日'){
|
||||
@@ -284,35 +397,66 @@ const initTable = async () => {
|
||||
}else{
|
||||
tableSearch.value[config.prop]=item.searchDefaultValue
|
||||
}
|
||||
defualtSearch.value[config.prop]=tableSearch.value[config.prop]
|
||||
}
|
||||
|
||||
if(['年','年度','年份','月','月度','月份','年月'].includes(item.fieldName)&&config.search){
|
||||
config.searchSpan=3
|
||||
config.searchLabelWidth=60
|
||||
if(item.fieldName.includes('年')){
|
||||
config.searchType='year'
|
||||
config.valueFormat = 'YYYY'
|
||||
}else if(item.fieldName.includes('月')){
|
||||
config.searchType='select'
|
||||
config.dicData=[{label:'1月',value:'1'},{label:'2月',value:'2'},{label:'3月',value:'3'},{label:'4月',value:'4'},{label:'5月',value:'5'},{label:'6月',value:'6'},{label:'7月',value:'7'},{label:'8月',value:'8'},{label:'9月',value:'9'},{label:'10月',value:'10'},{label:'11月',value:'11'},{label:'12月',value:'12'}]
|
||||
}
|
||||
if(props.reportCode=='ZHXSQK'&&item.isDimension=='Y'){
|
||||
tableSearch.value['Group by'].push(item.fieldCode)
|
||||
}
|
||||
}
|
||||
if(['货品名称','货品名称','剂型','剂型名称','客户名称','客户'].includes(item.fieldName)&&config.search){
|
||||
console.log(config.search)
|
||||
if(item.fieldName=='效期剩余时间(天)分类') config.searchSpan=5
|
||||
|
||||
if(config.search) config.searchLabelWidth=item.fieldName.length*12 +40
|
||||
const moreIn="MORE_IN".includes(item.queryMode)
|
||||
config.searchType=moreIn?'select':config.searchType
|
||||
config.multiple=config.collapseTags=config.collapseTagsTooltip =moreIn
|
||||
item.queryMode=='LIKE'?config.multiple=config.collapseTags=config.collapseTagsTooltip =true:''
|
||||
const jkTableDicFields={
|
||||
'货品名称':'hpmx',
|
||||
'货品':'hpmx',
|
||||
'剂型':'jxjk',
|
||||
'产品':'hpmx',
|
||||
'产品名称':'hpmx',
|
||||
'剂型名称':'jxjk',
|
||||
'客户名称':'khxx',
|
||||
'销售类型':'xslx',
|
||||
'客户':'khxx',
|
||||
'业务员':'ywyxx',
|
||||
'业务区域':'ywqy',
|
||||
'标准品名':'bzpm',
|
||||
}
|
||||
|
||||
if(Object.keys(jkTableDicFields).includes(item.fieldName)&&config.search){
|
||||
config.dataType= 'string'
|
||||
config.dictType= 'defaultTable'
|
||||
config.dicUrl= `/lideeyunji/report-data/list/${item.fieldName.includes('客户')?'khxx':'hpmx'}`
|
||||
config.dicMethod= 'post'
|
||||
config.dicQuery= { //请求参数
|
||||
pageSize: 1000000,
|
||||
pageNo:1
|
||||
}
|
||||
config.filterable= true
|
||||
// config.props ={ label:config.prop , value:config.prop }
|
||||
config.dicFormatter= (res) => { //请求数据格式化
|
||||
const arr=[...new Set(res.records.map(item=>item[config.prop]))]
|
||||
config.reportCode= `${jkTableDicFields[item.fieldName]}`
|
||||
const formatterData=(res) => { //请求数据格式化
|
||||
const arr=[...new Set(res.records.map(item=>item[transferFields[config.prop]?transferFields[config.prop]:config.prop]))]
|
||||
return arr.map(item=>({label:item,value:item}))
|
||||
}
|
||||
config.searchType='select'
|
||||
ReportApi.getTableList(jkTableDicFields[item.fieldName],{pageSize: 50, pageNo:1}).then(res=>{
|
||||
config.dicData=formatterData(res)
|
||||
})
|
||||
config.formatterDic=formatterData
|
||||
searchReportSlots.value.push(config.prop)
|
||||
// config.multiple?tableSearch.value[config.prop]=item.searchDefaultValue?item.searchDefaultValue.split(','):[]:''
|
||||
}
|
||||
if(item.dictCode){
|
||||
const dictData=getStrDictOptions(item.dictCode)
|
||||
config.dicData=dictData
|
||||
config.searchType= 'select'
|
||||
config.dataType= 'string'
|
||||
dictFieldList.value.push(config)
|
||||
}
|
||||
|
||||
|
||||
if(!!item.isAmount){
|
||||
index==0?amountFieds.value.fistField=config.prop:''
|
||||
@@ -321,14 +465,15 @@ const initTable = async () => {
|
||||
}
|
||||
if(item.width){
|
||||
config.width=item.width
|
||||
config.widthOld=item.width
|
||||
}
|
||||
if(item.isDimension=='Y'){
|
||||
dimensionFields.value[config.prop]=config
|
||||
hideFeilds.value[config.prop]=item.isHideDimension
|
||||
}
|
||||
if(item.isHideCol == 'Y') {
|
||||
if(item.isHideCol == 'Y') {hideCols.value.push(config.prop)
|
||||
config.hide = true
|
||||
hideColumns.value.push( config.prop )
|
||||
hideColumns.value.push(config.prop)
|
||||
}
|
||||
if (item.queryMode == 'RANGE') config.searchRange = true
|
||||
if (['Integer', 'BigInt', 'BigDecimal'].includes(item.fieldType)) config.type = 'number'
|
||||
@@ -391,6 +536,7 @@ const initTableLayout = () => {
|
||||
timerObj.value.layout = setTimeout(() => {
|
||||
if (crudRef.value) crudRef.value.getTableHeight()
|
||||
}, 100)
|
||||
|
||||
}
|
||||
|
||||
const selectionChange = (data) => {
|
||||
@@ -430,17 +576,21 @@ const getSearchData = () => {
|
||||
resolve(searchObj)
|
||||
})
|
||||
}
|
||||
|
||||
const computedIncluedes=(row,prop)=>{
|
||||
return (typeof row[prop])==='string'&&(row[prop].includes('🔴')||row[prop].includes('🟢'))
|
||||
}
|
||||
const getTableData = async (isLoading = true) => {
|
||||
if (timerObj.value.getTableData) clearTimeout(timerObj.value.getTableData)
|
||||
await new Promise((resolve) => {
|
||||
timerObj.value.getTableData = setTimeout(() => resolve(true), 100)
|
||||
})
|
||||
textAlignFiels.value={}
|
||||
return new Promise(async (resolve) => {
|
||||
if (isLoading) loading.value = true
|
||||
const searchObj = await getSearchData()
|
||||
try {
|
||||
// 获取数据
|
||||
|
||||
let data = await ReportApi.getTableList(props.reportCode, searchObj)
|
||||
|
||||
// 功能测试:CS_DTBT报表使用模拟数据
|
||||
@@ -458,7 +608,6 @@ const getTableData = async (isLoading = true) => {
|
||||
{ "yuefen": "五月", "benyue": 333, "leiji": 444 },
|
||||
{ "yuefen": "六月", "benyue": 555, "leiji": 555 },
|
||||
{ "yuefen": "六月", "benyue": 666, "leiji": 666 },
|
||||
|
||||
],
|
||||
total: 6
|
||||
}
|
||||
@@ -583,9 +732,10 @@ const getTableData = async (isLoading = true) => {
|
||||
// 没有分组字段,直接处理数据
|
||||
processedData = data.records.map((record, recordIndex) => {
|
||||
const flatRecord = { ...record }
|
||||
|
||||
// 处理固定列
|
||||
fieldList.value.forEach(field => {
|
||||
computedIncluedes(record,field.fieldCode)&&!textAlignFiels.value[field.fieldCode]?textAlignFiels.value[field.fieldCode]=true:''
|
||||
|
||||
if (field.isFixedColumn === 'Y' && field.fixedColumnValue) {
|
||||
const fixedValues = field.fixedColumnValue.split(',')
|
||||
flatRecord[field.fieldCode] = fixedValues[recordIndex] || ''
|
||||
@@ -596,34 +746,54 @@ const getTableData = async (isLoading = true) => {
|
||||
})
|
||||
}
|
||||
|
||||
tableData.value = processedData
|
||||
// amountFieds.value={
|
||||
// 'thissaqty_s':{
|
||||
// prop:'thissaqty',
|
||||
// },
|
||||
// "monthsaqty_s":{
|
||||
// prop:'monthsaqty',
|
||||
//},
|
||||
//'lastsaqty_s':{
|
||||
// prop:'lastsaqty'
|
||||
//}
|
||||
//}
|
||||
//tableData.value[0]['thissaqty_s']=6083195687
|
||||
// tableData.value[0]['monthsaqty_s']=972705058
|
||||
// tableData.value[0]['lastsaqty_s']=6075936725
|
||||
tableData.value = processedData
|
||||
Object.values(tableOption.value.column).forEach( item=>{
|
||||
let oldHide=hideCols.value.indexOf(item.prop)!==-1
|
||||
item.hide=tableData.value[0]&&((tableSearch.value['Group by']&&tableData.value[0][item.prop]===undefined&&!item.children)||(item.children?.every(child=>(!['yearplan','yearrate'].includes(child.prop))&&(tableData.value[0][child.prop]===undefined))))||oldHide
|
||||
const prH=hideColumns.value.indexOf(item.prop)
|
||||
item.hide?(prH===-1?hideColumns.value.push(item.prop):''):(prH!==-1&&hideCols.value.indexOf(item.prop)===-1?hideColumns.value.splice(prH,1):'')
|
||||
})
|
||||
|
||||
|
||||
let keys=Object.keys(amountFieds.value)
|
||||
if(!!keys.length&&!!tableData.value.length){
|
||||
let obj={isAmount:true}
|
||||
let value={...tableData.value[0]}
|
||||
if(tableInfo.value.reportCode==='ZHXSQK'){
|
||||
value=(await ReportApi.getAggMonthTotalDetail(searchObj))[0]
|
||||
// searchObj['usemonth']?'':value.thisMonthSaMoney_s=value.thissamoney_s
|
||||
|
||||
}
|
||||
keys.forEach(item=>{
|
||||
let key=amountFieds.value[item].prop
|
||||
key!=='fistField'?obj[key]=tableData.value[0][item]:''
|
||||
key!=='fistField'?obj[key]=value[item]:''
|
||||
})
|
||||
amountObj.value=obj
|
||||
}
|
||||
let field=tableSearch.value['Group by']
|
||||
let hides=[]
|
||||
if(field.length){
|
||||
field.forEach(item=>{
|
||||
hides=Object.keys(hideFeilds.value).length?hideFeilds.value[item].split(','):[]
|
||||
})
|
||||
}
|
||||
Object.keys(tableOption.value.column).forEach(key=>{
|
||||
let item=tableOption.value.column[key]
|
||||
item.hide=hides.includes(item.prop)||hideColumns.value.includes(item.prop)
|
||||
})
|
||||
Object.keys(tableOption.value.column).forEach(key=>{
|
||||
const showCols=Object.values(tableOption.value.column).filter(item=>!item.hide)
|
||||
let item=tableOption.value.column[key]
|
||||
item.children?'':(item.width=showCols.length<14?undefined:item.widthOld)
|
||||
item.children?.forEach(child=>{
|
||||
child.width=showCols.length<14?undefined:child.widthOld
|
||||
})
|
||||
})
|
||||
resolve(data.records)
|
||||
} finally {
|
||||
|
||||
if (isLoading) loading.value = false
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -668,24 +838,18 @@ const clearSearch = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const searchChange = (params?, done?) => {
|
||||
const searchChange = async (params?, done?) => {
|
||||
if (tablePage.value) tablePage.value['currentPage'] = 1
|
||||
getTableData().finally(() => {
|
||||
let field=tableSearch.value['Group by']
|
||||
let hides=[]
|
||||
if(field.length){
|
||||
hides=Object.keys(hideFeilds.value).length?hideFeilds.value[field].split(','):[]
|
||||
}
|
||||
Object.keys(tableOption.value.column).forEach(key=>{
|
||||
let item=tableOption.value.column[key]
|
||||
item.hide=hides.includes(item.prop)||hideColumns.value.includes(item.prop)
|
||||
})
|
||||
if (done) done()
|
||||
})
|
||||
await getTableData()
|
||||
|
||||
if (done) done()
|
||||
}
|
||||
const resetChange = () => {
|
||||
return new Promise(async (resolve) => {
|
||||
tableSearch.value = {}
|
||||
tableSearch.value = {
|
||||
'Group by':tableSearch.value['Group by']||[],
|
||||
...defualtSearch.value
|
||||
}
|
||||
if (tablePage.value) tablePage.value['currentPage'] = 1
|
||||
await getTableData()
|
||||
resolve(true)
|
||||
@@ -738,6 +902,15 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-form-item--default){
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
:deep(.avue-crud__pagination){
|
||||
padding-bottom: 0;
|
||||
}
|
||||
:deep(.avue-crud__tip){
|
||||
display: none;
|
||||
}
|
||||
.amountBox{
|
||||
&::after{
|
||||
content:'、'
|
||||
@@ -748,6 +921,36 @@ defineExpose({
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-table){
|
||||
.is-group th.el-table__cell,th.el-table__cell{
|
||||
background-color: #C6EFFE;
|
||||
}
|
||||
.el-table__body tr.hover-row>td.el-table__cell{
|
||||
background-color: #FFFFD2;
|
||||
|
||||
}
|
||||
&.el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell{
|
||||
background-color: #FFFFD2;
|
||||
}
|
||||
td.el-table__cell,th.el-table__cell{
|
||||
border-bottom: 1px solid #000 !important;
|
||||
|
||||
border-right: 1px solid #000 !important;
|
||||
|
||||
}
|
||||
td.textAlignCell .cell{
|
||||
span{
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
--el-table-border-color: #000;
|
||||
tfoot .el-table__cell{
|
||||
border-top: 1px solid #000 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.lastAmountRow{
|
||||
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ const btnData = computed(() => {
|
||||
if (!btnObj[key].display) continue
|
||||
btn[key] = btnObj[key]
|
||||
}
|
||||
|
||||
return { [props.type]: btn }
|
||||
} else {
|
||||
const menuObj = cloneDeep(props.buttonObj.menu)
|
||||
@@ -95,11 +96,17 @@ const btnData = computed(() => {
|
||||
if (props.row && props.row[`$btn__${key}`] !== undefined) {
|
||||
menuObj[key].display = props.row[`$btn__${key}`]
|
||||
}
|
||||
if(props.buttonObj.setConfig&&props.row){
|
||||
let data= props.buttonObj.setConfig(props.row)
|
||||
Object.keys(data).forEach(key => {
|
||||
menuObj[key]={ ...menuObj[key],...data[key]}
|
||||
})
|
||||
}
|
||||
if (!menuObj[key].display) continue
|
||||
if (props.type == 'more' && Object.keys(menu).length >= (props.maxNum || 1)) {
|
||||
more[key] = menuObj[key]
|
||||
} else menu[key] = menuObj[key]
|
||||
}
|
||||
}
|
||||
return { menu, more }
|
||||
}
|
||||
})
|
||||
|
||||
@@ -118,7 +118,7 @@ const getTableData = async () => {
|
||||
})
|
||||
if (userIds.length) {
|
||||
const dicRes = await DicApi.getDicTableText({
|
||||
lideeYunji_dictLabel: encryptAES(JSON.stringify([{ userIdList: [...new Set(userIds)] }]))
|
||||
lideeYunJi_dictLabel: encryptAES(JSON.stringify([{ userIdList: [...new Set(userIds)] }]))
|
||||
})
|
||||
if (dicRes?.userList) {
|
||||
dicRes.userList.forEach((item) => (userObj[item.id] = item.nickname))
|
||||
|
||||
@@ -1618,6 +1618,12 @@ const beforeOpen = async (done, type) => {
|
||||
const beforeClose = async (done, type) => {
|
||||
tableCurrRow.value = {}
|
||||
tableCurrType.value = ''
|
||||
try {
|
||||
if (jsEnhanceObj.value.beforeFormData)
|
||||
jsEnhanceObj.value.beforeFormData({}, type,'close')
|
||||
} catch (error) {
|
||||
enhanceErrorTip('js增强【beforeFormData】方法执行异常,请检查', error)
|
||||
}
|
||||
done()
|
||||
}
|
||||
|
||||
@@ -1897,6 +1903,16 @@ const initEnhanceUseFun = () => {
|
||||
if (!curConfig) enhanceErrorTip(`调用useFun.setPropConfig方法,未找到字段:${prop}`, '')
|
||||
else setDeepObject(curConfig, config)
|
||||
},
|
||||
/**
|
||||
* 设置按钮配置
|
||||
* @param prop 数据绑定key
|
||||
* @param config 需修改的配置,非覆盖,格式Object,支持深结构修改 例:'params.deep.deep'
|
||||
*/
|
||||
setMenuButtonConfig: (prop, config) => {
|
||||
if(buttonObj.value){
|
||||
setDeepObject(buttonObj.value, config)
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 设置附表控件配置
|
||||
* @param prop 数据绑定key
|
||||
|
||||
@@ -624,7 +624,7 @@ export const formDataFormatting = (formOption, formData, formType) => {
|
||||
}
|
||||
if (dicApiData.length) {
|
||||
DicApi.getDicTableText({
|
||||
lideeYunji_dictLabel: encryptAES(JSON.stringify(dicApiData))
|
||||
lideeYunJi_dictLabel: encryptAES(JSON.stringify(dicApiData))
|
||||
}).then(dicData => {
|
||||
const dictData = {
|
||||
userList: { dicKey: 'userSelect', label: 'nickname' },
|
||||
|
||||
@@ -24,7 +24,7 @@ export const setUserAndDeptName = (params) => {
|
||||
userList: { dicKey: 'userSelect', label: 'nickname' },
|
||||
deptList: { dicKey: 'deptSelect', label: 'name' }
|
||||
}
|
||||
getDicTableText({ lideeYunji_dictLabel: encryptAES(JSON.stringify(dictLabel)) }).then(
|
||||
getDicTableText({ lideeYunJi_dictLabel: encryptAES(JSON.stringify(dictLabel)) }).then(
|
||||
(dicData) => {
|
||||
for (const key in dicData) {
|
||||
const dicObj = {}
|
||||
|
||||
@@ -886,7 +886,7 @@ export const tableFormatting = (data, column, otherData: any = {}) => {
|
||||
})
|
||||
|
||||
//查询回显文本
|
||||
const dicApiData: any = { lideeYunji_dictLabel: [] }
|
||||
const dicApiData: any = { lideeYunJi_dictLabel: [] }
|
||||
if (dicTableData.keyList.length) {
|
||||
const dicTableApiData: Array<string> = []
|
||||
dicTableData.keyList.forEach(key => {
|
||||
@@ -899,17 +899,17 @@ export const tableFormatting = (data, column, otherData: any = {}) => {
|
||||
dicTableData[key].dataList = [...new Set(dicTableData[key].dataList)].filter((id: string) => !lowStore.dicObj[key] ? true : !lowStore.dicObj[key][id])
|
||||
if (dicTableData[key].dataList.length) dicTableApiData.push(dicTableData[key])
|
||||
})
|
||||
dicApiData.lideeYunji_dictLabel.push(...dicTableApiData)
|
||||
dicApiData.lideeYunJi_dictLabel.push(...dicTableApiData)
|
||||
}
|
||||
for (const key in userAndDeptControl.typeKey) {
|
||||
const abbr = userAndDeptControl.typeKey[key]
|
||||
userAndDeptControl[`${abbr}Ids`] = userAndDeptControl[`${abbr}Ids`].filter(id => {
|
||||
return /^(\d+)$/.test(id + '')
|
||||
})
|
||||
if (userAndDeptControl[`${abbr}Ids`].length) dicApiData.lideeYunji_dictLabel.push({ [`${abbr}IdList`]: [...new Set(userAndDeptControl[`${abbr}Ids`])] })
|
||||
if (userAndDeptControl[`${abbr}Ids`].length) dicApiData.lideeYunJi_dictLabel.push({ [`${abbr}IdList`]: [...new Set(userAndDeptControl[`${abbr}Ids`])] })
|
||||
}
|
||||
if (dicApiData.lideeYunji_dictLabel.length) {
|
||||
dicApiData.lideeYunji_dictLabel = encryptAES(JSON.stringify(dicApiData.lideeYunji_dictLabel))
|
||||
if (dicApiData.lideeYunJi_dictLabel.length) {
|
||||
dicApiData.lideeYunJi_dictLabel = encryptAES(JSON.stringify(dicApiData.lideeYunJi_dictLabel))
|
||||
const dictData = {
|
||||
userList: { dicKey: 'userSelect', label: 'nickname', value: 'id' },
|
||||
deptList: { dicKey: 'deptSelect', label: 'name', value: 'id' }
|
||||
|
||||
@@ -49,7 +49,7 @@ export default defineComponent({
|
||||
name: 'Layout',
|
||||
setup() {
|
||||
return () => (
|
||||
<section class={[prefixCls, `${prefixCls}__${layout.value}`, 'w-[100%] h-[100%] relative']}>
|
||||
<section class={[prefixCls, `${prefixCls}__${layout.value}`, 'w-[100%] h-[100%] relative']} >
|
||||
{mobile.value && !collapse.value ? (
|
||||
<div
|
||||
class="absolute left-0 top-0 z-99 h-full w-full bg-[var(--el-color-black)] opacity-30"
|
||||
|
||||
@@ -42,6 +42,7 @@ const formatComponentInstance = (component, route) => {
|
||||
|
||||
<template>
|
||||
<section
|
||||
style="padding-bottom:0"
|
||||
:class="[
|
||||
'flex-1 p-[var(--app-content-padding)] w-[calc(100%-var(--app-content-padding)-var(--app-content-padding))] bg-[var(--app-content-bg-color)] dark:bg-[var(--el-bg-color)]'
|
||||
]"
|
||||
|
||||
@@ -26,7 +26,7 @@ export const setupAvue = async (app: App<Element>) => {
|
||||
searchSpan: 6,
|
||||
searchMenuSpan: 6,
|
||||
searchMenuPosition: 'left',
|
||||
searchIndex: 3,
|
||||
searchIndex: 4,
|
||||
searchIcon: true,
|
||||
searchShowBtn: true,
|
||||
labelSuffix: ' ',
|
||||
|
||||
@@ -50,9 +50,11 @@
|
||||
|
||||
--app-content-bg-color: #f5f7f9;
|
||||
|
||||
--app-footer-height: 50px;
|
||||
--app-footer-height: 30px;
|
||||
|
||||
--transition-time-02: 0.2s;
|
||||
|
||||
--el-fill-color-lighter: #F5F5F6;
|
||||
}
|
||||
|
||||
.dark {
|
||||
|
||||
@@ -206,7 +206,7 @@ const handleLogin = async (params) => {
|
||||
authUtil.removeLoginForm()
|
||||
}
|
||||
authUtil.setToken(res)
|
||||
|
||||
|
||||
if (!redirect.value) {
|
||||
redirect.value = '/'
|
||||
}
|
||||
@@ -217,7 +217,7 @@ const handleLogin = async (params) => {
|
||||
const queryParams = new URLSearchParams(window.location.search);
|
||||
const ticketUrl = queryParams.get('url'); // 获取查询参数值,例如 ?paramName=value 中的 value
|
||||
const accessToken =authUtil.getAccessToken();
|
||||
|
||||
|
||||
console.log(accessToken);
|
||||
if(ticketUrl!=null){
|
||||
|
||||
|
||||
@@ -164,14 +164,14 @@ const infoColumn = {
|
||||
dictCode: { title: '字典Code', width: 180, editRender: { name: 'LowSelect', verifyEdit: true, filterable: true, noStop: true, dicData: [] } },
|
||||
isExport: { title: '是否可导出', width: 90, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
isHideCol: { title: '隐藏列', width: 90, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
isHideSearch: { title: '隐藏搜索', width: 90, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
// isHideSearch: { title: '隐藏搜索', width: 90, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
isAmount: { title: '是否合计', width: 75, align: "center", editRender: { name: 'LowCheckboxSum' } },
|
||||
isDimension: { title: '是否维度', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
|
||||
isHideDimension: { title: '维度隐藏列', width: 180, editRender: { name: 'LowSelectMultiple', verifyEdit: true, filterable: true, multiple:true,dicData: [] } },
|
||||
isShowSort: { title: '是否排序', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
isDynamicGroup: { title: '动态分组', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
hasChildren: { title: '子字段', width: 90, align: "center", editRender: { name: 'LowButton', disabled: (row) => row.isSubField === true, buttonText: '添加子字段', buttonType: 'primary', buttonSize: 'small' } },
|
||||
//isDynamicGroup: { title: '动态分组', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
//hasChildren: { title: '子字段', width: 90, align: "center", editRender: { name: 'LowButton', disabled: (row) => row.isSubField === true, buttonText: '添加子字段', buttonType: 'primary', buttonSize: 'small' } },
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
:row-class-name="rowClassName"
|
||||
@checkbox-all="(obj) => emit('selection-change', obj)"
|
||||
@checkbox-change="(obj) => emit('selection-change', obj)"
|
||||
@cell-click="(obj) => emit('cell-click', obj)"
|
||||
@cell-click="cellClick"
|
||||
>
|
||||
<vxe-column v-if="tabItem.edit" type="checkbox" width="50" align="center"></vxe-column>
|
||||
<vxe-column type="seq" width="50" align="center"></vxe-column>
|
||||
@@ -106,7 +106,16 @@ const testClick = (row) => {
|
||||
console.log('测试按钮被点击:', row)
|
||||
alert('测试按钮工作正常!')
|
||||
}
|
||||
|
||||
const cellClick = (obj) => {
|
||||
const scrollLeft = vxeTableRef.value.getScroll().scrollLeft
|
||||
const scrollTop = vxeTableRef.value.getScroll().scrollTop
|
||||
emit('cell-click', obj)
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
vxeTableRef.value.scrollTo(scrollLeft,scrollTop)
|
||||
}, 1)
|
||||
})
|
||||
}
|
||||
defineExpose({ vxeTableRef })
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user