Commit c03a6fe9 by 潘际乾

check的提取

parent fea88307
...@@ -56,7 +56,7 @@ export default { ...@@ -56,7 +56,7 @@ export default {
tableColumns() { tableColumns() {
const columnArr = [] const columnArr = []
const lines = this.columns; const lines = this.columns;
const etyReg = /\"(\w*\s?\w*)\"/ const etyReg = /\"(\w*(\s?|\/?)\w*)\"/
const obj = {} const obj = {}
for (let i = 0; i < lines.length; i++) { for (let i = 0; i < lines.length; i++) {
const line = lines[i]; const line = lines[i];
......
...@@ -8,8 +8,8 @@ export default{ ...@@ -8,8 +8,8 @@ export default{
computed:{ computed:{
declareParams(){ declareParams(){
return { return {
version:this.version, version: this.version,
trnName:this.trnName, trnName: this.root ? this.root.trnName : this.trnName,
} }
} }
} }
......
...@@ -46,10 +46,17 @@ export default { ...@@ -46,10 +46,17 @@ export default {
} }
const triggerType = that.getTriggerType(key) const triggerType = that.getTriggerType(key)
if(that.checkRules[key]){ if(that.checkRules[key]){
for (let j = 0; j < that.checkRules[key].length; j++) { if (Array.isArray(that.checkRules[key])) {
const check = that.checkRules[key][j]; 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({ rule.push({
validator: check.bind(that), validator: that.checkRules[key].bind(that),
trigger: triggerType trigger: triggerType
}) })
} }
......
...@@ -216,7 +216,20 @@ export default class Utils { ...@@ -216,7 +216,20 @@ export default class Utils {
Utils.copyValueFromVO(this.model, data) Utils.copyValueFromVO(this.model, data)
callback() 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