- 添加
+ 添加
删除
@@ -271,6 +271,14 @@ export default {
callback()
}
}
+ const validatePass2 = (rule, value, callback) => {
+ console.log(this.supplierId)
+ if (this.personalForm.productCode === undefined || this.personalForm.productCode === null || this.personalForm.productCode === '') {
+ callback(new Error('请选择抽检商品'))
+ } else {
+ callback()
+ }
+ }
return {
// 控制报检部门是否可以编辑
IsInspectionDeptId: false,
@@ -351,7 +359,7 @@ export default {
countryId: 1,
repositoryId: 438,
regionId: 2,
- isVat: 1,
+ isRecheck: 1,
sourceType: '4'
},
// 采购申请单规则数据
@@ -366,7 +374,7 @@ export default {
{ required: true, validator: validatePass, trigger: 'focus' }
],
productCode: [
- { required: true, validator: validatePass, trigger: 'focus' }
+ { required: true, validator: validatePass2, trigger: 'change' }
],
checkDate: [
{ required: true, message: '请选择检验日期', trigger: 'change' }
@@ -391,12 +399,30 @@ export default {
],
sampleQuantity: [
{ required: true, message: '请输入抽样数量', trigger: 'blur' }
+ ],
+ passQuantity: [
+ { required: true, message: '请输入合格数量', trigger: 'blur' }
]
},
// 采购申请单明细数据
list2: [],
// 采购申请单明细列表规则
validRules: {
+ chectResult: [
+ { required: true, message: '请输入检验结果', trigger: 'blur' }
+ ],
+ checkQuantity: [
+ { required: true, message: '请输入检验结果', trigger: 'blur' }
+ ],
+ passQuantity: [
+ { required: true, message: '请输入合格数量', trigger: 'blur' }
+ ],
+ checkPersonname: [
+ { required: true, message: '请选择检验人员', trigger: 'blur' }
+ ],
+ checkDeptId: [
+ { required: true, message: '请选择检验部门', trigger: 'blur' }
+ ]
}
}
},
@@ -404,6 +430,18 @@ export default {
this.getTypes()
},
methods: {
+
+ handleAdd() {
+ if (this.personalForm.sampleQuantity === '' || this.personalForm.sampleQuantity === null || this.personalForm.sampleQuantity === undefined) {
+ this.$notify.error({
+ title: '错误',
+ message: '抽样数量为空',
+ offset: 100
+ })
+ return false
+ }
+ this.$refs.editable.insert(-1)
+ },
chooseType(val) {
if (this.personalForm.sourceType === '1') {
this.IsProduceManagerId = false
@@ -702,29 +740,55 @@ export default {
const parms = JSON.stringify(Data)
this.$refs.personalForm.validate((valid) => {
if (valid) {
- addqualitycheck(parms, parms2, this.personalForm).then(res => {
- console.log(res)
- if (res.data.ret === 200) {
- this.$notify({
- title: '成功',
- message: '保存成功',
- type: 'success',
- offset: 100
+ this.$refs.personalForm2.validate((valid) => {
+ if (valid) {
+ this.$refs.personalForm3.validate((valid) => {
+ if (valid) {
+ this.$refs.editable.validate().then(valid => {
+ addqualitycheck(parms, parms2, this.personalForm).then(res => {
+ console.log(res)
+ if (res.data.ret === 200) {
+ this.$notify({
+ title: '成功',
+ message: '保存成功',
+ type: 'success',
+ offset: 100
+ })
+ this.restAllForm()
+ this.$refs.editable.clear()
+ this.$refs.personalForm.clearValidate()
+ this.$refs.personalForm.resetFields()
+ this.$refs.personalForm2.clearValidate()
+ this.$refs.personalForm2.resetFields()
+ this.$refs.personalForm3.clearValidate()
+ this.$refs.personalForm3.resetFields()
+ } else {
+ this.$notify.error({
+ title: '错误',
+ message: res.data.msg,
+ offset: 100
+ })
+ }
+ })
+ }).catch(valid => {
+ console.log('error submit!!')
+ })
+ } else {
+ this.$notify.error({
+ title: '错误',
+ message: '信息未填完整',
+ offset: 100
+ })
+ return false
+ }
})
- this.restAllForm()
- this.$refs.editable.clear()
- this.$refs.personalForm.clearValidate()
- this.$refs.personalForm.resetFields()
- this.$refs.personalForm2.clearValidate()
- this.$refs.personalForm2.resetFields()
- this.$refs.personalForm3.clearValidate()
- this.$refs.personalForm3.resetFields()
} else {
this.$notify.error({
title: '错误',
- message: res.data.msg,
+ message: '信息未填完整',
offset: 100
})
+ return false
}
})
} else {