# Conflicts:
#	src/views/lesson/trainingmanage/index.vue
This commit is contained in:
fan 2019-11-11 13:23:35 +08:00
commit bf7b12cacb
5 changed files with 60 additions and 10 deletions

View File

@ -197,5 +197,6 @@ export default {
companyInfo:'Beijing Jiulian Technology Co., Ltd',
companyTel:'Tel: +86 13289398171',
companyICP:'Copyright ©2018 Beijing Jiulian Technology Co., Ltd ICP: 18028522',
enterPermissionNum:'please input permission number'
enterPermissionNum:'please input number',
enterPermissionNumInt:'number must interger'
};

View File

@ -198,4 +198,5 @@ export default {
companyTel:'联系电话: 13289398171',
companyICP:'Copyright ©2018 北京玖琏科技有限公司 京ICP备18028522号',
enterPermissionNum:'请输入权限数量',
enterPermissionNumInt:'权限数量需为整数'
};

View File

@ -53,7 +53,7 @@
>
<template slot-scope="scope">
<!-- :label="$t('global.permissionList')" -->
<el-form-item key="permissionList" :prop="'permissionList.' + scope.$index + '.chooseNumber'" :required="false" :rules="rules.chooseNumber">
<el-form-item :prop="'permissionList.' + scope.$index + '.chooseNumber'" :required="false" :rules="rules.chooseNumber">
<el-input-number v-model="scope.row.chooseNumber" size="mini" :max="scope.row.remains" :min="0" />
</el-form-item>
</template>
@ -91,11 +91,24 @@ export default {
mapId: '',
numberMessage: '',
PermissionType: '',
isLoading:false
isLoading:false,
errorTip:this.$t('global.enterPermissionNum'),
errorIntTip:this.$t('global.enterPermissionNumInt')
};
},
computed: {
rules() {
const validateChoose = (rule, value, callback)=> {
if (value || value === 0) {
if (Number.isInteger(value)) {
callback();
} else {
callback(new Error(this.errorIntTip));
}
} else {
callback(new Error(this.errorTip));
}
};
const crules = {
startTime: [
{ required: true, message: this.$t('global.enterStartTime'), trigger: 'change' }
@ -107,7 +120,14 @@ export default {
{ required: true, message: this.$t('global.chooseTime'), trigger: 'blur' }
],
chooseNumber:[
{ required: true, message: this.$t('global.enterPermissionNum'), trigger: 'blur'}
{
validator:validateChoose,
trigger: 'blur'
},
{
validator:validateChoose,
trigger: 'change'
}
]
};
return crules;
@ -157,7 +177,10 @@ export default {
this.isLoading = false;
if (res.data && res.data.length > 0) {
this.isDisabled = false;
this.formModel.permissionList = res.data;
let jsonData = JSON.stringify(res.data);
jsonData = jsonData.replace(/\"id\"/g, '"chooseNumber":0,"id"');
jsonData = JSON.parse(jsonData);
this.formModel.permissionList = jsonData;
} else {
this.isDisabled = true;
}

View File

@ -53,7 +53,7 @@
>
<template slot-scope="scope">
<!-- :label="$t('global.permissionList')" -->
<el-form-item key="permissionList" :prop="'permissionList.' + scope.$index + '.chooseNumber'" :required="false" :rules="rules.chooseNumber">
<el-form-item :prop="'permissionList.' + scope.$index + '.chooseNumber'" :required="false" :rules="rules.chooseNumber">
<el-input-number v-model="scope.row.chooseNumber" size="mini" :max="scope.row.remains" :min="0" />
</el-form-item>
</template>
@ -91,11 +91,24 @@ export default {
mapId: '',
numberMessage: '',
PermissionType: '',
isLoading : false
isLoading : false,
errorTip:this.$t('global.enterPermissionNum'),
errorIntTip:this.$t('global.enterPermissionNumInt')
};
},
computed: {
rules() {
const validateChoose = (rule, value, callback)=> {
if (value || value === 0) {
if (Number.isInteger(value)) {
callback();
} else {
callback(new Error(this.errorIntTip));
}
} else {
callback(new Error(this.errorTip));
}
};
const crules = {
startTime: [
{ required: true, message: this.$t('global.enterStartTime'), trigger: 'change' }
@ -107,7 +120,14 @@ export default {
{ required: true, message: this.$t('global.chooseTime'), trigger: 'blur' }
],
chooseNumber:[
{ required: true, message: this.$t('global.enterPermissionNum'), trigger: 'blur'}
{
validator:validateChoose,
trigger: 'blur'
},
{
validator:validateChoose,
trigger: 'change'
}
]
};
return crules;
@ -131,6 +151,7 @@ export default {
}
},
methods: {
setTotalMax() {
let endTime;
let startTime;
@ -157,7 +178,10 @@ export default {
this.isLoading = false;
if (res.data && res.data.length > 0) {
this.isDisabled = false;
this.formModel.permissionList = res.data;
let jsonData = JSON.stringify(res.data);
jsonData = jsonData.replace(/\"id\"/g, '"chooseNumber":0,"id"');
jsonData = JSON.parse(jsonData);
this.formModel.permissionList = jsonData;
} else {
this.isDisabled = true;
}

View File

@ -174,7 +174,8 @@ export default {
this.queryForm.queryObject.prdId.config.data.push({ value: elem.id, label: elem.name });
}
});
this.typeChoose({type:this.queryForm.queryObject.prdId.config.data[0].id});
// debugger;
// this.typeChoose({type:this.queryForm.queryObject.type.config.data[0].value});
}
});