Skip to content

Commit ab0fad6

Browse files
author
QM303176530
committed
修正角色id为空的bug
1 parent 472305e commit ab0fad6

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

web/src/view/superAdmin/authority/authority.vue

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,7 @@
5757
></el-cascader>
5858
</el-form-item>
5959
<el-form-item label="角色ID" prop="authorityId">
60-
<el-input-number
61-
:disabled="dialogType=='edit'"
62-
step-strictly
63-
:step="1"
64-
autocomplete="off"
65-
v-model="form.authorityId"
66-
></el-input-number>
60+
<el-input :disabled="dialogType=='edit'" autocomplete="off" v-model="form.authorityId"></el-input>
6761
</el-form-item>
6862
<el-form-item label="角色姓名" prop="authorityName">
6963
<el-input autocomplete="off" v-model="form.authorityName"></el-input>
@@ -111,6 +105,13 @@ export default {
111105
name: "Authority",
112106
mixins: [infoList],
113107
data() {
108+
var mustUint = (rule, value, callback) => {
109+
if (!(/^[0-9]*[1-9][0-9]*$/).test(value)){
110+
return callback(new Error("请输入正整数"));
111+
}
112+
return callback()
113+
};
114+
114115
return {
115116
AuthorityOption: [
116117
{
@@ -134,7 +135,8 @@ export default {
134135
},
135136
rules: {
136137
authorityId: [
137-
{ required: true, message: "请输入角色ID", trigger: "blur" }
138+
{ required: true, message: "请输入角色ID", trigger: "blur" },
139+
{validator: mustUint, trigger: 'blur' }
138140
],
139141
authorityName: [
140142
{ required: true, message: "请输入角色名", trigger: "blur" }
@@ -296,6 +298,7 @@ export default {
296298
this.setAuthorityOptions(this.tableData, this.AuthorityOption, false);
297299
},
298300
setAuthorityOptions(AuthorityData, optionsData, disabled) {
301+
this.form.authorityId = String(this.form.authorityId);
299302
AuthorityData &&
300303
AuthorityData.map(item => {
301304
if (item.children && item.children.length) {
@@ -350,9 +353,9 @@ export default {
350353
</script>
351354
<style lang="scss">
352355
.authority {
353-
.el-input-number{
356+
.el-input-number {
354357
margin-left: 15px;
355-
span{
358+
span {
356359
display: none;
357360
}
358361
}

0 commit comments

Comments
 (0)