fix: 修复选择候选人员数据为空导致页面加载失败问题

rf
tony 2023-03-07 20:11:33 +08:00
parent 6361cef3ed
commit bd47623b68
3 changed files with 24 additions and 15 deletions

View File

@ -25,7 +25,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table v-loading="loading" :data="expressionList" @current-change="handleSingleExpSelect"> <el-table v-loading="loading" :data="expressionList" row-key="id" @current-change="handleSingleExpSelect">
<el-table-column width="55" align="center" > <el-table-column width="55" align="center" >
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 可以手动的修改label的值从而控制选择哪一项 --> <!-- 可以手动的修改label的值从而控制选择哪一项 -->
@ -51,6 +51,7 @@
<script> <script>
import { listExpression } from "@/api/system/expression"; import { listExpression } from "@/api/system/expression";
import {StrUtil} from "@/utils/StrUtil";
export default { export default {
name: "Expression", name: "Expression",
@ -98,7 +99,9 @@ export default {
watch: { watch: {
selectValues: { selectValues: {
handler(newVal) { handler(newVal) {
this.radioSelected = newVal if (StrUtil.isNotBlank(newVal)) {
this.radioSelected = newVal
}
}, },
immediate: true, immediate: true,
} }

View File

@ -60,6 +60,7 @@
<script> <script>
import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus, deptTreeSelect } from "@/api/system/role"; import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus, deptTreeSelect } from "@/api/system/role";
import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu"; import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu";
import {StrUtil} from "@/utils/StrUtil";
export default { export default {
name: "FlowRole", name: "FlowRole",
@ -109,23 +110,25 @@ export default {
// //
form: {}, form: {},
radioSelected: null, // radioSelected: null, //
selectRoleList: null // selectRoleList: [] //
}; };
}, },
watch: { watch: {
selectValues: { selectValues: {
handler(newVal) { handler(newVal) {
if (newVal instanceof Number || newVal instanceof String) { if (StrUtil.isNotBlank(newVal)) {
this.radioSelected = newVal if (newVal instanceof Number || newVal instanceof String) {
} else { this.radioSelected = newVal
this.selectRoleList = newVal; } else {
this.selectRoleList = newVal;
}
} }
}, },
immediate: true immediate: true
}, },
roleList: { roleList: {
handler(newVal) { handler(newVal) {
if (newVal && this.selectRoleList) { if (StrUtil.isNotBlank(newVal) && this.selectRoleList.length > 0) {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.dataTable.clearSelection(); this.$refs.dataTable.clearSelection();
this.selectRoleList?.split(',').forEach(key => { this.selectRoleList?.split(',').forEach(key => {

View File

@ -90,6 +90,7 @@
import { listUser, deptTreeSelect } from "@/api/system/user"; import { listUser, deptTreeSelect } from "@/api/system/user";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {StrUtil} from "@/utils/StrUtil";
export default { export default {
name: "FlowUser", name: "FlowUser",
@ -125,7 +126,7 @@ export default {
// //
total: 0, total: 0,
// //
userList: null, userList: [],
// //
title: "", title: "",
// //
@ -160,7 +161,7 @@ export default {
{ key: 6, label: `创建时间`, visible: true } { key: 6, label: `创建时间`, visible: true }
], ],
radioSelected: null, // radioSelected: null, //
selectUserList: null // selectUserList: [] //
}; };
}, },
watch: { watch: {
@ -170,17 +171,19 @@ export default {
}, },
selectValues: { selectValues: {
handler(newVal) { handler(newVal) {
if (newVal instanceof Number) { if (StrUtil.isNotBlank(newVal)) {
this.radioSelected = newVal if (newVal instanceof Number) {
} else { this.radioSelected = newVal
this.selectUserList = newVal; } else {
this.selectUserList = newVal;
}
} }
}, },
immediate: true immediate: true
}, },
userList: { userList: {
handler(newVal) { handler(newVal) {
if (newVal && this.selectUserList) { if (StrUtil.isNotBlank(newVal) && this.selectUserList.length > 0) {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.dataTable.clearSelection(); this.$refs.dataTable.clearSelection();
this.selectUserList?.split(',').forEach(key => { this.selectUserList?.split(',').forEach(key => {