From c018c2361b734127ffe422904fe9fdc3f7af755e Mon Sep 17 00:00:00 2001
From: "hongrui.an" <297504645@qq.com>
Date: Fri, 18 Jul 2025 17:28:57 +0800
Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Web/src/components/ediTtablePage/index.vue | 141 ++++++++++++++++-----
1 file changed, 110 insertions(+), 31 deletions(-)
diff --git a/Web/src/components/ediTtablePage/index.vue b/Web/src/components/ediTtablePage/index.vue
index abd02a4..cbe5ffe 100644
--- a/Web/src/components/ediTtablePage/index.vue
+++ b/Web/src/components/ediTtablePage/index.vue
@@ -51,14 +51,35 @@
- {{state.searchBtnOptions[btn].label}}
+
+
+
+
+ {{state.searchBtnOptions[btn].label}}
+
+
+
+
+ 按条件导出【当前页】
+ 按条件导出【全部】
+
+
+
+
+
{{state.searchBtnOptions[btn].label}}
+
@@ -328,7 +349,7 @@
type: Boolean,
default: false
},
- // 可编辑单元格判断禁用规则,默认为readState=true为禁用,
+ // 可编辑单元格/勾选框判断禁用规则,默认为readState=true为禁用,
// 如有特殊规则,则使用该方法特殊处理,当前判断方式为“=”,如后期有其他需求再进行封装
editDisabledConfig:{
type: Object,
@@ -494,7 +515,7 @@
}
// 格式化页面传参
- function getPageParams(){
+ function getPageParams(pageSize){
let _filters = []
if(props.hideSearch){
_filters = props.searchFilter
@@ -502,7 +523,7 @@
for(let i in props.searchFilter){
let _item = props.searchOptions.filter(item=>item.prop == i)
let _type = (_item && _item.length > 0) ? _item[0].type : null
- if(props.searchFilter[i] || props.searchFilter[i] == 0){
+ if((props.searchFilter[i] || props.searchFilter[i] == 0) && props.searchFilter[i] != ""){
// 时间区域格式
if(_type == 'datetimerange'){
_filters.push(
@@ -541,7 +562,7 @@
}
let _pageParams = getPageParamsForFilter({
pageNumber:state.pager.page,
- pageSize:state.pager.pageSize,
+ pageSize:pageSize || state.pager.pageSize,
sortBy:state.sortFilter.sortBy,
isAscending:state.sortFilter.isAscending,
condition:{
@@ -552,7 +573,7 @@
}
// 获取页面数据
- function getTableData(page) {
+ function getTableData(page,callback) {
state.stage_indexs = []
state.currentDetailId = null
state.headerInfoData = []
@@ -567,6 +588,7 @@
state.tableData = resp.data.data
state.stage_tableData = JSON.parse(JSON.stringify(resp.data.data))
state.pager.total = resp.data.totalCount
+ if(callback)callback(resp)
})
.catch(err=>{ElMessage.error('数据获取失败!')})
.finally(() => (state.loading = false))
@@ -580,12 +602,32 @@
state.tableData = resp.data.data
state.stage_tableData = JSON.parse(JSON.stringify(resp.data.data))
state.pager.total = resp.data.totalCount
+ if(callback)callback(resp)
})
.catch(err=>{ElMessage.error('数据获取失败!')})
.finally(() => (state.loading = false))
}
}
+
+ // 导出
+ function exportHandle(isAll){
+ state.loading = true
+ //同步数据查询
+ getTableData(1,(res=>{
+ let _params = getPageParams()
+ if(isAll){_params = getPageParams(res.data.totalCount)}
+ postCommonExport(props.apiName,_params)
+ .then((res) => {
+ let _str = isAll ? '全部' : '当页'
+ downloadByData(res.data,route.meta.title+`_按条件导出${_str}.xlsx`)
+ })
+ .catch(err=>{ElMessage.error('操作失败!')})
+ .finally(() => (state.loading = false))
+ }))
+
+ }
+
const importPopRef = ref()
// 头部查询按钮功能
function searchBtnHandle(btn){
@@ -609,19 +651,10 @@
importPopRef.value.open()
})
}
- // 导出
- else if (btn == 'export'){
- beforClearEdit().then(() => {
- state.loading = true
- getTableData()//同步数据查询
- postCommonExport(props.apiName,getPageParams())
- .then((res) => {
- downloadByData(res.data,route.meta.title+'.xlsx')
- })
- .catch(err=>{ElMessage.error('操作失败!')})
- .finally(() => (state.loading = false))
- })
- }
+ // 导出(按条件导出当前页)
+ // else if (btn == 'export'){
+ // exportHandle()
+ // }
// 手动开关
else if (btn == 'custominvoke'){
beforClearEdit().then(() => {
@@ -759,8 +792,29 @@
}
// 检查行数据是否符合禁用规则
- function checkDisableByRowRule(row){
+ function checkDisableByRowRule(row,item){
+ let hasDisable = false
+ // 根据editDisabledConfig规则处理禁用
+ for(let i = 0;i{
state.headerInfoData.push({
label:item.title,
- value:res.data[item.prop]
+ value:res.data[item.prop],
+ prop:item.prop
})
})
})
@@ -828,6 +883,30 @@
if(state.stage_indexs.indexOf(scope.$index) < 0){
state.stage_indexs.push(scope.$index)
}
+ // 更改反馈结果
+ // 现所有风险页面,规则相同,所以统一再此处理,如果有更改需要重新做封装处理
+ if(item.prop == "feedbackResults"){
+ // 如果反馈结果更改为无异常
+ if(scope.row.feedbackResults == '0'){
+ // 清空类型,风险,措施
+ scope.row.ventureType = ""
+ scope.row.ventureSpecific = ""
+ scope.row.measures = ""
+ // 其他数值恢复为原数据(明细中的值)
+ // 风险页面与明细对应数量匹配prop
+ let _tableColums = props.tableColumns || apiTableColumns[props.apiName]
+ for(let prop in scope.row){
+ let _item = _tableColums.filter(item=>item.prop == prop)
+ if(_item && _item.length > 0 && _item[0].relevProp){
+ let _relevProp = _item[0].relevProp
+ let _list = state.headerInfoData.filter(item=>item.prop == _relevProp)
+ if(_list && _list.length>0){
+ scope.row[prop] = _list[0].value
+ }
+ }
+ }
+ }
+ }
}
// 其他操作清空保存前提示