Commit c03a6fe9 by 潘际乾

check的提取

parent fea88307
......@@ -56,7 +56,7 @@ export default {
tableColumns() {
const columnArr = []
const lines = this.columns;
const etyReg = /\"(\w*\s?\w*)\"/
const etyReg = /\"(\w*(\s?|\/?)\w*)\"/
const obj = {}
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
......
......@@ -8,8 +8,8 @@ export default{
computed:{
declareParams(){
return {
version:this.version,
trnName:this.trnName,
version: this.version,
trnName: this.root ? this.root.trnName : this.trnName,
}
}
}
......
......@@ -46,10 +46,17 @@ export default {
}
const triggerType = that.getTriggerType(key)
if(that.checkRules[key]){
for (let j = 0; j < that.checkRules[key].length; j++) {
const check = that.checkRules[key][j];
if (Array.isArray(that.checkRules[key])) {
for (let j = 0; j < that.checkRules[key].length; j++) {
const check = that.checkRules[key][j];
rule.push({
validator: check.bind(that),
trigger: triggerType
})
}
} else {
rule.push({
validator: check.bind(that),
validator: that.checkRules[key].bind(that),
trigger: triggerType
})
}
......
......@@ -216,7 +216,20 @@ export default class Utils {
Utils.copyValueFromVO(this.model, data)
callback()
}
})
}
static reflectCheck(key){
return async function(rule, value, callback){
//调用具体的check
const res = await this.exeuteCheck(key)
if (res.respCode == SUCCESS){
if (Object.hasOwnProperty.call(res.fieldErrors, key)) {
callback(res.fieldErrors[key])
} else {
callback();
}
}
}
}
}
\ No newline at end of file
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