Commit 0280b26d authored by zhangyichen's avatar zhangyichen

物料档案提交

parent d5cd9062
...@@ -114,7 +114,7 @@ service.interceptors.response.use(res => { ...@@ -114,7 +114,7 @@ service.interceptors.response.use(res => {
type: 'error', type: 'error',
duration: 5 * 1000 duration: 5 * 1000
}) })
return Promise.reject('error') return Promise.reject(res.data)
} else if (code !== 'E004') { } else if (code !== 'E004') {
if (res.config.url.indexOf('downLoadSignaturesSample') > -1 || res.config.url.indexOf('downLoadSignatures') > -1) { if (res.config.url.indexOf('downLoadSignaturesSample') > -1 || res.config.url.indexOf('downLoadSignatures') > -1) {
return res return res
......
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
</el-row> </el-row>
<el-row class="rowMini" v-for="(item1, index1) in item.nltMaterialEditRules" :key="index1"> <el-row class="rowMini" v-for="(item1, index1) in item.nltMaterialEditRules" :key="index1">
<el-col :span="13"> <el-col :span="13">
<el-form-item label="规则设置" :prop="'nltMaterialEditList.' + index + '.nltMaterialEditRules.' + index1 + '.ruleByte'" :rules="[{ required: true, validator: ruleByteRule, trigger: 'blur' }]"> <el-form-item label="规则设置" :prop="'nltMaterialEditList.' + index + '.nltMaterialEditRules.' + index1 + '.ruleByte'" :rules="[{ required: true, validator: (rule, value, callback) => {ruleByteRule(rule, value, callback, item, index1)}, trigger: 'blur' }]">
<el-input :maxlength="2" v-model.trim="item1.ruleByte"/> <el-input :maxlength="2" v-model.trim="item1.ruleByte"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -422,7 +422,6 @@ export default { ...@@ -422,7 +422,6 @@ export default {
item.nltMaterialEditRules = [{ ruleByte: '', rules: '' }] item.nltMaterialEditRules = [{ ruleByte: '', rules: '' }]
} }
}) })
console.log(this.form)
}) })
}, },
// 状态修改方法 // 状态修改方法
...@@ -522,6 +521,46 @@ export default { ...@@ -522,6 +521,46 @@ export default {
this.open = false this.open = false
this.getMatTable() this.getMatTable()
} }
}).catch(err => {
if (err.code === 10001) {
const EditList = []
let ruleList = []
this.form.nltMaterialEditList.forEach((item, index) => {
item.ruleFlag = false
ruleList = []
item.nltMaterialEditRules.forEach((item1, index1) => {
ruleList.push({
ruleByte: item1.ruleByte,
rules: item1.rules
})
})
ruleList.sort(this.compare('ruleByte'))
EditList.push(ruleList)
})
const resEditList = []
let resRuleList = []
err.data.forEach((item, index) => {
item.ruleFlag = false
resRuleList = []
item.nltMaterialEditRules.forEach((item1, index1) => {
resRuleList.push({
ruleByte: item1.ruleByte,
rules: item1.rules
})
})
resRuleList.sort(this.compare('ruleByte'))
resEditList.push(resRuleList)
})
this.$forceUpdate()
for (let x = 0; x < EditList.length; x++) {
for (let y = 0; y < resEditList.length; y++) {
if (JSON.stringify(EditList[x]) === JSON.stringify(resEditList[y])) {
this.form.nltMaterialEditList[x].ruleFlag = true
this.$forceUpdate()
}
}
}
}
}) })
} else { } else {
this.$message.error('该规则已使用') this.$message.error('该规则已使用')
...@@ -576,13 +615,20 @@ export default { ...@@ -576,13 +615,20 @@ export default {
} }
} }
}, },
ruleByteRule(rule, value, callback) { ruleByteRule(rule, value, callback, data, index) {
if (!value) { if (!value) {
callback(new Error('请输入正整数')) callback(new Error('请输入正整数'))
} else { } else {
const reg = /^([1-9]\d*|[0]{1,1})$/ const reg = /^([1-9]\d*|[0]{1,1})$/
if (reg.test(value)) { if (reg.test(value)) {
callback(); for (let i = 0; data.nltMaterialEditRules.length > i; i++) {
if (i !== index) {
if (data.nltMaterialEditRules[i].ruleByte === value) {
callback(new Error('规则位数不能相同'))
}
}
}
callback()
} else { } else {
return callback(new Error('请输入正整数')) return callback(new Error('请输入正整数'))
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment