2月3日提交是否维度和合计功能
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
:data="tableData"
|
:data="tableData"
|
||||||
:option="tableOption"
|
:option="tableOption"
|
||||||
v-bind="crudBind"
|
v-bind="crudBind"
|
||||||
|
:summary-method=summaryMethod1
|
||||||
@search-change="searchChange"
|
@search-change="searchChange"
|
||||||
@search-reset="resetChange"
|
@search-reset="resetChange"
|
||||||
@refresh-change="refreshChange"
|
@refresh-change="refreshChange"
|
||||||
@@ -66,8 +67,8 @@
|
|||||||
:column="scope.column"
|
:column="scope.column"
|
||||||
></InputTimeRange>
|
></InputTimeRange>
|
||||||
</template>
|
</template>
|
||||||
<template #page>
|
<template #header>
|
||||||
合计:
|
|
||||||
</template>
|
</template>
|
||||||
</avue-crud>
|
</avue-crud>
|
||||||
</div>
|
</div>
|
||||||
@@ -117,8 +118,8 @@ const numberRange = ref<string[]>([])
|
|||||||
const dateRange=ref<string[]>([])
|
const dateRange=ref<string[]>([])
|
||||||
const dateTimeRange=ref<string[]>([])
|
const dateTimeRange=ref<string[]>([])
|
||||||
const timeRange=ref<string[]>([])
|
const timeRange=ref<string[]>([])
|
||||||
|
const amountFieds=ref<any>({})
|
||||||
|
const amountObj=ref<any>({})
|
||||||
const crudRef = ref()
|
const crudRef = ref()
|
||||||
|
|
||||||
const exportLoading = ref(false)
|
const exportLoading = ref(false)
|
||||||
@@ -133,6 +134,24 @@ const crudBind = computed(() => {
|
|||||||
return obj
|
return obj
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const setLastAmountRowClass=(row,rowIndex)=>{
|
||||||
|
if(row.isAmount===true){
|
||||||
|
return 'lastAmountRow'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const summaryMethod1=({columns,data})=>{
|
||||||
|
// 1. 初始化汇总结果数组(和表格列数量一致)
|
||||||
|
const result = new Array(columns.length).fill("");
|
||||||
|
result[0] = `合计`;
|
||||||
|
|
||||||
|
let keys=Object.values(amountFieds.value).map(item=>item.prop)
|
||||||
|
columns.forEach((item,index)=>{
|
||||||
|
if(keys.includes(item.property)){
|
||||||
|
result[index]=amountObj.value[item.property]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return result;
|
||||||
|
}
|
||||||
const initTable = async () => {
|
const initTable = async () => {
|
||||||
isInit.value = false
|
isInit.value = false
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@@ -152,6 +171,8 @@ const initTable = async () => {
|
|||||||
index: reportVo.tableConfig.includes('index'),
|
index: reportVo.tableConfig.includes('index'),
|
||||||
border: reportVo.tableConfig.includes('border'),
|
border: reportVo.tableConfig.includes('border'),
|
||||||
stripe: reportVo.tableConfig.includes('stripe'),
|
stripe: reportVo.tableConfig.includes('stripe'),
|
||||||
|
showSummary:true,
|
||||||
|
|
||||||
column: {}
|
column: {}
|
||||||
}
|
}
|
||||||
//国际化处理
|
//国际化处理
|
||||||
@@ -160,7 +181,7 @@ const initTable = async () => {
|
|||||||
mergeLocaleMessage(key, { [props.reportCode]: fieldLengObj[key] })
|
mergeLocaleMessage(key, { [props.reportCode]: fieldLengObj[key] })
|
||||||
}
|
}
|
||||||
//字段处理
|
//字段处理
|
||||||
fieldList.forEach((item) => {
|
fieldList.forEach((item,index) => {
|
||||||
const config: any = {
|
const config: any = {
|
||||||
prop: item.fieldCode,
|
prop: item.fieldCode,
|
||||||
label: t(`${props.reportCode}.${item.fieldCode}`),
|
label: t(`${props.reportCode}.${item.fieldCode}`),
|
||||||
@@ -168,7 +189,11 @@ const initTable = async () => {
|
|||||||
overHidden: true,
|
overHidden: true,
|
||||||
isExport: item.isExport == 'Y',
|
isExport: item.isExport == 'Y',
|
||||||
sortable: item.isShowSort == 'Y' ? 'custom' : false,
|
sortable: item.isShowSort == 'Y' ? 'custom' : false,
|
||||||
search: item.queryIsWeb == 'Y'
|
search: item.queryIsWeb == 'Y',
|
||||||
|
}
|
||||||
|
if(!!item.isAmount){
|
||||||
|
index==0?amountFieds.value.fistField=config.prop:''
|
||||||
|
amountFieds.value[item.isAmount]=config
|
||||||
}
|
}
|
||||||
if (item.queryMode == 'RANGE') config.searchRange = true
|
if (item.queryMode == 'RANGE') config.searchRange = true
|
||||||
if (['Integer', 'BigInt', 'BigDecimal'].includes(item.fieldType)) config.type = 'number'
|
if (['Integer', 'BigInt', 'BigDecimal'].includes(item.fieldType)) config.type = 'number'
|
||||||
@@ -275,6 +300,30 @@ const getTableData = async (isLoading = true) => {
|
|||||||
const data = await ReportApi.getTableList(props.reportCode, searchObj)
|
const data = await ReportApi.getTableList(props.reportCode, searchObj)
|
||||||
if (tablePage.value) tablePage.value['total'] = data.total
|
if (tablePage.value) tablePage.value['total'] = data.total
|
||||||
tableData.value = data.records
|
tableData.value = data.records
|
||||||
|
// 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
|
||||||
|
|
||||||
|
let keys=Object.keys(amountFieds.value)
|
||||||
|
if(!!keys.length&&!!tableData.value.length){
|
||||||
|
let obj={isAmount:true}
|
||||||
|
keys.forEach(item=>{
|
||||||
|
let key=amountFieds.value[item].prop
|
||||||
|
key!=='fistField'?obj[key]=tableData.value[0][item]:''
|
||||||
|
})
|
||||||
|
amountObj.value=obj
|
||||||
|
}
|
||||||
resolve(data.records)
|
resolve(data.records)
|
||||||
} finally {
|
} finally {
|
||||||
if (isLoading) loading.value = false
|
if (isLoading) loading.value = false
|
||||||
@@ -382,4 +431,16 @@ defineExpose({
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped>
|
||||||
|
.amountBox{
|
||||||
|
&::after{
|
||||||
|
content:'、'
|
||||||
|
}
|
||||||
|
&:last-of-type::after{
|
||||||
|
content:''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.lastAmountRow{
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ export const useRenderVxeColumn = (useType = 'table') => {
|
|||||||
return <el-checkbox v-model={row[column.field]} true-value={row.fieldCode+'_s'} false-value="" />
|
return <el-checkbox v-model={row[column.field]} true-value={row.fieldCode+'_s'} false-value="" />
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
LowSelect: {
|
LowSelect: {
|
||||||
default: (renderOpts, { row, column }, isStop = false) => {
|
default: (renderOpts, { row, column }, isStop = false) => {
|
||||||
if (column.field == 'dictType' && !row[column.field] && infoTableIsEdit({ row, column }, renderOpts)) {
|
if (column.field == 'dictType' && !row[column.field] && infoTableIsEdit({ row, column }, renderOpts)) {
|
||||||
|
|||||||
@@ -156,7 +156,9 @@ const infoColumn = {
|
|||||||
queryMode: { title: '查询模式', width: 130, editRender: { name: 'LowSelect', verifyEdit: true, dicData: dicObj.queryMode, dicObj: getDicObj('queryMode') } },
|
queryMode: { title: '查询模式', width: 130, editRender: { name: 'LowSelect', verifyEdit: true, dicData: dicObj.queryMode, dicObj: getDicObj('queryMode') } },
|
||||||
dictCode: { title: '字典Code', width: 180, editRender: { name: 'LowSelect', verifyEdit: true, filterable: true, noStop: true, dicData: [] } },
|
dictCode: { title: '字典Code', width: 180, editRender: { name: 'LowSelect', verifyEdit: true, filterable: true, noStop: true, dicData: [] } },
|
||||||
isExport: { title: '是否可导出', width: 90, align: "center", editRender: { name: 'LowCheckbox' } },
|
isExport: { title: '是否可导出', width: 90, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||||
isSort: { title: '是否合计', width: 75, align: "center", editRender: { name: 'LowCheckboxSum' } },
|
isAmount: { title: '是否合计', width: 75, align: "center", editRender: { name: 'LowCheckboxSum' } },
|
||||||
|
isDimension: { title: '是否维度', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||||
|
|
||||||
isShowSort: { title: '是否排序', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
|
isShowSort: { title: '是否排序', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -174,7 +176,7 @@ for (const key in infoColumn) {
|
|||||||
//默认值
|
//默认值
|
||||||
const infoDefaultData = {
|
const infoDefaultData = {
|
||||||
basics: {
|
basics: {
|
||||||
fieldCode: '', fieldName: '', labelI18n: '', fieldType: 'String', queryIsDb: 'N', queryIsWeb: 'N', queryMode: 'LIKE', dictCode: '', isExport: 'Y', isShowSort: 'N',isSort:''
|
fieldCode: '', fieldName: '', labelI18n: '', fieldType: 'String', queryIsDb: 'N', queryIsWeb: 'N', queryMode: 'LIKE', dictCode: '', isExport: 'Y', isShowSort: 'N',isAmount:'',isDimension:''
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user