|
|
|
|
@ -32,6 +32,18 @@ |
|
|
|
|
<!-- <el-button type="text" @click="editFn(scope.row)">编辑 </el-button> --> |
|
|
|
|
<!-- <el-button type="text" @click="handleDelete">删除 </el-button> --> |
|
|
|
|
</template> |
|
|
|
|
<template #quota-form="{ type, disabled }"> |
|
|
|
|
<el-input v-model="form.quota" placeholder="请输入 滚振镀金类定额" @input="validateRow"></el-input> |
|
|
|
|
</template> |
|
|
|
|
<template #smallBatQuota-form="{ type, disabled }"> |
|
|
|
|
<el-input v-model="form.smallBatQuota" placeholder="请输入 挂镀金类定额" @input="validateSmallBat"></el-input> |
|
|
|
|
</template> |
|
|
|
|
<template #bigBatQuota-form="{ type, disabled }"> |
|
|
|
|
<el-input v-model="form.bigBatQuota" placeholder="请输入 微孔镀金类定额" @input="validateBigBat"></el-input> |
|
|
|
|
</template> |
|
|
|
|
<template #partQuota-form="{ type, disabled }"> |
|
|
|
|
<el-input v-model="form.partQuota" placeholder="请输入 局部镀定额" @input="validatePart"></el-input> |
|
|
|
|
</template> |
|
|
|
|
<template #produceTsTarget="scope"> </template> |
|
|
|
|
</avue-crud> |
|
|
|
|
<!-- 导入 --> |
|
|
|
|
@ -119,39 +131,47 @@ export default { |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
// { |
|
|
|
|
// label: "工艺能力", |
|
|
|
|
// prop: "processAbilityId", |
|
|
|
|
// type:"select", |
|
|
|
|
// sortable: true, |
|
|
|
|
// filter: true, |
|
|
|
|
// span: 24, |
|
|
|
|
// search: false, |
|
|
|
|
// dicUrl:"/api/blade-desk/BA/craftAbility/findList", |
|
|
|
|
// props:{ |
|
|
|
|
// label:"caName", |
|
|
|
|
// value:"id" |
|
|
|
|
// } |
|
|
|
|
// }, |
|
|
|
|
{ |
|
|
|
|
label: "工艺能力", |
|
|
|
|
prop: "processAbilityId", |
|
|
|
|
type:"select", |
|
|
|
|
label: "滚振镀金类定额", |
|
|
|
|
prop: "quota", |
|
|
|
|
sortable: true, |
|
|
|
|
filter: true, |
|
|
|
|
span: 24, |
|
|
|
|
search: false, |
|
|
|
|
dicUrl:"/api/blade-desk/BA/craftAbility/findList", |
|
|
|
|
props:{ |
|
|
|
|
label:"caName", |
|
|
|
|
value:"id" |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "定额", |
|
|
|
|
prop: "quota", |
|
|
|
|
label: "挂镀金类定额", |
|
|
|
|
prop: "smallBatQuota", |
|
|
|
|
sortable: true, |
|
|
|
|
filter: true, |
|
|
|
|
span: 24, |
|
|
|
|
search: false, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "小批量定额", |
|
|
|
|
prop: "smallBatQuota", |
|
|
|
|
label: "微孔镀金类定额", |
|
|
|
|
prop: "bigBatQuota", |
|
|
|
|
sortable: true, |
|
|
|
|
filter: true, |
|
|
|
|
span: 24, |
|
|
|
|
search: false, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "大批量定额", |
|
|
|
|
prop: "bigBatQuota", |
|
|
|
|
label: "局部镀定额", |
|
|
|
|
prop: "partQuota", |
|
|
|
|
sortable: true, |
|
|
|
|
filter: true, |
|
|
|
|
span: 24, |
|
|
|
|
@ -174,6 +194,50 @@ export default { |
|
|
|
|
handleImport() { |
|
|
|
|
this.isShowImport = true |
|
|
|
|
}, |
|
|
|
|
validateValue(value){ |
|
|
|
|
if (value == null) return ''; |
|
|
|
|
|
|
|
|
|
// 步骤1:移除所有非数字和非小数点的字符 |
|
|
|
|
let filterVal = value.replace(/[^\d.]/g, ''); |
|
|
|
|
|
|
|
|
|
// 步骤2:处理多个小数点的情况(只保留第一个小数点) |
|
|
|
|
filterVal = filterVal.replace(/(\.\d*)\./g, '$1'); |
|
|
|
|
|
|
|
|
|
// 步骤3:处理小数点后最多5位 |
|
|
|
|
filterVal = filterVal.replace(/(\.\d{5})\d+/g, '$1'); |
|
|
|
|
|
|
|
|
|
// 步骤4:处理首位为0的情况 |
|
|
|
|
// 情况1:纯数字且长度>1,首位为0(如0123)→ 保留第一个0,后面的数字正常显示(但禁止多个0开头) |
|
|
|
|
// 情况2:0后面跟小数点(如0.123)→ 允许 |
|
|
|
|
if (filterVal.startsWith('0') && filterVal.length > 1 && !filterVal.startsWith('0.')) { |
|
|
|
|
// 移除开头多余的0(只保留一个0,后面的数字正常显示) |
|
|
|
|
filterVal = filterVal.replace(/^0+/, '0'); |
|
|
|
|
// 若处理后是0且后面有数字(如0123→0123,再处理为0123→改为0) |
|
|
|
|
if (filterVal === '0' && val.length > 1) { |
|
|
|
|
filterVal = '0'; |
|
|
|
|
} else { |
|
|
|
|
// 如0123→改为0,01234→改为0,0.123→不变 |
|
|
|
|
filterVal = filterVal.replace(/^0(?!\.)/, ''); |
|
|
|
|
// 若过滤后为空(如01→过滤后为空),则设为0 |
|
|
|
|
if (!filterVal) { |
|
|
|
|
filterVal = '0'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return filterVal; |
|
|
|
|
}, |
|
|
|
|
validateRow(value){ |
|
|
|
|
this.form.quota = this.validateValue(value) |
|
|
|
|
}, |
|
|
|
|
validateSmallBat(value){ |
|
|
|
|
this.form.smallBatQuota = this.validateValue(value) |
|
|
|
|
}, |
|
|
|
|
validateBigBat(value){ |
|
|
|
|
this.form.bigBatQuota = this.validateValue(value) |
|
|
|
|
}, |
|
|
|
|
validatePart(value){ |
|
|
|
|
this.form.partQuota = this.validateValue(value) |
|
|
|
|
}, |
|
|
|
|
addEdit() { |
|
|
|
|
this.isOpen = true; |
|
|
|
|
}, |
|
|
|
|
|