feat(钢卷管理): 添加钢卷号前缀生成功能并优化样式

添加钢卷号前缀生成工具函数及测试用例
在合并、拆分、分条和录入页面使用自动生成的钢卷号前缀
调整EmployeeSelector组件默认触发器的样式
移除typing.vue中未使用的变更历史代码块
添加钢卷号长度校验规则
This commit is contained in:
砂糖
2026-03-03 14:15:45 +08:00
parent d927aa8647
commit 07e982b736
7 changed files with 162 additions and 46 deletions

View File

@@ -226,6 +226,7 @@ import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect
import RawMaterialSelector from "@/components/KLPService/RawMaterialSelect";
import ProductSelector from "@/components/KLPService/ProductSelect";
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import { generateCoilNoPrefix } from "@/utils/coil/coilNo";
export default {
name: 'MergeCoil',
@@ -238,12 +239,14 @@ export default {
},
dicts: ['coil_quality_status'],
data() {
const currentCoilNoPrefix = generateCoilNoPrefix()
return {
currentCoilNoPrefix,
// 源卷列表
sourceCoils: [],
// 目标卷信息
targetCoil: {
currentCoilNo: '',
currentCoilNo: currentCoilNoPrefix,
team: '',
materialType: null,
itemType: null,

View File

@@ -198,6 +198,7 @@ import ProductSelect from "@/components/KLPService/ProductSelect";
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
import { generateCoilNoPrefix } from "@/utils/coil/coilNo";
export default {
name: 'StepSplit',
@@ -223,7 +224,9 @@ export default {
},
dicts: ['coil_quality_status'],
data() {
const currentCoilNoPrefix = generateCoilNoPrefix()
return {
currentCoilNoPrefix,
// 待分条钢卷基础信息
coilInfo: {},
loading: false,
@@ -231,7 +234,7 @@ export default {
splitForm: {
coilId: '', // 分条钢卷ID编辑时赋值
enterCoilNo: '',
currentCoilNo: '',
currentCoilNo: currentCoilNoPrefix,
supplierCoilNo: '',
warehouseId: '',
actualWarehouseId: '',
@@ -262,6 +265,16 @@ export default {
rules: {
currentCoilNo: [
{ required: true, message: "当前钢卷号不能为空", trigger: "blur" },
{
// 当前钢卷号必须大于等于10位
validator: (rule, value, callback) => {
if (value.length < 10) {
callback(new Error('当前钢卷号必须大于等于10位'));
} else {
callback();
}
}, trigger: 'blur'
},
// 仅在新增的时候校验
{
validator: (rule, value, callback) => {
@@ -400,7 +413,7 @@ export default {
this.splitForm = {
coilId: undefined,
enterCoilNo: '',
currentCoilNo: '',
currentCoilNo: this.currentCoilNoPrefix,
supplierCoilNo: '',
warehouseId: '',
actualWarehouseId: '',

View File

@@ -225,6 +225,7 @@ import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
import ProductSelect from "@/components/KLPService/ProductSelect";
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import { generateCoilNoPrefix } from "@/utils/coil/coilNo";
export default {
name: 'SplitCoil',
@@ -236,7 +237,9 @@ export default {
},
dicts: ['coil_quality_status'],
data() {
const currentCoilNoPrefix = generateCoilNoPrefix()
return {
currentCoilNoPrefix,
// 母卷信息
motherCoil: {
coilId: null,
@@ -259,7 +262,7 @@ export default {
// 子卷列表
splitList: [
{
currentCoilNo: '',
currentCoilNo: currentCoilNoPrefix,
team: '',
materialType: null,
itemType: null,
@@ -439,7 +442,7 @@ export default {
// 添加子卷
addSplitItem() {
this.splitList.push({
currentCoilNo: '',
currentCoilNo: this.currentCoilNoPrefix,
team: '',
materialType: null,
itemType: null,

View File

@@ -215,45 +215,6 @@
</el-card>
</div>
</div>
<!-- 变更历史占满整行 -->
<!-- <div class="history-section">
<el-card class="history-card">
<div slot="header" class="card-header">
<span><i class="el-icon-time"></i> 变更历史</span>
<el-button type="text" size="mini" @click="loadHistory" :loading="historyLoading">
<i class="el-icon-refresh"></i> 刷新
</el-button>
</div>
<el-timeline v-if="historySteps.length > 0">
<el-timeline-item v-for="(step, index) in historySteps" :key="index"
:timestamp="`步骤 ${step.display_step || step.step}`" placement="top"
:type="step.operation === '新增' ? 'success' : 'primary'">
<div class="history-item">
<div class="history-title">{{ step.operation || step.action }}</div>
<div class="history-detail" v-if="step.operator">
<span class="detail-label">操作人</span>
<span>{{ step.operator }}</span>
</div>
<div class="history-detail" v-if="step.old_current_coil_no">
<span class="detail-label">原钢卷号</span>
<span>{{ step.old_current_coil_no }}</span>
</div>
<div class="history-detail" v-if="step.new_current_coil_no">
<span class="detail-label">新钢卷号</span>
<span>{{ step.new_current_coil_no }}</span>
</div>
</div>
</el-timeline-item>
</el-timeline>
<div v-else class="empty-history">
<i class="el-icon-document"></i>
<p>暂无变更历史</p>
</div>
</el-card>
</div> -->
</div>
</template>
@@ -268,6 +229,7 @@ import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
import ProductSelect from "@/components/KLPService/ProductSelect";
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import { generateCoilNoPrefix } from "@/utils/coil/coilNo";
export default {
name: 'TypingCoil',
@@ -324,6 +286,16 @@ export default {
rules: {
currentCoilNo: [
{ required: true, message: '请输入当前钢卷号', trigger: 'blur' },
{
// 当前钢卷号必须大于等于10位
validator: (rule, value, callback) => {
if (value.length < 10) {
callback(new Error('当前钢卷号必须大于等于10位'));
} else {
callback();
}
}, trigger: 'blur'
},
// 仅在新增的时候校验
{
validator: (rule, value, callback) => {
@@ -524,6 +496,9 @@ export default {
}
}
const currentCoilNoPrefix = generateCoilNoPrefix()
this.$set(this.updateForm, 'currentCoilNo', currentCoilNoPrefix)
if (actionId) {
this.actionId = actionId;
}