refactor(wms): 优化合卷逻辑和员工选择组件
- 移除合卷流程中的箭头图示和最小源卷数量限制 - 修改处理时间显示为完成时间并更新相关字段 - 优化员工选择组件的前端筛选和取消操作处理
This commit is contained in:
@@ -1,10 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="employee-selector">
|
<div class="employee-selector">
|
||||||
<!-- 触发器 -->
|
<!-- 触发器 -->
|
||||||
<div
|
<div class="trigger" @click="toggleDialog">
|
||||||
class="trigger"
|
|
||||||
@click="toggleDialog"
|
|
||||||
>
|
|
||||||
<slot name="trigger">
|
<slot name="trigger">
|
||||||
<div class="default-trigger">
|
<div class="default-trigger">
|
||||||
{{ displayText }}
|
{{ displayText }}
|
||||||
@@ -13,47 +10,22 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 选择对话框 -->
|
<!-- 选择对话框 -->
|
||||||
<el-dialog
|
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||||
:title="title"
|
<el-input v-model="searchQuery" placeholder="请输入员工姓名或部门" clearable @keyup.enter.native="handleSearch">
|
||||||
:visible.sync="open"
|
<el-button slot="append" icon="el-icon-search" @click="handleSearch" />
|
||||||
width="600px"
|
|
||||||
append-to-body
|
|
||||||
>
|
|
||||||
<el-input
|
|
||||||
v-model="searchQuery"
|
|
||||||
placeholder="请输入员工姓名或部门"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleSearch"
|
|
||||||
>
|
|
||||||
<el-button
|
|
||||||
slot="append"
|
|
||||||
icon="el-icon-search"
|
|
||||||
@click="handleSearch"
|
|
||||||
/>
|
|
||||||
</el-input>
|
</el-input>
|
||||||
|
|
||||||
<!-- 已选员工列表(多选模式) -->
|
<!-- 已选员工列表(多选模式) -->
|
||||||
<div v-if="multiple && selectedEmployees.length > 0" class="selected-list">
|
<div v-if="multiple && selectedEmployees.length > 0" class="selected-list">
|
||||||
<div class="selected-list-title">已选员工 ({{ selectedEmployees.length }})</div>
|
<div class="selected-list-title">已选员工 ({{ selectedEmployees.length }})</div>
|
||||||
<el-tag
|
<el-tag v-for="employee in selectedEmployees" :key="employee[keyField]" closable
|
||||||
v-for="employee in selectedEmployees"
|
@close="removeSelectedEmployee(employee)" class="selected-tag">
|
||||||
:key="employee[keyField]"
|
|
||||||
closable
|
|
||||||
@close="removeSelectedEmployee(employee)"
|
|
||||||
class="selected-tag"
|
|
||||||
>
|
|
||||||
{{ employee.name }} ({{ employee.dept }})
|
{{ employee.name }} ({{ employee.dept }})
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table
|
<el-table v-loading="loading" :data="employeeList" style="width: 100%" height="400px" @row-click="handleRowClick"
|
||||||
v-loading="loading"
|
:row-class-name="rowClassName">
|
||||||
:data="employeeList"
|
|
||||||
style="width: 100%"
|
|
||||||
height="400px"
|
|
||||||
@row-click="handleRowClick"
|
|
||||||
:row-class-name="rowClassName"
|
|
||||||
>
|
|
||||||
<el-table-column label="部门" align="center" prop="dept" />
|
<el-table-column label="部门" align="center" prop="dept" />
|
||||||
<el-table-column label="姓名" align="center" prop="name" />
|
<el-table-column label="姓名" align="center" prop="name" />
|
||||||
<el-table-column label="岗位工种" align="center" prop="jobType" />
|
<el-table-column label="岗位工种" align="center" prop="jobType" />
|
||||||
@@ -61,13 +33,8 @@
|
|||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button @click="open = false">取消</el-button>
|
<el-button @click="cancelSelection">取消</el-button>
|
||||||
<el-button
|
<el-button v-if="multiple" type="primary" @click="confirmSelection" :disabled="selectedEmployees.length === 0">
|
||||||
v-if="multiple"
|
|
||||||
type="primary"
|
|
||||||
@click="confirmSelection"
|
|
||||||
:disabled="selectedEmployees.length === 0"
|
|
||||||
>
|
|
||||||
确认选择 ({{ selectedEmployees.length }})
|
确认选择 ({{ selectedEmployees.length }})
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -138,7 +105,9 @@ export default {
|
|||||||
},
|
},
|
||||||
// 处理后的员工列表,包含禁用状态
|
// 处理后的员工列表,包含禁用状态
|
||||||
employeeList() {
|
employeeList() {
|
||||||
return this.rawEmployeeList.map(employee => ({
|
return this.rawEmployeeList.filter(employee => {
|
||||||
|
return employee.name?.includes(this.searchQuery) || employee.dept?.includes(this.searchQuery)
|
||||||
|
}).map(employee => ({
|
||||||
...employee,
|
...employee,
|
||||||
disabled: this.disabledIdList.includes(employee.infoId.toString())
|
disabled: this.disabledIdList.includes(employee.infoId.toString())
|
||||||
}))
|
}))
|
||||||
@@ -180,12 +149,13 @@ export default {
|
|||||||
const params = {
|
const params = {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 9999,
|
pageSize: 9999,
|
||||||
name: this.searchQuery || undefined,
|
// name: this.searchQuery || undefined,
|
||||||
dept: this.searchQuery || undefined
|
// dept: this.searchQuery || undefined
|
||||||
}
|
}
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
listEmployeeInfo(params).then(response => {
|
listEmployeeInfo(params).then(response => {
|
||||||
this.rawEmployeeList = response.rows
|
// 前端筛选员工列表,根据姓名或部门
|
||||||
|
this.rawEmployeeList = response.rows;
|
||||||
this.loading = false
|
this.loading = false
|
||||||
resolve()
|
resolve()
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
@@ -241,6 +211,24 @@ export default {
|
|||||||
this.open = false
|
this.open = false
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cancelSelection() {
|
||||||
|
if (this.multiple) {
|
||||||
|
if (this.value) {
|
||||||
|
// 多选模式:根据逗号分隔的字符串查找已选员工
|
||||||
|
this.findSelectedEmployees(this.value.split(','))
|
||||||
|
} else {
|
||||||
|
this.selectedEmployees = []
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this.value) {
|
||||||
|
this.findSelectedEmployee(this.value)
|
||||||
|
} else {
|
||||||
|
this.selectedEmployee = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.open = false
|
||||||
|
},
|
||||||
|
|
||||||
// 移除已选员工
|
// 移除已选员工
|
||||||
removeSelectedEmployee(employee) {
|
removeSelectedEmployee(employee) {
|
||||||
const index = this.selectedEmployees.findIndex(item => item[this.keyField] === employee[this.keyField])
|
const index = this.selectedEmployees.findIndex(item => item[this.keyField] === employee[this.keyField])
|
||||||
|
|||||||
@@ -91,23 +91,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 中间:流程箭头(汇聚) -->
|
|
||||||
<div class="flow-middle">
|
|
||||||
<div class="merge-arrow-container">
|
|
||||||
<svg width="120" height="100%" viewBox="0 0 120 400" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<!-- 多条线汇聚到一点 -->
|
|
||||||
<line v-for="(item, index) in sourceCoils" :key="index" :x1="0" :y1="50 + index * 80" :x2="100" :y2="200"
|
|
||||||
stroke="#0066cc" stroke-width="2" stroke-dasharray="5,5" />
|
|
||||||
<!-- 箭头 -->
|
|
||||||
<polygon points="100,200 110,195 110,205" fill="#0066cc" />
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div class="flow-label">
|
|
||||||
<i class="el-icon-d-arrow-right"></i>
|
|
||||||
<span>合并</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 右侧:目标卷信息 -->
|
<!-- 右侧:目标卷信息 -->
|
||||||
<div class="flow-right">
|
<div class="flow-right">
|
||||||
<div class="flow-section-title">目标卷信息</div>
|
<div class="flow-section-title">目标卷信息</div>
|
||||||
@@ -117,7 +100,7 @@
|
|||||||
<span>新钢卷</span>
|
<span>新钢卷</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="target-coil-body">
|
<div class="target-coil-body">
|
||||||
<el-form size="small" label-width="80px">
|
<el-form size="small" label-width="80px" :model="targetCoil" :rules="rules">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<el-form-item label="卷号" class="form-item-half">
|
<el-form-item label="卷号" class="form-item-half">
|
||||||
<el-input v-model="targetCoil.currentCoilNo" placeholder="输入目标卷号" :disabled="readonly"></el-input>
|
<el-input v-model="targetCoil.currentCoilNo" placeholder="输入目标卷号" :disabled="readonly"></el-input>
|
||||||
@@ -287,6 +270,9 @@ export default {
|
|||||||
coatingType: '',
|
coatingType: '',
|
||||||
actualLength: undefined,
|
actualLength: undefined,
|
||||||
actualWidth: undefined,
|
actualWidth: undefined,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
|
||||||
},
|
},
|
||||||
buttonLoading: false,
|
buttonLoading: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
@@ -587,20 +573,18 @@ export default {
|
|||||||
|
|
||||||
// 删除源卷
|
// 删除源卷
|
||||||
removeSourceCoil(index) {
|
removeSourceCoil(index) {
|
||||||
if (this.sourceCoils.length > 2) {
|
if (this.sourceCoils.length > 1) {
|
||||||
this.sourceCoils.splice(index, 1);
|
this.sourceCoils.splice(index, 1);
|
||||||
} else {
|
|
||||||
this.$message.warning('至少需要2个源卷才能合卷');
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 保存合卷
|
// 保存合卷
|
||||||
async handleSave() {
|
async handleSave() {
|
||||||
// 验证源卷数量
|
// 验证源卷数量
|
||||||
if (this.sourceCoils.length < 2) {
|
// if (this.sourceCoils.length < 2) {
|
||||||
this.$message.error('至少需要2个源卷才能合卷');
|
// this.$message.error('至少需要2个源卷才能合卷');
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 验证源卷信息
|
// 验证源卷信息
|
||||||
for (let i = 0; i < this.sourceCoils.length; i++) {
|
for (let i = 0; i < this.sourceCoils.length; i++) {
|
||||||
@@ -692,7 +676,7 @@ export default {
|
|||||||
length: data.length || null,
|
length: data.length || null,
|
||||||
bomItems: data.bomItemList || [],
|
bomItems: data.bomItemList || [],
|
||||||
nc: true,
|
nc: true,
|
||||||
actionId: pending.actionId // 保存待操作ID,用于后续完成操作
|
actionId: coil?.actionId // 保存待操作ID,用于后续完成操作
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -729,6 +713,7 @@ export default {
|
|||||||
currentCoilNo: item.currentCoilNo || '',
|
currentCoilNo: item.currentCoilNo || '',
|
||||||
priority: 0,
|
priority: 0,
|
||||||
sourceType: 'manual',
|
sourceType: 'manual',
|
||||||
|
completeTime: new Date()
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
await Promise.all(promises1.concat(promises2));
|
await Promise.all(promises1.concat(promises2));
|
||||||
|
|||||||
@@ -380,8 +380,8 @@
|
|||||||
<span class="info-value">{{ parseTime(item.scanTime, '{m}-{d} {h}:{i}') || '—' }}</span>
|
<span class="info-value">{{ parseTime(item.scanTime, '{m}-{d} {h}:{i}') || '—' }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="info-item">
|
<div class="info-item">
|
||||||
<span class="info-label">处理时间:</span>
|
<span class="info-label">完成时间:</span>
|
||||||
<span class="info-value">{{ parseTime(item.processTime, '{m}-{d} {h}:{i}') || '—' }}</span>
|
<span class="info-value">{{ parseTime(item.completeTime, '{m}-{d} {h}:{i}') || '—' }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user