Merge branch '0.8.X' of http://49.232.154.205:10100/DeXun/klp-oa into 0.8.X
This commit is contained in:
@@ -488,4 +488,12 @@ export function listLightCoil(data) {
|
||||
timeout: 600000,
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取可导出的列元数据
|
||||
export function getExportColumns() {
|
||||
return request({
|
||||
url: '/wms/materialCoil/exportColumns',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
@@ -56,6 +56,7 @@
|
||||
<el-form-item prop="endTime">
|
||||
<el-button type="primary" @click="getList">查询</el-button>
|
||||
<el-button type="primary" @click="exportData">导出</el-button>
|
||||
<el-button type="primary" @click="openCustomExport">自定义导出</el-button>
|
||||
<el-button type="primary" @click="settingVisible = true">列设置</el-button>
|
||||
<el-button type="primary" @click="saveReport">保存报表</el-button>
|
||||
</el-form-item>
|
||||
@@ -84,11 +85,45 @@
|
||||
</el-radio-group>
|
||||
<columns-setting :reportType="activeColumnConfig"></columns-setting>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 自定义导出列选择弹窗 -->
|
||||
<el-dialog title="自定义导出 - 选择导出列" :visible.sync="customExportVisible" width="750px">
|
||||
<div class="custom-export-toolbar">
|
||||
<el-input v-model="columnSearch" placeholder="搜索列名" prefix-icon="el-icon-search" clearable size="small" style="width: 220px" />
|
||||
<div class="custom-export-actions">
|
||||
<el-button size="small" @click="selectAllColumns">全选</el-button>
|
||||
<el-button size="small" @click="invertColumns">反选</el-button>
|
||||
<el-button size="small" @click="selectedColumns = []">清空</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="custom-export-body">
|
||||
<el-checkbox-group v-model="selectedColumns">
|
||||
<div v-for="(group, gName) in groupedColumns" :key="gName" class="column-group">
|
||||
<div class="column-group-title">{{ gName }}</div>
|
||||
<div class="column-group-items">
|
||||
<el-checkbox
|
||||
v-for="field in group"
|
||||
:key="field.key"
|
||||
:label="field.key"
|
||||
:style="{ display: columnSearch && !filterMatch(field) ? 'none' : '' }"
|
||||
>{{ field.label }}</el-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<div slot="footer" class="custom-export-footer">
|
||||
<span class="selected-tip">已选 <b>{{ selectedColumns.length }}</b> / {{ flatColumns.length }} 列</span>
|
||||
<el-button @click="customExportVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="doCustomExport" :disabled="selectedColumns.length === 0">
|
||||
导出选中列
|
||||
</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCoilWithIds } from "@/api/wms/coil";
|
||||
import { listCoilWithIds, getExportColumns } from "@/api/wms/coil";
|
||||
import {
|
||||
listPendingAction,
|
||||
} from '@/api/wms/pendingAction';
|
||||
@@ -146,6 +181,20 @@ export default {
|
||||
return {
|
||||
activeColumnConfig: 'coil-report-receive',
|
||||
settingVisible: false,
|
||||
customExportVisible: false,
|
||||
exportColumns: {},
|
||||
selectedColumns: [],
|
||||
columnSearch: '',
|
||||
columnGroups: {
|
||||
'基本信息': ['itemTypeDesc', 'warehouseName', 'actualWarehouseName', 'dataTypeText'],
|
||||
'钢卷号': ['enterCoilNo', 'supplierCoilNo', 'currentCoilNo'],
|
||||
'时间': ['createTime', 'exportTime', 'exportBy'],
|
||||
'物理属性': ['netWeight', 'length', 'specification', 'actualThickness'],
|
||||
'材质属性': ['material', 'manufacturer', 'surfaceTreatmentDesc', 'zincLayer', 'packingStatus', 'temperGrade', 'coatingType'],
|
||||
'用途': ['purpose', 'businessPurpose'],
|
||||
'状态': ['qualityStatus', 'statusDesc', 'isRelatedToOrderText'],
|
||||
'其他': ['itemName', 'itemId', 'packagingRequirement', 'trimmingRequirement', 'transferType', 'saleName', 'remark', 'team'],
|
||||
},
|
||||
list: [],
|
||||
defaultStartTime: startTime,
|
||||
defaultEndTime: endTime,
|
||||
@@ -221,6 +270,21 @@ export default {
|
||||
coilIds() {
|
||||
return this.list.map(item => item.coilId).join(',')
|
||||
},
|
||||
groupedColumns() {
|
||||
const result = {}
|
||||
Object.entries(this.columnGroups).forEach(([groupName, fieldKeys]) => {
|
||||
const items = fieldKeys
|
||||
.filter(key => this.exportColumns[key])
|
||||
.map(key => ({ key, label: this.exportColumns[key] }))
|
||||
if (items.length) {
|
||||
result[groupName] = items
|
||||
}
|
||||
})
|
||||
return result
|
||||
},
|
||||
flatColumns() {
|
||||
return Object.values(this.groupedColumns).flat()
|
||||
},
|
||||
|
||||
},
|
||||
methods: {
|
||||
@@ -282,6 +346,33 @@ export default {
|
||||
coilIds: this.coilIds,
|
||||
}, `materialCoil_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
// 打开自定义导出弹窗
|
||||
openCustomExport() {
|
||||
getExportColumns().then(res => {
|
||||
this.exportColumns = res.data
|
||||
this.selectedColumns = []
|
||||
this.customExportVisible = true
|
||||
})
|
||||
},
|
||||
// 执行自定义导出
|
||||
doCustomExport() {
|
||||
this.customExportVisible = false
|
||||
this.download('wms/materialCoil/exportCustom', {
|
||||
coilIds: this.coilIds,
|
||||
columns: this.selectedColumns.join(','),
|
||||
}, `materialCoil_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
filterMatch(field) {
|
||||
const keyword = this.columnSearch.toLowerCase()
|
||||
return !keyword || field.label.toLowerCase().includes(keyword) || field.key.toLowerCase().includes(keyword)
|
||||
},
|
||||
selectAllColumns() {
|
||||
this.selectedColumns = this.flatColumns.map(f => f.key)
|
||||
},
|
||||
invertColumns() {
|
||||
const allKeys = this.flatColumns.map(f => f.key)
|
||||
this.selectedColumns = allKeys.filter(k => !this.selectedColumns.includes(k))
|
||||
},
|
||||
saveReport() {
|
||||
this.loading = true
|
||||
saveReportFile(this.coilIds, {
|
||||
@@ -310,4 +401,53 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
<style scoped>
|
||||
.custom-export-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16px;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
}
|
||||
.custom-export-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
.custom-export-body {
|
||||
max-height: 420px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.column-group {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.column-group-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #606266;
|
||||
margin-bottom: 8px;
|
||||
padding-left: 2px;
|
||||
border-left: 3px solid #409eff;
|
||||
padding-left: 8px;
|
||||
}
|
||||
.column-group-items {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 4px 12px;
|
||||
}
|
||||
.column-group-items .el-checkbox {
|
||||
margin-right: 0;
|
||||
}
|
||||
.custom-export-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.selected-tip {
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
}
|
||||
.selected-tip b {
|
||||
color: #409eff;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user