审核角色配置

This commit is contained in:
cwchen 2025-03-07 14:35:29 +08:00
parent 87712228b5
commit d45d5c9676
2 changed files with 25 additions and 12 deletions

View File

@ -81,7 +81,7 @@ export default {
tableData: [], tableData: [],
isflag: false /**用于设置弹窗 */, isflag: false /**用于设置弹窗 */,
isflag2: false /**用于绑定用户设置弹窗 */, isflag2: false /**用于绑定用户设置弹窗 */,
num: 3 num: 3,
}; };
}, },
components: { components: {

View File

@ -3,13 +3,15 @@
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="false" <el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="false"
:closeOnClickModal="false"> :closeOnClickModal="false">
<div> <div>
<el-form :model="dataForm" ref="ruleForm" label-width="110px"> <el-form :model="dataForm" :rules="rules" ref="ruleForm" label-width="110px">
<el-form-item label="角色名称"> <el-form-item label="角色名称">
<el-input style="width:100%" v-model="dataForm.roleName" :disabled="true" maxlength="20"></el-input> <el-input style="width:100%" v-model="dataForm.roleName" :disabled="true" maxlength="20"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="绑定用户"> <el-form-item label="绑定用户" prop="userId">
<el-select style="width:100%" v-model="dataForm.userId" multiple filterable default-first-option placeholder="请选择用户"> <el-select style="width:100%" v-model="dataForm.userId" multiple filterable default-first-option
<el-option v-for="item in usersList" :key="item.userId" :label="`${item.roleName} - ${item.userName}`" :value="item.userId"> placeholder="请选择用户">
<el-option v-for="item in usersList" :key="item.userId" :label="`${item.roleName} - ${item.userName}`"
:value="item.userId">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -17,7 +19,7 @@
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button class="clear-btn" @click="handleClose" :disabled="disabled">取消</el-button> <el-button class="clear-btn" @click="handleClose" :disabled="disabled">取消</el-button>
<el-button type="primary" class="search-btn" :disabled="disabled" @click="submitForm()">确认</el-button> <el-button type="primary" class="search-btn" :disabled="disabled" @click="submitForm('ruleForm')">确认</el-button>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
@ -38,7 +40,11 @@ export default {
children: 'children', children: 'children',
label: 'name' label: 'name'
}, },
roleTypes: ['WEB角色', 'APP角色'], rules: {
userId: [
{ required: true, message: '至少选择一个用户', trigger: 'change'}
],
},
}; };
}, },
mounted() { mounted() {
@ -61,11 +67,18 @@ export default {
}); });
}, },
/**验证 */ /**验证 */
submitForm() { submitForm(formName) {
let data = JSON.parse(JSON.stringify(this.dataForm)); this.$refs[formName].validate((valid) => {
data.userId = data.userId.join(','); if (valid) {
data.roleId = data.id; let data = JSON.parse(JSON.stringify(this.dataForm));
this.$emit('submit2', data); data.userId = data.userId.join(',');
data.roleId = data.id;
this.$emit('submit2', data);
} else {
console.log('error submit!!');
return false;
}
});
} }
} }
}; };