Compare commits

...

2 Commits

Author SHA1 Message Date
砂糖
519e91b299 Merge branch '0.8.X' of http://49.232.154.205:10100/DeXun/klp-oa into 0.8.X 2026-03-25 09:04:54 +08:00
砂糖
bb79b02ee4 refactor(wms): 优化报表查询逻辑和界面显示
- 将查询参数中的 updateBy 改为 createBy 以匹配实际业务需求
- 移除不再使用的 selectType 参数
- 优化员工信息页面显示,调整离职时间展示
- 提取公共的 fetch 逻辑到单独文件
- 重构报表查询逻辑,使用 Promise.all 并行请求
- 调整钢卷文档页面,增加创建人选择功能
2026-03-25 09:04:48 +08:00
15 changed files with 164 additions and 236 deletions

View File

@@ -102,8 +102,16 @@
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createByName" width="100" />
<el-table-column label="操作人" align="center" prop="updateBy" width="100" />
<el-table-column label="创建人" align="center" prop="createByName" width="140">
<template slot-scope="scope">
<el-select @change="handleProcessTimeChange(scope.row)" v-model="scope.row.createBy" placeholder="请选择创建人" filterable>
<el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userName" />
</el-select>
<!-- <span>{{ scope.row.createByName }}</span> -->
</template>
</el-table-column>
<el-table-column label="完成时间" align="center" prop="completeTime" width="220" :show-overflow-tooltip="true">
<template slot-scope="scope">
@@ -234,6 +242,7 @@ import {
cancelAction,
restorePendingAction,
} from '@/api/wms/pendingAction';
import { listUser } from '@/api/system/user';
import CoilSelector from '@/components/CoilSelector';
import CoilNo from '@/components/KLPService/Renderer/CoilNo.vue';
@@ -288,7 +297,9 @@ export default {
]
},
// 钢卷选择器可见性
coilSelectorVisible: false
coilSelectorVisible: false,
// 用户列表
userList: [],
};
},
computed: {
@@ -321,6 +332,8 @@ export default {
this.getList();
// 设置定时刷新(可选,用于移动端扫码后自动刷新)
this.startAutoRefresh();
// 查询用户列表
this.getUserList();
},
beforeDestroy() {
// 清除定时器
@@ -345,6 +358,12 @@ export default {
this.loading = false;
});
},
/** 查询用户列表 */
getUserList() {
listUser({ pageSize: 9999 }).then(response => {
this.userList = response.rows;
});
},
switchActionStatus(value) {
console.log(value)
if (!value) {

View File

@@ -230,8 +230,8 @@
<el-descriptions-item label="打包状态">{{ selectedSplitItem.packingStatus || '-' }}</el-descriptions-item>
<el-descriptions-item label="包装要求">{{ selectedSplitItem.packagingRequirement || '-'
}}</el-descriptions-item>
<el-descriptions-item label="毛重">{{ selectedSplitItem.grossWeight || '-' }} kg</el-descriptions-item>
<el-descriptions-item label="净重">{{ selectedSplitItem.netWeight || '-' }} kg</el-descriptions-item>
<el-descriptions-item label="毛重">{{ selectedSplitItem.grossWeight || '-' }} t</el-descriptions-item>
<el-descriptions-item label="净重">{{ selectedSplitItem.netWeight || '-' }} t</el-descriptions-item>
<el-descriptions-item label="长度" v-if="selectedSplitItem.length">{{ selectedSplitItem.length }}
m</el-descriptions-item>
<el-descriptions-item label="调制度">{{ selectedSplitItem.temperGrade || '-' }}</el-descriptions-item>

View File

@@ -85,7 +85,7 @@
<el-table-column label="年龄" align="center" prop="age" />
<el-table-column label="性别" align="center" prop="gender" />
<el-table-column label="学历" align="center" prop="education" />
<el-table-column label="家庭住址" align="center" prop="homeAddress" />
<!-- <el-table-column label="家庭住址" align="center" prop="homeAddress" /> -->
<el-table-column label="联系电话" align="center" prop="phone" />
<el-table-column label="入职时间" align="center" prop="entryTime" width="180">
<template slot-scope="scope">
@@ -94,8 +94,8 @@
</el-table-column>
<el-table-column label="在职天数" align="center">
<template slot-scope="scope">
<el-tag :type="getRegularStatus(scope.row.entryTime, scope.row.isRegular).type">
{{ getRegularStatus(scope.row.entryTime, scope.row.isRegular).days }}
<el-tag :type="getRegularStatus(scope.row.entryTime, scope.row.isRegular, scope.row.isLeave).type">
{{ getRegularStatus(scope.row.entryTime, scope.row.isRegular, scope.row.isLeave).days }}
</el-tag>
</template>
</el-table-column>
@@ -106,7 +106,7 @@
<el-table-column label="在职状态" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.isLeave === 0 ? 'success' : 'danger'">
{{ scope.row.isLeave === 0 ? '在职' : '已离职' }}
{{ scope.row.isLeave == 0 ? '在职' : parseTime(scope.row.leaveTime, '{y}-{m}-{d}') }}
</el-tag>
</template>
</el-table-column>
@@ -154,6 +154,13 @@
placeholder="请选择入职时间" style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12" v-if="form.isLeave == 1">
<el-form-item label="离职时间" prop="leaveTime">
<el-date-picker clearable v-model="form.leaveTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择离职时间" style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
@@ -593,7 +600,7 @@ export default {
});
},
/** 计算入职天数和转正状态 */
getRegularStatus(entryTime, isRegular) {
getRegularStatus(entryTime, isRegular, isLeave) {
if (!entryTime) return { days: 0, type: '', status: 0 };
const entryDate = new Date(entryTime);
@@ -603,6 +610,12 @@ export default {
let type = '';
let status = isRegular || 0;
// 如果是已离职的使用primary
if (isLeave === 1) {
type = 'primary';
return { days: diffDays, type, status };
}
if (status === 0) {
// 未转正

View File

@@ -17,7 +17,7 @@
return {
actionTypes: [505, 120],
actionQueryParams: {
updateBy: 'dugekuguan'
createBy: 'dugekuguan'
},
}
}

View File

@@ -0,0 +1,77 @@
import { listCoilWithIds } from "@/api/wms/coil";
import {
listPendingAction,
} from '@/api/wms/pendingAction';
export async function fetchOutputList(queryParams) {
const resList = await Promise.all([
listCoilWithIds({
...queryParams,
selectType: 'raw_material',
itemType: 'raw_material',
pageSize: 99999,
pageNum: 1,
}),
listCoilWithIds({
...queryParams,
selectType: 'product',
itemType: 'product',
pageSize: 99999,
pageNum: 1,
}),
])
const list = resList.flatMap(res => res.rows)
// 按照createTime 降序排序
const sortedList = list.sort(
(a, b) => new Date(b.createTime) - new Date(a.createTime)
).map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
return sortedList
}
export async function fetchLossList(queryParams) {
const resultList = await Promise.all(this.actionTypes.map(actionType => {
return listPendingAction({
...queryParams,
actionStatus: 2,
actionType,
pageSize: 99999,
pageNum: 1,
})
}))
const actions = resultList.flatMap(item => item.rows)
const actionIds = actions.map(item => item.actionId).join(',')
console.log(actionIds)
if (!actionIds) {
this.$message({
message: '暂无数据',
type: 'warning',
})
throw new Error('暂无数据')
}
const res = await listCoilWithIds({
...queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
actionIds: actionIds,
pageSize: 99999,
pageNum: 1,
})
const lossList = res.rows.map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification?.split('*') || [0, 0]
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
return lossList
}

View File

@@ -17,7 +17,7 @@
return {
actionTypes: [504, 120],
actionQueryParams: {
updateBy: 'shuangkuguan'
createBy: 'shuangkuguan'
},
}
}

View File

@@ -192,7 +192,6 @@ export default {
// date: currentDate, // 绑定日期选择器的默认值(当天)
byCreateTimeStart: start, // 默认当天0点
byCreateTimeEnd: end, // 默认当天23:59:59
selectType: 'product',
enterCoilNo: '',
currentCoilNo: '',
warehouseId: '',
@@ -293,7 +292,6 @@ export default {
}
})
this.getLossList()
// this.loading = false
})
},
async getLossList() {

View File

@@ -209,22 +209,11 @@ export default {
this.loading = false
return
}
// const coilIds = actions.map(item => item.coilId).join(',')
// if (!coilIds) {
// this.$message({
// message: '暂无数据',
// type: 'warning',
// })
// this.list = []
// this.loading = false
// return
// }
listCoilWithIds({
...this.queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
actionIds: actionIds,
// coilIds: coilIds,
}).then(res => {
this.list = res.rows.map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度

View File

@@ -92,7 +92,7 @@
<!-- 异常统计 -->
<el-descriptions title="异常统计" :column="4" border>
<el-descriptions-item v-for="item in abSummary" :key="item.label" :label="item.label">{{ item.value
}}</el-descriptions-item>
}}</el-descriptions-item>
</el-descriptions>
<el-descriptions title="明细信息" :column="3" border>
@@ -222,7 +222,6 @@ export default {
date: currentDate, // 绑定日期选择器的默认值(当天)
byCreateTimeStart: start, // 默认当天0点
byCreateTimeEnd: end, // 默认当天23:59:59
selectType: 'product',
enterCoilNo: '',
currentCoilNo: '',
warehouseId: '',
@@ -286,13 +285,12 @@ export default {
},
// 统一查询入口(兼容回车和按钮点击)
handleQuery() {
this.getList()
// this.getLossList()
this.fetchData()
},
// 核心查询逻辑
getList() {
async getList() {
this.loading = true
Promise.all([
const resList = await Promise.all([
listCoilWithIds({
selectType: 'raw_material',
itemType: 'raw_material',
@@ -307,25 +305,24 @@ export default {
...this.queryParams,
...this.baseQueryParams,
}),
]).then((resList) => {
console.log(resList)
const list = resList.flatMap(res => res.rows)
// 按照createTime 降序排序
this.list = list.sort(
(a, b) => new Date(b.createTime) - new Date(a.createTime)
).map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
// this.loading = false
this.getLossList()
// this.loading = false
])
console.log(resList)
const list = resList.flatMap(res => res.rows)
// 按照createTime 降序排序
this.list = list.sort(
(a, b) => new Date(b.createTime) - new Date(a.createTime)
).map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
// this.loading = false
// this.getLossList()
// this.loading = false
},
async getLossList() {
this.loading = true
@@ -353,23 +350,22 @@ export default {
this.loading = false
return
}
listCoilWithIds({
const res = await listCoilWithIds({
...this.queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
coilIds: coilIds,
}).then(res => {
this.lossList = res.rows.map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
this.loading = false
})
this.lossList = res.rows.map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
this.loading = false
},
// 导出
exportData() {
@@ -390,11 +386,19 @@ export default {
coilIds: this.lossList.map(item => item.coilId).join(',')
}, `materialCoil_${this.queryParams.date}_${new Date().getTime()}.xlsx`)
},
fetchData() {
this.loading = true
Promise.all([
this.getList(),
this.getLossList()
]).then(() => {
this.loading = false
})
},
},
mounted() {
this.getList()
// this.getLossList()
this.loadColumns()
this.fetchData()
}
}
</script>

View File

@@ -19,8 +19,6 @@
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="逻辑库位" prop="endTime">
<!-- <warehouse-select v-model="queryParams.warehouseId" placeholder="请选择仓库/库区/库位"
style="width: 100%; display: inline-block; width: 200px;" clearable /> -->
<el-select v-model="warehouseIds" collapse-tags multiple placeholder="请选择逻辑库位" style="width: 200px;">
<el-option v-for="item in warehouseOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>

View File

@@ -1,168 +0,0 @@
<template>
<div class="app-container" v-loading="loading">
<el-row>
<el-form label-width="80px" inline>
<el-form-item label="开始时间" prop="startDate">
<el-date-picker style="width: 200px;" v-model="queryParams.startDate" type="date" value-format="yyyy-MM-dd"
placeholder="选择开始日期" @change="handleDateChange"></el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endDate">
<el-date-picker style="width: 200px;" v-model="queryParams.endDate" type="date" value-format="yyyy-MM-dd"
placeholder="选择结束日期" @change="handleDateChange"></el-date-picker>
</el-form-item>
<el-form-item label="入场钢卷号" prop="enterCoilNo">
<el-input style="width: 200px; display: inline-block;" v-model="queryParams.enterCoilNo"
placeholder="请输入入场钢卷号" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="当前钢卷号" prop="currentCoilNo">
<el-input style="width: 200px;" v-model="queryParams.currentCoilNo" placeholder="请输入当前钢卷号" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="逻辑库位" prop="warehouseIds">
<el-select v-model="warehouseIds" collapse-tags multiple placeholder="请选择逻辑库位" style="width: 200px;">
<el-option v-for="item in warehouseOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="产品名称" prop="itemName">
<el-input style="width: 200px;" v-model="queryParams.itemName" placeholder="请输入产品名称" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="规格" prop="itemSpecification">
<memo-input style="width: 200px;" v-model="queryParams.itemSpecification" storageKey="coilSpec"
placeholder="请选择规格" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="材质" prop="itemMaterial">
<muti-select style="width: 200px;" v-model="queryParams.itemMaterial" :options="dict.type.coil_material"
placeholder="请选择材质" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="厂家" prop="itemManufacturer">
<muti-select style="width: 200px;" v-model="queryParams.itemManufacturer"
:options="dict.type.coil_manufacturer" placeholder="请选择厂家" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">查询</el-button>
<el-button type="primary" @click="exportData">导出产出钢卷</el-button>
<el-button type="primary" @click="exportLossData">导出消耗钢卷</el-button>
<el-button type="primary" @click="settingVisible = true">列设置</el-button>
</el-form-item>
</el-form>
</el-row>
<el-descriptions title="统计信息" :column="3" border>
<el-descriptions-item label="产出数量">{{ summary.outCount }}</el-descriptions-item>
<el-descriptions-item label="产出总重">{{ summary.outTotalWeight }}t</el-descriptions-item>
<el-descriptions-item label="产出均重">{{ summary.outAvgWeight }}t</el-descriptions-item>
<el-descriptions-item label="消耗数量">{{ summary.lossCount }}</el-descriptions-item>
<el-descriptions-item label="消耗总重">{{ summary.lossTotalWeight }}t</el-descriptions-item>
<el-descriptions-item label="消耗均重">{{ summary.lossAvgWeight }}t</el-descriptions-item>
<el-descriptions-item label="合计数量">{{ summary.totalCount }}</el-descriptions-item>
<el-descriptions-item label="合计总重">{{ summary.totalWeight }}t</el-descriptions-item>
<el-descriptions-item label="合计均重">{{ summary.totalAvgWeight }}t</el-descriptions-item>
<!-- 成品率 -->
<el-descriptions-item label="成品率">{{ summary.passRate }}</el-descriptions-item>
<el-descriptions-item label="损耗率">{{ summary.lossRate }}</el-descriptions-item>
<!-- 异常率 -->
<el-descriptions-item label="异常率">{{ summary.abRate }}</el-descriptions-item>
<!-- 正品率 -->
<el-descriptions-item label="正品率">{{ summary.passRate2 }}</el-descriptions-item>
</el-descriptions>
<!-- 异常统计 -->
<el-descriptions title="异常统计" :column="4" border>
<el-descriptions-item v-for="item in abSummary" :key="item.label" :label="item.label">{{ item.value
}}</el-descriptions-item>
</el-descriptions>
<el-descriptions title="明细信息" :column="3" border>
</el-descriptions>
<el-tabs v-model="activeTab">
<el-tab-pane label="产出钢卷" name="output">
<coil-table :columns="outputColumns" :data="list"></coil-table>
</el-tab-pane>
<el-tab-pane label="投入钢卷" name="loss">
<coil-table :columns="lossColumns" :data="lossList"></coil-table>
</el-tab-pane>
</el-tabs>
<el-dialog title="列设置" :visible.sync="settingVisible" width="50%">
<el-radio-group v-model="activeColumnConfig">
<el-radio-button label="coil-report-loss">投入明细配置</el-radio-button>
<el-radio-button label="coil-report-output">产出明细配置</el-radio-button>
</el-radio-group>
<columns-setting :reportType="activeColumnConfig"></columns-setting>
</el-dialog>
</div>
</template>
<script>
import { listCoilWithIds } from "@/api/wms/coil";
import {
listPendingAction,
} from '@/api/wms/pendingAction';
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
import RawMaterialInfo from "@/components/KLPService/Renderer/RawMaterialInfo";
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
import MemoInput from "@/components/MemoInput";
import MutiSelect from "@/components/MutiSelect";
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import { calcSummary, calcAbSummary } from "@/views/wms/report/js/calc";
import ColumnsSetting from "@/views/wms/report/components/setting/columns.vue";
import CoilTable from "@/views/wms/report/components/coilTable/index.vue";
export default {
name: 'ShuangTemplate',
components: {
ProductInfo,
RawMaterialInfo,
CoilNo,
MemoInput,
MutiSelect,
WarehouseSelect,
ColumnsSetting,
CoilTable,
},
props: {
actionTypes: {
type: Array,
default: () => [],
},
actionQueryParams: {
type: Object,
default: () => { },
},
baseQueryParams: {
type: Object,
default: () => ({})
},
warehouseOptions: {
type: Array,
default: () => []
}
},
dicts: ['product_coil_status', 'coil_material', 'coil_itemname', 'coil_manufacturer'],
data() {
// 工具函数:个位数补零
const addZero = (num) => num.toString().padStart(2, '0')
// 获取当前日期(默认选中当天)
const now = new Date()
const currentDate = `${now.getFullYear()}-${addZero(now.getMonth() + 1)}-${addZero(now.getDate())}`
return {
activeTab: 'output',
activeColumnConfig: 'coil-report-loss',
settingVisible: false,
list: [],
lossList: [],
queryParams: {
pageNum: 1,
pageSize: 9999,
startDate: currentDate, // 绑定开始日期选择器的默认值
endDate: currentDate, // 绑定结束日期选择器的默认值
byCreateTimeStart: `${currentDate} 00:00:00`, // 默认当天0点
byCreateTimeEnd: `${currentDate} 23:59:59`, // 默认当天23:59:59
selectType: 'product',
enterCoilNo: '',

View File

@@ -193,7 +193,6 @@ export default {
date: currentDate,
byCreateTimeStart: start,
byCreateTimeEnd: end,
selectType: 'product',
enterCoilNo: '',
currentCoilNo: '',
warehouseId: '',

View File

@@ -201,7 +201,6 @@ export default {
date: currentDate, // 绑定日期选择器的默认值(当天)
byCreateTimeStart: start, // 默认当天0点
byCreateTimeEnd: end, // 默认当天23:59:59
selectType: 'product',
enterCoilNo: '',
currentCoilNo: '',
warehouseId: '',

View File

@@ -17,7 +17,7 @@
return {
actionTypes: [502, 120],
actionQueryParams: {
updateBy: 'tuozhikuguan'
createBy: 'tuozhikuguan'
},
}
}

View File

@@ -17,7 +17,7 @@
return {
actionTypes: [11, 120],
actionQueryParams: {
updateBy: 'suanzhakuguan'
createBy: 'suanzhakuguan'
},
}
}