|
@@ -539,7 +539,6 @@
|
|
|
{
|
|
{
|
|
|
label: '名称',
|
|
label: '名称',
|
|
|
prop: 'categoryName',
|
|
prop: 'categoryName',
|
|
|
- width: '150',
|
|
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
width: 120,
|
|
width: 120,
|
|
|
showOverflowTooltip: true
|
|
showOverflowTooltip: true
|
|
@@ -831,6 +830,7 @@
|
|
|
handleSampleSubmit() {
|
|
handleSampleSubmit() {
|
|
|
// this.$refs.ruleForm.validate((valid) => {
|
|
// this.$refs.ruleForm.validate((valid) => {
|
|
|
// if (valid) {
|
|
// if (valid) {
|
|
|
|
|
+ if (!this.validateSampleSubmit()) return;
|
|
|
let params = {
|
|
let params = {
|
|
|
conditionType: this.form.conditionType,
|
|
conditionType: this.form.conditionType,
|
|
|
quantity: this.form.quantity,
|
|
quantity: this.form.quantity,
|
|
@@ -845,13 +845,54 @@
|
|
|
// });
|
|
// });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ validateSampleSubmit() {
|
|
|
|
|
+ const isValidPositiveNumber = (value) => {
|
|
|
|
|
+ if (value === '' || value === null || value === undefined) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ const number = Number(value);
|
|
|
|
|
+ return Number.isFinite(number) && number > 0;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ if (!this.form.conditionType) {
|
|
|
|
|
+ this.$message.warning('请选择请样类型');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (this.form.conditionType == 2) {
|
|
|
|
|
+ if (!isValidPositiveNumber(this.form.quantity)) {
|
|
|
|
|
+ this.$message.warning('请输入大于0的请样数量');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.form.unit) {
|
|
|
|
|
+ this.$message.warning('请选择请样单位');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!isValidPositiveNumber(this.form.portion)) {
|
|
|
|
|
+ this.$message.warning('请输入大于0的请样条数');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!isValidPositiveNumber(this.form.portion)) {
|
|
|
|
|
+ this.$message.warning('请输入大于0的请样数量');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.form.packingUnit) {
|
|
|
|
|
+ this.$message.warning('请选择请样单位');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
async sampleFn(data, specifications) {
|
|
async sampleFn(data, specifications) {
|
|
|
this.sampleList = [];
|
|
this.sampleList = [];
|
|
|
if (!this.selection || this.selection.length == 0) {
|
|
if (!this.selection || this.selection.length == 0) {
|
|
|
this.$message.warning('请先选择来源清单!');
|
|
this.$message.warning('请先选择来源清单!');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- const quantity = data.quantity || 1;
|
|
|
|
|
|
|
+ const quantity = Number(data.quantity || 1);
|
|
|
const unit = data.sampleUnit;
|
|
const unit = data.sampleUnit;
|
|
|
const sampleCount = Number(data.portion);
|
|
const sampleCount = Number(data.portion);
|
|
|
try {
|
|
try {
|