更新 openhis-ui
This commit is contained in:
191
openhis-ui-vue2-bk/src/components/flow/ElInputTag/index.vue
Normal file
191
openhis-ui-vue2-bk/src/components/flow/ElInputTag/index.vue
Normal file
@@ -0,0 +1,191 @@
|
||||
<template>
|
||||
<div
|
||||
class="el-input-tag input-tag-wrapper"
|
||||
:class="[size ? 'el-input-tag--' + size : '']"
|
||||
@click="focusTagInput">
|
||||
<el-tag
|
||||
v-for="(tag, idx) in innerTags"
|
||||
v-bind="$attrs"
|
||||
:key="tag"
|
||||
:size="size"
|
||||
effect="dark"
|
||||
closable
|
||||
:disable-transitions="false"
|
||||
@close="remove(idx)">
|
||||
{{tag}}
|
||||
</el-tag>
|
||||
<input
|
||||
v-if="!readOnly"
|
||||
class="tag-input"
|
||||
:placeholder="placeholder"
|
||||
@input="inputTag"
|
||||
:value="newTag"
|
||||
@keydown.delete.stop = "removeLastTag"
|
||||
/>
|
||||
<!-- @keydown = "addNew"
|
||||
@blur = "addNew"-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import {StrUtil} from '@/utils/StrUtil'
|
||||
|
||||
export default {
|
||||
name: "ElInputTag",
|
||||
/** 组件传值 */
|
||||
props : {
|
||||
value: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
addTagOnKeys: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: 'small'
|
||||
},
|
||||
placeholder: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
newTag :"",
|
||||
innerTags :[],
|
||||
readOnly :true,
|
||||
}
|
||||
},
|
||||
/** 传值监听 */
|
||||
watch: {
|
||||
value: {
|
||||
handler(newVal) {
|
||||
if (StrUtil.isNotBlank(newVal)) {
|
||||
this.innerTags = newVal.split(',');
|
||||
}else {
|
||||
this.innerTags = [];
|
||||
}
|
||||
},
|
||||
immediate: true, // 立即生效
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
focusTagInput() {
|
||||
if (this.readOnly || !this.$el.querySelector('.tag-input')) {
|
||||
return
|
||||
} else {
|
||||
this.$el.querySelector('.tag-input').focus()
|
||||
}
|
||||
},
|
||||
|
||||
inputTag(ev) {
|
||||
this.newTag = ev.target.value
|
||||
},
|
||||
|
||||
addNew(e) {
|
||||
if (e && (!this.addTagOnKeys.includes(e.keyCode)) && (e.type !== 'blur')) {
|
||||
return
|
||||
}
|
||||
if (e) {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
}
|
||||
let addSuccess = false
|
||||
if (this.newTag.includes(',')) {
|
||||
this.newTag.split(',').forEach(item => {
|
||||
if (this.addTag(item.trim())) {
|
||||
addSuccess = true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (this.addTag(this.newTag.trim())) {
|
||||
addSuccess = true
|
||||
}
|
||||
}
|
||||
if (addSuccess) {
|
||||
this.tagChange()
|
||||
this.newTag = ''
|
||||
}
|
||||
},
|
||||
|
||||
addTag(tag) {
|
||||
tag = tag.trim()
|
||||
if (tag && !this.innerTags.includes(tag)) {
|
||||
this.innerTags.push(tag)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
|
||||
remove(index) {
|
||||
this.innerTags.splice(index, 1)
|
||||
this.tagChange();
|
||||
},
|
||||
|
||||
removeLastTag() {
|
||||
if (this.newTag) {
|
||||
return
|
||||
}
|
||||
this.innerTags.pop()
|
||||
this.tagChange()
|
||||
},
|
||||
|
||||
tagChange() {
|
||||
this.$emit('input', this.innerTags)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-form-item.is-error .el-input-tag {
|
||||
border-color: #f56c6c;
|
||||
}
|
||||
.input-tag-wrapper {
|
||||
position: relative;
|
||||
font-size: 14px;
|
||||
background-color: #fff;
|
||||
background-image: none;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #dcdfe6;
|
||||
box-sizing: border-box;
|
||||
color: #606266;
|
||||
display: inline-block;
|
||||
outline: none;
|
||||
padding: 0 10px 0 5px;
|
||||
transition: border-color .2s cubic-bezier(.645,.045,.355,1);
|
||||
width: 100%;
|
||||
}
|
||||
.el-tag {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.tag-input {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
font-size: inherit;
|
||||
outline: none;
|
||||
padding-left: 0;
|
||||
width: 100px;
|
||||
}
|
||||
.el-input-tag {
|
||||
min-height: 42px;
|
||||
}
|
||||
.el-input-tag--small {
|
||||
min-height: 32px;
|
||||
line-height: 32px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.el-input-tag--default {
|
||||
min-height: 34px;
|
||||
line-height: 34px;
|
||||
}
|
||||
|
||||
.el-input-tag--large {
|
||||
min-height: 36px;
|
||||
line-height: 36px;
|
||||
}
|
||||
|
||||
</style>
|
||||
133
openhis-ui-vue2-bk/src/components/flow/Expression/index.vue
Normal file
133
openhis-ui-vue2-bk/src/components/flow/Expression/index.vue
Normal file
@@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入表达式名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="expressionList" @current-change="handleSingleExpSelect">
|
||||
<el-table-column width="55" align="center" >
|
||||
<template slot-scope="scope">
|
||||
<!-- 可以手动的修改label的值,从而控制选择哪一项 -->
|
||||
<el-radio v-model="radioSelected" :label="scope.row.id">{{''}}</el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="名称" align="center" prop="name" />
|
||||
<el-table-column label="表达式内容" align="center" prop="expression" />
|
||||
<el-table-column label="表达式类型" align="center" prop="dataType" >
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.exp_data_type" :value="scope.row.dataType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page-sizes="[5,10]"
|
||||
layout="prev, pager, next"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listExpression } from "@/api/flowable/expression";
|
||||
import {StrUtil} from "@/utils/StrUtil";
|
||||
|
||||
export default {
|
||||
name: "Expression",
|
||||
dicts: ['sys_common_status','exp_data_type'],
|
||||
// 接受父组件的值
|
||||
props: {
|
||||
// 回显数据传值
|
||||
selectValues: {
|
||||
type: Number | String,
|
||||
default: null,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 流程达式表格数据
|
||||
expressionList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
expression: null,
|
||||
status: null,
|
||||
},
|
||||
radioSelected: null // 单选框传值
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
selectValues: {
|
||||
handler(newVal) {
|
||||
if (StrUtil.isNotBlank(newVal)) {
|
||||
this.radioSelected = newVal
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询流程达式列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listExpression(this.queryParams).then(response => {
|
||||
this.expressionList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 单选框选中数据
|
||||
handleSingleExpSelect(selection) {
|
||||
this.radioSelected = selection.id;//点击当前行时,radio同样有选中效果
|
||||
this.$emit('handleSingleExpSelect',selection);
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
187
openhis-ui-vue2-bk/src/components/flow/Role/index.vue
Normal file
187
openhis-ui-vue2-bk/src/components/flow/Role/index.vue
Normal file
@@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
|
||||
<el-form-item label="角色名称" prop="roleName">
|
||||
<el-input
|
||||
v-model="queryParams.roleName"
|
||||
placeholder="请输入角色名称"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-show="checkType === 'multiple'" ref="dataTable" v-loading="loading" :data="roleList" @selection-change="handleMultipleRoleSelect">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column label="角色编号" prop="roleId" width="120" />
|
||||
<el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" />
|
||||
<el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="150" />
|
||||
<el-table-column label="显示顺序" prop="roleSort" width="100" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-table v-show="checkType === 'single'" v-loading="loading" :data="roleList" @current-change="handleSingleRoleSelect">
|
||||
<el-table-column width="55" align="center" >
|
||||
<template slot-scope="scope">
|
||||
<!-- 可以手动的修改label的值,从而控制选择哪一项 -->
|
||||
<el-radio v-model="radioSelected" :label="scope.row.roleId">{{''}}</el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="角色编号" prop="roleId" width="120" />
|
||||
<el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" />
|
||||
<el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="150" />
|
||||
<el-table-column label="显示顺序" prop="roleSort" width="100" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page-sizes="[5,10]"
|
||||
layout="prev, pager, next"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listRole} from "@/api/system/role";
|
||||
import {StrUtil} from "@/utils/StrUtil";
|
||||
|
||||
export default {
|
||||
name: "FlowRole",
|
||||
dicts: ['sys_normal_disable'],
|
||||
// 接受父组件的值
|
||||
props: {
|
||||
// 回显数据传值
|
||||
selectValues: {
|
||||
type: Number | String | Array,
|
||||
default: null,
|
||||
required: false
|
||||
},
|
||||
checkType: {
|
||||
type: String,
|
||||
default: 'multiple',
|
||||
required: false
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 角色表格数据
|
||||
roleList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 5,
|
||||
roleName: undefined,
|
||||
roleKey: undefined,
|
||||
status: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
radioSelected: 0, // 单选框传值
|
||||
selectRoleList: [] // 回显数据传值
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
selectValues: {
|
||||
handler(newVal) {
|
||||
if (StrUtil.isNotBlank(newVal)) {
|
||||
if (newVal instanceof Number || newVal instanceof String) {
|
||||
this.radioSelected = newVal
|
||||
} else {
|
||||
this.selectRoleList = newVal;
|
||||
}
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
roleList: {
|
||||
handler(newVal) {
|
||||
if (StrUtil.isNotBlank(newVal) && this.selectRoleList.length > 0) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dataTable.clearSelection();
|
||||
this.selectRoleList?.split(',').forEach(key => {
|
||||
this.$refs.dataTable.toggleRowSelection(newVal.find(
|
||||
item => key == item.roleId
|
||||
), true)
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询角色列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listRole(this.queryParams).then(response => {
|
||||
this.roleList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleMultipleRoleSelect(selection) {
|
||||
const idList = selection.map(item => item.roleId);
|
||||
const nameList = selection.map(item => item.roleName);
|
||||
this.$emit('handleRoleSelect', idList.join(','), nameList.join(','));
|
||||
},
|
||||
// 单选框选中数据
|
||||
handleSingleRoleSelect(selection) {
|
||||
this.radioSelected = selection.roleId;
|
||||
const roleName = selection.roleName;
|
||||
this.$emit('handleRoleSelect', this.radioSelected.toString(), roleName);
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.handleQuery();
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
/*隐藏radio展示的label及本身自带的样式*/
|
||||
/*.el-radio__label{*/
|
||||
/* display:none;*/
|
||||
/*}*/
|
||||
</style>
|
||||
257
openhis-ui-vue2-bk/src/components/flow/User/index.vue
Normal file
257
openhis-ui-vue2-bk/src/components/flow/User/index.vue
Normal file
@@ -0,0 +1,257 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-row :gutter="20">
|
||||
<!--部门数据-->
|
||||
<el-col :span="6" :xs="24">
|
||||
<div class="head-container">
|
||||
<el-input
|
||||
v-model="deptName"
|
||||
placeholder="请输入部门名称"
|
||||
clearable
|
||||
size="small"
|
||||
prefix-icon="el-icon-search"
|
||||
style="margin-bottom: 20px"
|
||||
/>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-tree
|
||||
:data="deptOptions"
|
||||
:props="defaultProps"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="filterNode"
|
||||
ref="tree"
|
||||
node-key="id"
|
||||
default-expand-all
|
||||
highlight-current
|
||||
@node-click="handleNodeClick"
|
||||
/>
|
||||
</div>
|
||||
</el-col>
|
||||
<!--用户数据-->
|
||||
<el-col :span="18" :xs="24">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="用户名称" prop="userName">
|
||||
<el-input
|
||||
v-model="queryParams.userName"
|
||||
placeholder="请输入用户名称"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table v-show="checkType === 'multiple'" ref="dataTable" v-loading="loading" :row-key="getRowKey" :data="userList" @selection-change="handleMultipleUserSelect">
|
||||
<el-table-column type="selection" :reserve-selection="true" width="50" align="center" />
|
||||
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
|
||||
<el-table-column label="登录账号" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户姓名" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
|
||||
</el-table>
|
||||
<el-table v-show="checkType === 'single'" v-loading="loading" :data="userList" @current-change="handleSingleUserSelect">
|
||||
<el-table-column width="55" align="center" >
|
||||
<template slot-scope="scope">
|
||||
<el-radio v-model="radioSelected" :label="scope.row.userId">{{''}}</el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
|
||||
<el-table-column label="登录账号" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户姓名" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page-sizes="[5,10]"
|
||||
layout="prev, pager, next"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listUser, deptTreeSelect } from "@/api/system/user";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
import {StrUtil} from '@/utils/StrUtil'
|
||||
|
||||
export default {
|
||||
name: "FlowUser",
|
||||
dicts: ['sys_normal_disable', 'sys_user_sex'],
|
||||
components: { Treeselect },
|
||||
// 接受父组件的值
|
||||
props: {
|
||||
// 回显数据传值
|
||||
selectValues: {
|
||||
type: Number | String | Array,
|
||||
default: null,
|
||||
required: false
|
||||
},
|
||||
// 表格类型
|
||||
checkType: {
|
||||
type: String,
|
||||
default: 'multiple',
|
||||
required: true
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 用户表格数据
|
||||
userList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 部门树选项
|
||||
deptOptions: undefined,
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 部门名称
|
||||
deptName: undefined,
|
||||
// 表单参数
|
||||
form: {},
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "label"
|
||||
},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 5,
|
||||
userName: undefined,
|
||||
phonenumber: undefined,
|
||||
status: undefined,
|
||||
deptId: undefined
|
||||
},
|
||||
// 列信息
|
||||
columns: [
|
||||
{ key: 0, label: `用户编号`, visible: true },
|
||||
{ key: 1, label: `用户名称`, visible: true },
|
||||
{ key: 2, label: `用户昵称`, visible: true },
|
||||
{ key: 3, label: `部门`, visible: true },
|
||||
{ key: 4, label: `手机号码`, visible: true },
|
||||
{ key: 5, label: `状态`, visible: true },
|
||||
{ key: 6, label: `创建时间`, visible: true }
|
||||
],
|
||||
radioSelected: 0, // 单选框传值
|
||||
selectUserList: [] // 回显数据传值
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
// 根据名称筛选部门树
|
||||
deptName(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
},
|
||||
selectValues: {
|
||||
handler(newVal) {
|
||||
if (StrUtil.isNotBlank(newVal)) {
|
||||
if (newVal instanceof Number) {
|
||||
this.radioSelected = newVal
|
||||
} else {
|
||||
this.selectUserList = newVal;
|
||||
}
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
userList: {
|
||||
handler(newVal) {
|
||||
debugger
|
||||
if (StrUtil.isNotBlank(newVal) && this.selectUserList.length > 0) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dataTable.clearSelection();
|
||||
this.selectUserList?.split(',').forEach(key => {
|
||||
this.$refs.dataTable.toggleRowSelection(newVal.find(
|
||||
item => key == item.userId
|
||||
), true)
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getDeptTree();
|
||||
},
|
||||
methods: {
|
||||
/** 查询用户列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listUser(this.queryParams).then(response => {
|
||||
this.userList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
},
|
||||
/** 查询部门下拉树结构 */
|
||||
getDeptTree() {
|
||||
deptTreeSelect().then(response => {
|
||||
this.deptOptions = response.data;
|
||||
});
|
||||
},
|
||||
// 保存选中的数据id,row-key就是要指定一个key标识这一行的数据
|
||||
getRowKey (row) {
|
||||
return row.id
|
||||
},
|
||||
// 筛选节点
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
},
|
||||
// 节点单击事件
|
||||
handleNodeClick(data) {
|
||||
this.queryParams.deptId = data.id;
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleMultipleUserSelect(selection) {
|
||||
this.$emit('handleUserSelect', selection);
|
||||
},
|
||||
// 单选框选中数据
|
||||
handleSingleUserSelect(selection) {
|
||||
this.radioSelected = selection.userId;//点击当前行时,radio同样有选中效果
|
||||
this.$emit('handleUserSelect', selection);
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.dateRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams.deptId = undefined;
|
||||
this.$refs.tree.setCurrentKey(null);
|
||||
this.handleQuery();
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
/*隐藏radio展示的label及本身自带的样式*/
|
||||
/*.el-radio__label{*/
|
||||
/* display:none;*/
|
||||
/*}*/
|
||||
</style>
|
||||
Reference in New Issue
Block a user