refactor(wms): 优化合卷逻辑和员工选择组件
- 移除合卷流程中的箭头图示和最小源卷数量限制 - 修改处理时间显示为完成时间并更新相关字段 - 优化员工选择组件的前端筛选和取消操作处理
This commit is contained in:
@@ -1,73 +1,40 @@
|
||||
<template>
|
||||
<div class="employee-selector">
|
||||
<!-- 触发器 -->
|
||||
<div
|
||||
class="trigger"
|
||||
@click="toggleDialog"
|
||||
>
|
||||
<div class="trigger" @click="toggleDialog">
|
||||
<slot name="trigger">
|
||||
<div class="default-trigger">
|
||||
{{ displayText }}
|
||||
</div>
|
||||
</slot>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 选择对话框 -->
|
||||
<el-dialog
|
||||
:title="title"
|
||||
:visible.sync="open"
|
||||
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-dialog :title="title" :visible.sync="open" 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>
|
||||
|
||||
|
||||
<!-- 已选员工列表(多选模式) -->
|
||||
<div v-if="multiple && selectedEmployees.length > 0" class="selected-list">
|
||||
<div class="selected-list-title">已选员工 ({{ selectedEmployees.length }})</div>
|
||||
<el-tag
|
||||
v-for="employee in selectedEmployees"
|
||||
:key="employee[keyField]"
|
||||
closable
|
||||
@close="removeSelectedEmployee(employee)"
|
||||
class="selected-tag"
|
||||
>
|
||||
<el-tag v-for="employee in selectedEmployees" :key="employee[keyField]" closable
|
||||
@close="removeSelectedEmployee(employee)" class="selected-tag">
|
||||
{{ employee.name }} ({{ employee.dept }})
|
||||
</el-tag>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="employeeList"
|
||||
style="width: 100%"
|
||||
height="400px"
|
||||
@row-click="handleRowClick"
|
||||
:row-class-name="rowClassName"
|
||||
>
|
||||
|
||||
<el-table v-loading="loading" :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="name" />
|
||||
<el-table-column label="岗位工种" align="center" prop="jobType" />
|
||||
<el-table-column label="联系电话" align="center" prop="phone" />
|
||||
</el-table>
|
||||
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="open = false">取消</el-button>
|
||||
<el-button
|
||||
v-if="multiple"
|
||||
type="primary"
|
||||
@click="confirmSelection"
|
||||
:disabled="selectedEmployees.length === 0"
|
||||
>
|
||||
<el-button @click="cancelSelection">取消</el-button>
|
||||
<el-button v-if="multiple" type="primary" @click="confirmSelection" :disabled="selectedEmployees.length === 0">
|
||||
确认选择 ({{ selectedEmployees.length }})
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -138,7 +105,9 @@ export default {
|
||||
},
|
||||
// 处理后的员工列表,包含禁用状态
|
||||
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,
|
||||
disabled: this.disabledIdList.includes(employee.infoId.toString())
|
||||
}))
|
||||
@@ -173,19 +142,20 @@ export default {
|
||||
}
|
||||
this.open = !this.open
|
||||
},
|
||||
|
||||
|
||||
// 获取员工列表
|
||||
getEmployeeList() {
|
||||
this.loading = true
|
||||
const params = {
|
||||
pageNum: 1,
|
||||
pageSize: 9999,
|
||||
name: this.searchQuery || undefined,
|
||||
dept: this.searchQuery || undefined
|
||||
// name: this.searchQuery || undefined,
|
||||
// dept: this.searchQuery || undefined
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
listEmployeeInfo(params).then(response => {
|
||||
this.rawEmployeeList = response.rows
|
||||
// 前端筛选员工列表,根据姓名或部门
|
||||
this.rawEmployeeList = response.rows;
|
||||
this.loading = false
|
||||
resolve()
|
||||
}).catch(() => {
|
||||
@@ -194,19 +164,19 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
// 搜索员工
|
||||
handleSearch() {
|
||||
this.getEmployeeList()
|
||||
},
|
||||
|
||||
|
||||
// 选择员工
|
||||
handleRowClick(row) {
|
||||
// 检查员工是否被禁用
|
||||
if (this.isDisabled(row)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if (this.multiple) {
|
||||
// 多选模式:添加或移除员工
|
||||
const index = this.selectedEmployees.findIndex(item => item[this.keyField] === row[this.keyField])
|
||||
@@ -223,7 +193,7 @@ export default {
|
||||
this.open = false
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 检查员工是否被禁用
|
||||
isDisabled(row) {
|
||||
const isDisabled = this.disabledIdList.includes(row[this.keyField].toString())
|
||||
@@ -232,7 +202,7 @@ export default {
|
||||
}
|
||||
return isDisabled
|
||||
},
|
||||
|
||||
|
||||
// 确认选择(多选模式)
|
||||
confirmSelection() {
|
||||
const selectedIds = this.selectedEmployees.map(item => item[this.keyField])
|
||||
@@ -240,7 +210,25 @@ export default {
|
||||
this.$emit('change', this.selectedEmployees)
|
||||
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) {
|
||||
const index = this.selectedEmployees.findIndex(item => item[this.keyField] === employee[this.keyField])
|
||||
@@ -248,7 +236,7 @@ export default {
|
||||
this.selectedEmployees.splice(index, 1)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 表格行样式
|
||||
rowClassName({ row }) {
|
||||
// if (this.isDisabled(row)) {
|
||||
@@ -259,7 +247,7 @@ export default {
|
||||
}
|
||||
return ''
|
||||
},
|
||||
|
||||
|
||||
// 检查员工是否已选
|
||||
isSelected(row) {
|
||||
if (this.multiple) {
|
||||
@@ -268,7 +256,7 @@ export default {
|
||||
return this.selectedEmployee[this.keyField] === row[this.keyField]
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 根据value查找选中的员工(单选)
|
||||
findSelectedEmployee(value) {
|
||||
if (this.employeeList.length > 0) {
|
||||
@@ -286,7 +274,7 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 根据value查找选中的员工(多选)
|
||||
findSelectedEmployees(values) {
|
||||
if (this.employeeList.length > 0) {
|
||||
|
||||
@@ -91,23 +91,6 @@
|
||||
</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-section-title">目标卷信息</div>
|
||||
@@ -117,7 +100,7 @@
|
||||
<span>新钢卷</span>
|
||||
</div>
|
||||
<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">
|
||||
<el-form-item label="卷号" class="form-item-half">
|
||||
<el-input v-model="targetCoil.currentCoilNo" placeholder="输入目标卷号" :disabled="readonly"></el-input>
|
||||
@@ -287,6 +270,9 @@ export default {
|
||||
coatingType: '',
|
||||
actualLength: undefined,
|
||||
actualWidth: undefined,
|
||||
},
|
||||
rules: {
|
||||
|
||||
},
|
||||
buttonLoading: false,
|
||||
loading: false,
|
||||
@@ -587,20 +573,18 @@ export default {
|
||||
|
||||
// 删除源卷
|
||||
removeSourceCoil(index) {
|
||||
if (this.sourceCoils.length > 2) {
|
||||
if (this.sourceCoils.length > 1) {
|
||||
this.sourceCoils.splice(index, 1);
|
||||
} else {
|
||||
this.$message.warning('至少需要2个源卷才能合卷');
|
||||
}
|
||||
},
|
||||
|
||||
// 保存合卷
|
||||
async handleSave() {
|
||||
// 验证源卷数量
|
||||
if (this.sourceCoils.length < 2) {
|
||||
this.$message.error('至少需要2个源卷才能合卷');
|
||||
return;
|
||||
}
|
||||
// if (this.sourceCoils.length < 2) {
|
||||
// this.$message.error('至少需要2个源卷才能合卷');
|
||||
// return;
|
||||
// }
|
||||
|
||||
// 验证源卷信息
|
||||
for (let i = 0; i < this.sourceCoils.length; i++) {
|
||||
@@ -692,7 +676,7 @@ export default {
|
||||
length: data.length || null,
|
||||
bomItems: data.bomItemList || [],
|
||||
nc: true,
|
||||
actionId: pending.actionId // 保存待操作ID,用于后续完成操作
|
||||
actionId: coil?.actionId // 保存待操作ID,用于后续完成操作
|
||||
});
|
||||
},
|
||||
|
||||
@@ -729,6 +713,7 @@ export default {
|
||||
currentCoilNo: item.currentCoilNo || '',
|
||||
priority: 0,
|
||||
sourceType: 'manual',
|
||||
completeTime: new Date()
|
||||
})
|
||||
});
|
||||
await Promise.all(promises1.concat(promises2));
|
||||
|
||||
@@ -380,8 +380,8 @@
|
||||
<span class="info-value">{{ parseTime(item.scanTime, '{m}-{d} {h}:{i}') || '—' }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">处理时间:</span>
|
||||
<span class="info-value">{{ parseTime(item.processTime, '{m}-{d} {h}:{i}') || '—' }}</span>
|
||||
<span class="info-label">完成时间:</span>
|
||||
<span class="info-value">{{ parseTime(item.completeTime, '{m}-{d} {h}:{i}') || '—' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user