部门管理页面

This commit is contained in:
fengachen
2021-08-23 18:06:32 +08:00
parent 80de3707dc
commit bd9d8ab5d2
9 changed files with 1003 additions and 328 deletions
+21
View File
@@ -126,3 +126,24 @@ export async function checkDictCode(value, id, {err1 = dictCodeErrMsg.err1} = {}
return err1
}
}
const departNameErrMsg = {
err1:'请输入机构/部门名称'
}
/**
* 部门管理部门名称唯一校验
* @param value:要校验的值
* @param id:数据id
* */
export async function checkDepartName(value, id, {err1 = departNameErrMsg.err1} = {}) {
if (value) {
const param = {
confusionCode: 'depart_name',
fieldVal: value,
dataId: id
}
return duplicateCheck(param)
} else {
return err1
}
}
+564 -141
View File
@@ -1,202 +1,625 @@
<template xmlns:background-color="http://www.w3.org/1999/xhtml">
<a-card :bordered="false" style="padding: 12px 0;">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<!-- 搜索区域 -->
<a-form layout="inline" @keyup.enter.native="onSearch">
<a-row :gutter="24">
<a-col :md="6" :sm="12">
<a-form-item label="部门名称" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
<a-input placeholder="请输入部门名称" v-model="queryParam.departName"></a-input>
</a-form-item>
</a-col>
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="12" :sm="24">
<a-button type="primary" @click="onSearch" icon="search" style="margin-left: 21px">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
</a-col>
</span>
<a-row :gutter="10">
<a-col :md="10" :sm="24" >
<a-card :bordered="false" style="padding: 12px 0;">
<!-- 按钮操作区域 -->
<a-row style="margin-left: 14px" class="table-operator">
<a-button @click="handleAdd(1)" type="primary">添加部门</a-button>
<a-button @click="handleAdd(2)" type="primary">添加下级</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('部门信息')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<a-button @click="batchDel" type="danger" icon="delete">批量删除</a-button>
<!--<a-button @click="refresh" type="default" icon="reload" :loading="loading">刷新</a-button>-->
</a-row>
</a-form>
</div>
<!-- 操作按钮区域 -->
<div class="table-operator" style="margin: 5px 0 10px 2px">
<a-button @click="handleAdd" type="primary" icon="plus" v-has="'sys:depart:add'">添加部门</a-button>
<a-button title="删除多条数据" @click="batchDel" type="danger" icon="delete">批量删除</a-button>
</div>
<div style="margin-top: 15px">
<a-table
style="height:500px"
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<span slot="action" class="action-span-cell" slot-scope="text, record">
<a @click="handleEdit(record)" v-has="'sys:depart:edit'">编辑</a>
<a @click="userInfo(record)">用户信息</a>
<a @click="handleDelete(record.id)" v-has="'sys:depart:del'">删除</a>
</span>
</a-table>
</div>
<dept-user-info ref="DeptUserInfo" @ok="modalFormOk"></dept-user-info>
<depart-modal ref="modalForm" @ok="loadTree"></depart-modal>
</a-card>
<div style="background: #fff;padding-left:16px;height: 100%; margin-top: 5px">
<a-alert type="info" :showIcon="true">
<div slot="message">
当前选择<span v-if="this.currSelected.title">{{ getCurrSelectedTitle() }}</span>
<a v-if="this.currSelected.title" style="margin-left: 10px" @click="onClearSelected">取消选择</a>
</div>
</a-alert>
<a-input-search @search="onSearch" style="width:100%;margin-top: 10px" placeholder="请输入部门名称"/>
<!-- -->
<a-col :md="10" :sm="24">
<template>
<a-dropdown :trigger="[this.dropTrigger]" @visibleChange="dropStatus">
<span style="user-select: none">
<a-tree
checkable
multiple
@select="onSelect"
@check="onCheck"
@rightClick="rightHandle"
:selectedKeys="selectedKeys"
:checkedKeys="checkedKeys"
:treeData="departTree"
:checkStrictly="checkStrictly"
:expandedKeys="iExpandedKeys"
:autoExpandParent="autoExpandParent"
@expand="onExpand"/>
</span>
<!--新增右键点击事件,和增加添加和删除功能-->
<a-menu slot="overlay">
<a-menu-item @click="handleAdd(3)" key="1">添加</a-menu-item>
<a-menu-item @click="handleDelete" key="2">删除</a-menu-item>
<a-menu-item @click="closeDrop" key="3">取消</a-menu-item>
</a-menu>
</a-dropdown>
</template>
</a-col>
</div>
</a-card>
<!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
<div class="drawer-bootom-button">
<a-dropdown :trigger="['click']" placement="topCenter">
<a-menu slot="overlay">
<!--<a-menu-item key="1" @click="switchCheckStrictly(1)">父子关联</a-menu-item>-->
<!--<a-menu-item key="2" @click="switchCheckStrictly(2)">取消关联</a-menu-item>-->
<a-menu-item key="3" @click="checkALL">全部勾选</a-menu-item>
<a-menu-item key="4" @click="cancelCheckALL">取消全选</a-menu-item>
<a-menu-item key="5" @click="expandAll">展开所有</a-menu-item>
<a-menu-item key="6" @click="closeAll">合并所有</a-menu-item>
</a-menu>
<a-button>
树操作 <a-icon type="up" />
</a-button>
</a-dropdown>
</div>
<!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
</a-col>
<a-col :md="14" :sm="24" style="background: #fff;padding: 24px;">
<a-tabs defaultActiveKey="1" @change="callback">
<a-tab-pane tab="基本信息" key="1" >
<a-card :bordered="false" v-if="selectedKeys.length>0">
<a-form :form="form">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="机构名称">
<a-input placeholder="请输入机构/部门名称" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator="['departName', validatorRules.departName ]"/>
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="上级部门">
<a-tree-select
style="width:100%"
:dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
:treeData="treeData"
:disabled="disable"
v-model="model.parentId"
placeholder="无">
</a-tree-select>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="机构编码">
<a-input disabled placeholder="请输入机构编码" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator="['orgCode', validatorRules.orgCode ]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="机构类型">
<template v-if="orgCategoryDisabled">
<a-radio-group v-decorator="['orgCategory',validatorRules.orgCategory]" placeholder="请选择机构类型">
<a-radio value="1">
公司
</a-radio>
</a-radio-group>
</template>
<template v-else>
<a-radio-group v-decorator="['orgCategory',validatorRules.orgCategory]" placeholder="请选择机构类型">
<a-radio value="2">
部门
</a-radio>
<a-radio value="3">
岗位
</a-radio>
</a-radio-group>
</template>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="排序">
<a-input-number :min="1" :max="99999" v-decorator="[ 'departOrder',{'initialValue':0}]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="手机号">
<a-input placeholder="请输入手机号" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator="['mobile', validatorRules.mobile]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="地址">
<a-input placeholder="请输入地址" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator="['address', {'initialValue':''}]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="备注">
<a-textarea placeholder="请输入备注" @change="event => event.target.value = event.target.value.trim()" :maxLength="200" v-decorator="['memo', {'initialValue':''}]"/>
</a-form-item>
</a-form>
<div class="anty-form-btn">
<a-button @click="emptyCurrForm" type="default" htmlType="button" icon="sync">重置</a-button>
<a-button @click="submitCurrForm" type="primary" htmlType="button" icon="form">保存</a-button>
</div>
</a-card>
<a-card v-else :bordered="false" style="height:248px !important;">
<a-empty>
<span slot="description"> 请先选择一个部门! </span>
</a-empty>
</a-card>
</a-tab-pane>
<a-tab-pane tab="部门权限" key="2" forceRender>
<depart-auth-modal ref="departAuth"/>
</a-tab-pane>
<a-tab-pane tab="用户信息" key="3">
<Dept-User-Info ref="DeptUserInfo"></Dept-User-Info>
</a-tab-pane>
</a-tabs>
</a-col>
<depart-modal ref="departModal" @ok="loadTree"></depart-modal>
</a-row>
</template>
<script>
import DepartModal from "./modules/DepartModal";
import DeptUserInfo from "./modules/DeptUserInfo";
import pick from "lodash.pick";
import { queryDepartTreeList, searchByKeywords, deleteByDepartId } from "@/api/api";
import { httpAction, deleteAction } from "@/api/manage";
import { JeroListMixin } from "@/mixins/JeroListMixin";
import DepartModal from './modules/DepartModal'
import DeptUserInfo from './modules/DeptUserInfo'
import pick from 'lodash.pick'
import {queryDepartTreeList, searchByKeywords, deleteByDepartId} from '@/api/api'
import {httpAction, deleteAction} from '@/api/manage'
import {JeroListMixin} from '@/mixins/JeroListMixin'
import DepartAuthModal from './modules/DepartAuthModal'
import {checkDepartName} from "@/utils/validateOnly";
// 表头
const columns = [
{
title: '机构名称',
dataIndex: 'departName'
},
{
title: '机构类型',
align: 'center',
dataIndex: 'orgType'
},
{
title: '机构编码',
dataIndex: 'orgCode',
},
{
title: '手机号',
dataIndex: 'mobile'
},
{
title: '传真',
dataIndex: 'fax'
},
{
title: '地址',
dataIndex: 'address'
},
{
title: '排序',
align: 'center',
dataIndex: 'departOrder'
},
{
title: '操作',
align: 'center',
dataIndex: 'action',
scopedSlots: {customRender: 'action'}
}
]
export default {
name: "DepartList",
name: 'DepartList',
mixins: [JeroListMixin],
components: {
DepartAuthModal,
DepartModal,
DeptUserInfo
},
data() {
return {
/* table选中keys*/
selectedRowKeys: [],
iExpandedKeys: [],
loading: false,
dataSource: [],
rightClickSelectedKey: "",
rightClickSelectedOrgCode: "",
autoExpandParent: true,
currFlowId: '',
currFlowName: '',
disable: true,
treeData: [],
visible: false,
departTree: [],
rightClickSelectedKey: '',
rightClickSelectedOrgCode: '',
hiding: true,
model: {},
columns: [{
title: "部门名称",
dataIndex: "departName",
align: "center"
}, {
title: "操作",
dataIndex: "action",
align: "center",
scopedSlots: { customRender: "action" }
}],
dropTrigger: '',
depart: {},
columns: columns,
disableSubmit: false,
checkedKeys: [],
selectedKeys: [],
autoIncr: 1,
currSelected: {},
allTreeKeys:[],
checkStrictly: true,
form: this.$form.createForm(this),
// 当前树选中的部门id
currentDepartSelectedId:"",
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
xs: {span: 24},
sm: {span: 5}
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
xs: {span: 24},
sm: {span: 16}
},
graphDatasource: {
nodes: [],
edges: []
},
validatorRules: {
departName: {rules: [{required: true,validator: this.validateDepartName}]},
orgCode: {rules: [{required: true, message: '请输入机构编码!'}]},
orgCategory: {rules: [{required: true, message: '请输入机构类型!'}]},
mobile: {rules: [{validator: this.validateMobile}]}
},
url: {
delete: "/sys/sysDepart/delete",
edit: "/sys/sysDepart/edit",
deleteBatch: "/sys/sysDepart/deleteBatch"
}
};
delete: '/sys/sysDepart/delete',
edit: '/sys/sysDepart/edit',
deleteBatch: '/sys/sysDepart/deleteBatch',
exportXlsUrl: "sys/sysDepart/exportXls",
importExcelUrl: "sys/sysDepart/importExcel",
},
orgCategoryDisabled:false,
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}
},
methods: {
loadData() {
this.refresh();
},
loadTree() {
let params = this.getQueryParams();//查询条件
queryDepartTreeList(params).then((res) => {
var that = this
that.treeData = []
that.departTree = []
queryDepartTreeList().then((res) => {
if (res.success) {
this.dataSource = res.result;
this.loading = false;
//部门全选后,再添加部门,选中数量增多
this.allTreeKeys = [];
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i]
that.treeData.push(temp)
that.departTree.push(temp)
that.setThisExpandedKeys(temp)
that.getAllKeys(temp);
// console.log(temp.id)
}
this.loading = false
}
});
})
},
setThisExpandedKeys(node) {
if (node.children && node.children.length > 0) {
this.iExpandedKeys.push(node.key)
for (let a = 0; a < node.children.length; a++) {
this.setThisExpandedKeys(node.children[a])
}
}
},
refresh() {
this.loading = true;
this.loadTree();
this.loading = true
this.loadTree()
},
batchDel: function() {
if (this.selectedRowKeys.length <= 0) {
this.$message.warning("请选择一条记录!");
// 右键操作方法
rightHandle(node) {
this.dropTrigger = 'contextmenu'
console.log(node.node.eventKey)
this.rightClickSelectedKey = node.node.eventKey
this.rightClickSelectedOrgCode = node.node.dataRef.orgCode
},
onExpand(expandedKeys) {
console.log('onExpand', expandedKeys)
// if not set autoExpandParent to false, if children expanded, parent can not collapse.
// or, you can remove all expanded children keys.
this.iExpandedKeys = expandedKeys
this.autoExpandParent = false
},
backFlowList() {
this.$router.back(-1)
},
// 右键点击下拉框改变事件
dropStatus(visible) {
if (visible == false) {
this.dropTrigger = ''
}
},
// 右键店家下拉关闭下拉框
closeDrop() {
this.dropTrigger = ''
},
addRootNode() {
this.$refs.nodeModal.add(this.currFlowId, '')
},
batchDel: function () {
console.log(this.checkedKeys)
if (this.checkedKeys.length <= 0) {
this.$message.warning('请选择一条记录!')
} else {
let ids = "";
for (let a = 0; a < this.selectedRowKeys.length; a++) {
ids += this.selectedRowKeys[a] + ",";
var ids = ''
for (var a = 0; a < this.checkedKeys.length; a++) {
ids += this.checkedKeys[a] + ','
}
let that = this;
var that = this
this.$confirm({
title: "确认删除",
content: "确定要删除所选中的 " + this.selectedRowKeys.length + " 条数据,以及子节点数据吗?",
onOk: function() {
deleteAction(that.url.deleteBatch, { ids: ids }).then((res) => {
title: '确认删除',
content: '确定要删除所选中的 ' + this.checkedKeys.length + ' 条数据,以及子节点数据吗?',
onOk: function () {
deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => {
if (res.success) {
that.$message.success(res.message);
that.loadTree();
that.onClearSelected();
that.$message.success(res.message)
that.loadTree()
that.onClearSelected()
} else {
that.$message.warning(res.message);
that.$message.warning(res.message)
}
});
})
}
});
})
}
},
onSearch() {
let that = this;
if (this.queryParam) {
searchByKeywords({ keyWord: this.queryParam.departName}).then((res) => {
onSearch(value) {
let that = this
if (value) {
searchByKeywords({keyWord: value}).then((res) => {
if (res.success) {
this.dataSource = res.result;
this.loading = false;
that.departTree = []
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i]
that.departTree.push(temp)
}
} else {
that.$message.warning(res.message);
that.$message.warning(res.message)
}
});
})
} else {
this.loadTree()
that.loadTree()
}
},
onClearSelected() {
this.selectedRowKeys = [];
this.form.resetFields();
this.selectedKeys = [];
},
// handleAdd() {
// this.$refs.departModal.add();
// this.$refs.departModal.title = "新增";
// },
userInfo(record) {
console.log("===", record);
this.$refs.DeptUserInfo.initUserInfo(record.id);
nodeModalOk() {
this.loadTree()
},
nodeModalClose() {
},
hide() {
console.log(111)
this.visible = false
},
onCheck(checkedKeys, info) {
console.log('onCheck', checkedKeys, info)
this.hiding = false
//this.checkedKeys = checkedKeys.checked
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
if(this.checkStrictly){
this.checkedKeys = checkedKeys.checked;
}else{
this.checkedKeys = checkedKeys
}
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
},
onSelect(selectedKeys, e) {
console.log('selected', selectedKeys, e)
this.hiding = false
let record = e.node.dataRef
console.log('onSelect-record', record)
this.currSelected = Object.assign({}, record)
this.model = this.currSelected
this.selectedKeys = [record.key]
this.model.parentId = record.parentId
this.setValuesToForm(record)
this.$refs.departAuth.show(record.id);
// 传用户信息参数
this.$refs.DeptUserInfo.open(record)
},
// 部门名称判断重复
validateDepartName(rule, value, callback){
checkDepartName(value,this.currentDepartSelectedId).then(res => {
if(res.success){
callback()
}else {
callback(res.code === 500 ? '机构/部门已经存在': res)
}
})
},
// 触发onSelect事件时,为部门树右侧的form表单赋值
setValuesToForm(record) {
// 记录当前选择的部门id 作为判重参数条件
this.currentDepartSelectedId = record.id
if(record.orgCategory == '1'){
this.orgCategoryDisabled = true;
}else{
this.orgCategoryDisabled = false;
}
this.$nextTick(() => {
this.form.getFieldDecorator('fax', {initialValue: ''})
this.form.setFieldsValue(pick(record, 'departName','orgCategory', 'orgCode', 'departOrder', 'mobile', 'fax', 'address', 'memo'))
})
},
getCurrSelectedTitle() {
return !this.currSelected.title ? '' : this.currSelected.title
},
onClearSelected() {
this.hiding = true
this.checkedKeys = []
this.currSelected = {}
this.form.resetFields()
this.selectedKeys = []
this.$refs.departAuth.departId = ''
},
handleNodeTypeChange(val) {
this.currSelected.nodeType = val
},
notifyTriggerTypeChange(value) {
this.currSelected.notifyTriggerType = value
},
receiptTriggerTypeChange(value) {
this.currSelected.receiptTriggerType = value
},
submitCurrForm() {
this.form.validateFields((err, values) => {
if (!err) {
if (!this.currSelected.id) {
this.$message.warning('请点击选择要修改部门!')
return
}
let formData = Object.assign(this.currSelected, values)
console.log('Received values of form: ', formData)
httpAction(this.url.edit, formData, 'put').then((res) => {
if (res.success) {
this.$message.success('保存成功!')
this.loadTree()
} else {
this.$message.error(res.message)
}
})
}
})
},
emptyCurrForm() {
this.form.resetFields()
},
nodeSettingFormSubmit() {
this.form.validateFields((err, values) => {
if (!err) {
console.log('Received values of form: ', values)
}
})
},
openSelect() {
this.$refs.sysDirectiveModal.show()
},
handleAdd(num) {
if (num == 1) {
this.$refs.departModal.add()
this.$refs.departModal.title = '新增'
} else if (num == 2) {
let key = this.currSelected.key
if (!key) {
this.$message.warning('请先点击选中上级部门!')
return false
}
this.$refs.departModal.add(this.selectedKeys)
this.$refs.departModal.title = '新增'
} else {
this.$refs.departModal.add(this.rightClickSelectedKey)
this.$refs.departModal.title = '新增'
}
},
handleDelete() {
let that = this;
var that = this
this.$confirm({
title: "确认删除",
content: "确定要删除此部门以及子节点数据吗?",
onOk: function() {
deleteByDepartId({ id: that.rightClickSelectedKey }).then((resp) => {
title: '确认删除',
content: '确定要删除此部门以及子节点数据吗?',
onOk: function () {
deleteByDepartId({id: that.rightClickSelectedKey}).then((resp) => {
if (resp.success) {
//删除成功后,去除已选中中的数据
that.selectedRowKeys.splice(that.selectedRowKeys.findIndex(key => key === that.rightClickSelectedKey), 1);
that.$message.success("删除成功!");
that.loadTree();
that.checkedKeys.splice(that.checkedKeys.findIndex(key => key === that.rightClickSelectedKey), 1);
that.$message.success('删除成功!')
that.loadTree()
//删除后同步清空右侧基本信息内容
let orgCode = that.form.getFieldValue("orgCode");
if (orgCode && orgCode === that.rightClickSelectedOrgCode) {
that.onClearSelected();
let orgCode=that.form.getFieldValue("orgCode");
if(orgCode && orgCode === that.rightClickSelectedOrgCode){
that.onClearSelected()
}
} else {
that.$message.warning("删除失败!");
that.$message.warning('删除失败!')
}
});
})
}
});
})
},
selectDirectiveOk(record) {
console.log('选中指令数据', record)
this.nodeSettingForm.setFieldsValue({directiveCode: record.directiveCode})
this.currSelected.sysCode = record.sysCode
},
getFlowGraphData(node) {
this.graphDatasource.nodes.push({
id: node.id,
text: node.flowNodeName
})
if (node.children.length > 0) {
for (let a = 0; a < node.children.length; a++) {
let temp = node.children[a]
this.graphDatasource.edges.push({
source: node.id,
target: temp.id
})
this.getFlowGraphData(temp)
}
}
},
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
expandAll () {
this.iExpandedKeys = this.allTreeKeys
},
closeAll () {
this.iExpandedKeys = []
},
checkALL () {
this.checkStriccheckStrictlytly = false
this.checkedKeys = this.allTreeKeys
},
cancelCheckALL () {
//this.checkedKeys = this.defaultCheckedKeys
this.checkedKeys = []
},
callback(val){
// tab页切换为基本信息时候 清除表单验证
console.log(this.form)
if(val === '1' && this.form){
}
// 可能后期会切换回显之前的数据
},
// switchCheckStrictly (v) {
// if(v==1){
// this.checkStrictly = false
// }else if(v==2){
// this.checkStrictly = true
// }
// },
getAllKeys(node) {
// console.log('node',node);
this.allTreeKeys.push(node.key)
if (node.children && node.children.length > 0) {
for (let a = 0; a < node.children.length; a++) {
this.getAllKeys(node.children[a])
}
}
}
}
};
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
},
created() {
this.currFlowId = this.$route.params.id
this.currFlowName = this.$route.params.name
// this.loadTree()
},
}
</script>
<style scoped>
.ant-card-body .table-operator {
@@ -0,0 +1,192 @@
<template>
<a-card :bordered="false">
<template v-if="this.departId">
<a-spin :spinning="loading">
<a-form>
<a-form-item label='所拥有的权限'>
<a-tree
checkable
@check="onCheck"
:checkedKeys="checkedKeys"
:treeData="treeData"
@expand="onExpand"
@select="onTreeNodeSelect"
:selectedKeys="selectedKeys"
:expandedKeys="expandedKeysss"
:checkStrictly="checkStrictly"
style="height:500px;overflow: auto;">
<span slot="hasDatarule" slot-scope="{slotTitle,ruleFlag}">
{{ slotTitle }}
<a-icon v-if="ruleFlag" type="align-left" style="margin-left:5px;color: red;"></a-icon>
</span>
</a-tree>
</a-form-item>
</a-form>
</a-spin>
<div class="anty-form-btn">
<a-dropdown style="float: left" :trigger="['click']" placement="topCenter">
<a-menu slot="overlay">
<!-- 简化Tree逻辑使用默认checkStrictly为false的行为即默认父子关联
<a-menu-item key="1" @click="switchCheckStrictly(1)">父子关联</a-menu-item>
<a-menu-item key="2" @click="switchCheckStrictly(2)">取消关联</a-menu-item>
-->
<a-menu-item key="3" @click="checkALL">全部勾选</a-menu-item>
<a-menu-item key="4" @click="cancelCheckALL">取消全选</a-menu-item>
<a-menu-item key="5" @click="expandAll">展开所有</a-menu-item>
<a-menu-item key="6" @click="closeAll">合并所有</a-menu-item>
</a-menu>
<a-button>
树操作 <a-icon type="up" />
</a-button>
</a-dropdown>
<a-button style="float: right" @click="handleSubmit" type="primary" htmlType="button" icon="form">保存</a-button>
</div>
</template>
<a-card v-else :bordered="false" style="height:200px">
<a-empty>
<span slot="description"> 请先选择一个部门! </span>
</a-empty>
</a-card>
<depart-datarule-modal ref="datarule"/>
</a-card>
</template>
<script>
import {queryTreeListForRole,queryDepartPermission,saveDepartPermission} from '@/api/api'
import DepartDataruleModal from './DepartDataruleModal'
export default {
name: 'DepartAuthModal',
components: { DepartDataruleModal },
data(){
return {
departId:"",
treeData: [],
defaultCheckedKeys:[],
checkedKeys:[],
halfCheckedKeys:[],
expandedKeysss:[],
allTreeKeys:[],
autoExpandParent: true,
checkStrictly: false,
title:"部门权限配置",
visible: false,
loading: false,
selectedKeys:[]
}
},
methods: {
onTreeNodeSelect(id){
if(id && id.length>0){
this.selectedKeys = id
}
this.$refs.datarule.show(this.selectedKeys[0],this.departId)
},
onCheck (checkedKeys, { halfCheckedKeys }) {
// 保存选中的和半选中的,后面保存的时候合并提交
this.checkedKeys = checkedKeys
this.halfCheckedKeys = halfCheckedKeys
},
show(departId){
this.departId=departId
this.loadData();
},
close () {
this.reset()
this.$emit('close');
this.visible = false;
},
onExpand(expandedKeys){
this.expandedKeysss = expandedKeys;
this.autoExpandParent = false
},
reset () {
this.expandedKeysss = []
this.checkedKeys = []
this.defaultCheckedKeys = []
this.loading = false
},
expandAll () {
this.expandedKeysss = this.allTreeKeys
},
closeAll () {
this.expandedKeysss = []
},
checkALL () {
this.checkedKeys = this.allTreeKeys
},
cancelCheckALL () {
this.checkedKeys = []
},
handleCancel () {
this.close()
},
handleSubmit() {
let that = this;
if(!that.departId){
this.$message.warning('请点击选择一个部门!')
}
let checkedKeys = [...that.checkedKeys, ...that.halfCheckedKeys]
const permissionIds = checkedKeys.join(",")
let params = {
departId:that.departId,
permissionIds,
lastpermissionIds:that.defaultCheckedKeys.join(","),
};
that.loading = true;
saveDepartPermission(params).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.loading = false;
that.loadData();
}else {
that.$message.error(res.message);
that.loading = false;
}
})
},
convertTreeListToKeyLeafPairs(treeList, keyLeafPair = []) {
for(const {key, isLeaf, children} of treeList) {
keyLeafPair.push({key, isLeaf})
if(children && children.length > 0) {
this.convertTreeListToKeyLeafPairs(children, keyLeafPair)
}
}
return keyLeafPair;
},
emptyCurrForm() {
this.form.resetFields()
},
loadData(){
this.loading = true;
queryTreeListForRole().then((res) => {
this.treeData = res.result.treeList
this.allTreeKeys = res.result.ids
const keyLeafPairs = this.convertTreeListToKeyLeafPairs(this.treeData)
queryDepartPermission({departId:this.departId}).then((res)=>{
// 过滤出 leaf node 即可,即选中的
// Tree组件中checkStrictly默认为false的时候,选中子节点,父节点会自动设置选中或半选中
// 保存 checkedKeys 以及 halfCheckedKeys 以便于未做任何操作时提交表单数据
const checkedKeys = [...res.result].filter(key => {
const keyLeafPair = keyLeafPairs.filter(item => item.key === key)[0]
return keyLeafPair && keyLeafPair.isLeaf
})
const halfCheckedKeys = [...res.result].filter(key => {
const keyLeafPair = keyLeafPairs.filter(item => item.key === key)[0]
return keyLeafPair && !keyLeafPair.isLeaf
})
this.checkedKeys = [...checkedKeys];
this.halfCheckedKeys = [...halfCheckedKeys]
this.defaultCheckedKeys = [...halfCheckedKeys, ...checkedKeys];
this.expandedKeysss = this.allTreeKeys;
this.loading = false;
})
})
}
},
}
</script>
<style scoped>
</style>
+30 -19
View File
@@ -18,18 +18,18 @@
label="机构名称"
:hidden="false"
hasFeedback>
<a-input id="departName" placeholder="请输入机构/部门名称" v-decorator="['departName', validatorRules.departName ]" />
<a-input id="departName" placeholder="请输入机构/部门名称" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator="['departName', validatorRules.departName ]" />
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :hidden="seen" label="上级部门" hasFeedback>
<a-tree-select
style="width:100%"
:dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
:treeData="departTree"
v-model="model.parentId"
placeholder="请选择上级部门"
:disabled="condition">
</a-tree-select>
</a-form-item>
<!-- <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :hidden="seen" label="上级部门" hasFeedback>-->
<!-- <a-tree-select-->
<!-- style="width:100%"-->
<!-- :dropdownStyle="{maxHeight:'200px',overflow:'auto'}"-->
<!-- :treeData="departTree"-->
<!-- v-model="model.parentId"-->
<!-- placeholder="请选择上级部门"-->
<!-- :disabled="condition">-->
<!-- </a-tree-select>-->
<!-- </a-form-item>-->
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
@@ -56,31 +56,31 @@
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="电话">
<a-input placeholder="请输入电话" v-decorator="['mobile',validatorRules.mobile]" />
<a-input placeholder="请输入电话" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator="['mobile',validatorRules.mobile]" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="传真">
<a-input placeholder="请输入传真" v-decorator="['fax', {}]" />
<a-input placeholder="请输入传真" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator="['fax', {}]" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="地址">
<a-input placeholder="请输入地址" v-decorator="['address', {}]" />
<a-input placeholder="请输入地址" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator="['address', {}]" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="排序">
<a-input-number v-decorator="[ 'departOrder',{'initialValue':0}]" />
<a-input-number :min="1" :max="99999" v-decorator="[ 'departOrder',{'initialValue':0}]" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="备注">
<a-textarea placeholder="请输入备注" v-decorator="['memo', {}]" />
<a-textarea placeholder="请输入备注" @change="event => event.target.value = event.target.value.trim()" :maxLength="200" v-decorator="['memo', {}]" />
</a-form-item>
</a-form>
@@ -93,6 +93,7 @@ import { httpAction } from "@/api/manage";
import { queryIdTree } from "@/api/api";
import pick from "lodash.pick";
import ATextarea from "ant-design-vue/es/input/TextArea";
import {checkDepartName, checkRoleCode} from "@/utils/validateOnly";
export default {
name: "SysDepartModal",
@@ -123,9 +124,10 @@ export default {
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: {
departName: { rules: [{ required: true, message: "请输入机构/部门名称!" }] },
orgCode: { rules: [{ required: true, message: "请输入机构编码!" }] },
mobile: { rules: [{ validator: this.validateMobile }] }
departName: { rules: [{ required: true,validator:this.validateDepartName }],validateTrigger: 'blur' },
orgCode: { rules: [{ required: true, message: "请输入机构编码!" }] ,validateTrigger: 'blur' },
mobile: { rules: [{ validator: this.validateMobile }] ,validateTrigger: 'blur'
}
},
url: {
add: "/sys/sysDepart/add"
@@ -207,6 +209,15 @@ export default {
handleCancel() {
this.close();
},
validateDepartName(rule, value, callback){
checkDepartName(value,this.model.id).then(res => {
if(res.success){
callback()
}else {
callback(res.code === 500 ? '机构/部门已经存在': res)
}
})
},
validateMobile(rule, value, callback) {
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)) {
callback();
+172 -149
View File
@@ -1,13 +1,5 @@
<template>
<a-modal :title="title"
:width="1000"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭"
wrapClassName="ant-modal-cust-warp"
style="top:5%;height: 85%;overflow-y: hidden">
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<!-- 搜索区域 -->
@@ -36,51 +28,56 @@
<div class="table-operator" :md="24" :sm="24" style="margin-top: -15px">
<!--<a-button @click="handleEdit" type="primary" icon="edit" style="margin-top: 16px">用户编辑</a-button>-->
<a-button @click="handleAddUserDepart" type="primary" icon="plus">添加已有用户</a-button>
<a-button @click="handleAdd" type="primary" icon="plus" style="margin-top: 16px">新建用户</a-button>
<a-button @click="handleAdd" type="primary" icon="plus" style="margin-top: 16px">添加用户</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel">
<a-icon type="delete"/>
取消关联
</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作
<a-icon type="down"/>
</a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div class="table-box">
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
selectedRowKeys.length
}}</a>
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
ref="table"
size="middle"
bordered
rowKey="id"
class="j-table-force-nowrap"
:scroll={x:true}
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<span slot="action" slot-scope="text, record">
<span slot="action" slot-scope="text, record" class="action-span-cell">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a @click="handleDeptRole(record)">分配部门角色</a>
<a-divider type="vertical" />
<a @click="handleDetail(record)">用户详情</a>
<a-divider type="vertical" />
<a @click="handleDelete(record.id)">取消关联</a>
<!-- <a-dropdown>-->
<!-- <a class="ant-dropdown-link">-->
<!-- 更多 <a-icon type="down" />-->
<!-- </a>-->
<!-- <a-menu slot="overlay">-->
<!-- <a-menu-item>-->
<!-- <a href="javascript:;" @click="handleDeptRole(record)">分配部门角色</a>-->
<!-- </a-menu-item>-->
<!-- <a-menu-item>-->
<!-- <a href="javascript:;" @click="handleDetail(record)">用户详情</a>-->
<!-- </a-menu-item>-->
<!-- <a-menu-item>-->
<!-- <a-popconfirm title="确定取消与选中部门关联吗?" @confirm="() => handleDelete(record.id)">-->
<!-- <a>取消关联</a>-->
<!-- </a-popconfirm>-->
<!-- </a-menu-item>-->
<!-- </a-menu>-->
<!-- </a-dropdown>-->
<a href="javascript:;" @click="handleDeptRole(record)">分配部门角色</a>
<a href="javascript:;" @click="handleDetail(record)">用户详情</a>
<a href="javascript:;" @click="handleDelete(record.id)">取消关联</a>
</span>
<template slot="text_title" slot-scope="text">
<j-ellipsis :length="20" :value="text"></j-ellipsis>
</template>
</a-table>
</div>
<!-- table区域-end -->
@@ -89,15 +86,17 @@
<user-modal ref="modalForm" @ok="modalFormOk"></user-modal>
<Select-User-Modal ref="selectUserModal" @selectFinished="selectOK"></Select-User-Modal>
<dept-role-user-modal ref="deptRoleUser"></dept-role-user-modal>
</a-modal>
</a-card>
</template>
<script>
import { JeroListMixin } from "@/mixins/JeroListMixin";
import { getAction, postAction, deleteAction } from "@/api/manage";
import SelectUserModal from "./SelectUserModal";
import UserModal from "./UserModal";
import DeptRoleUserModal from "./DeptRoleUserModal";
import {JeroListMixin} from '@/mixins/JeroListMixin'
import {getAction, postAction, deleteAction} from '@/api/manage'
import SelectUserModal from './SelectUserModal'
import UserModal from './UserModal'
import DeptRoleUserModal from './DeptRoleUserModal'
import JEllipsis from "@comp/jero/JEllipsis";
import "@/assets/less/TableExpand.less";
export default {
name: "DeptUserInfo",
@@ -105,66 +104,76 @@ export default {
components: {
DeptRoleUserModal,
SelectUserModal,
UserModal
UserModal,
JEllipsis
},
data() {
return {
title: "操作",
visible: false,
confirmLoading: false,
description: "用户信息",
currentDeptId: "",
description: '用户信息',
currentDeptId: '',
currentDept: {},
// 表头
columns: [{
title: "用户账号",
title: '用户账号',
align: "center",
dataIndex: "username"
}, {
title: "用户名称",
align: "center",
dataIndex: "realname"
}, {
title: "部门",
align: "center",
dataIndex: "orgCode"
}, {
title: "性别",
align: "center",
dataIndex: "sex_dictText"
}, {
title: "电话",
align: "center",
dataIndex: "phone"
}, {
title: "操作",
dataIndex: "action",
scopedSlots: { customRender: "action" },
align: "center",
width: 300
}],
width: 100,
dataIndex: 'username',
scopedSlots: {customRender: 'text_title'},
},
{
title: '用户名称',
align: "center",
dataIndex: 'realname',
width: 100,
scopedSlots: {customRender: 'text_title'},
},
{
title: '部门',
align: "center",
dataIndex: 'orgCode',
width: 120,
scopedSlots: {customRender: 'text_title'},
},
{
title: '性别',
align: "center",
dataIndex: 'sex_dictText',
width: 60,
},
{
title: '电话',
align: "center",
dataIndex: 'phone',
width: 120,
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: {customRender: 'action'},
fixed: 'right',
align: "center",
}],
url: {
list: "/sys/user/departUserList",
edit: "/sys/user/editSysDepartWithUser",
delete: "/sys/user/deleteUserInDepart",
deleteBatch: "/sys/user/deleteUserInDepartBatch"
deleteBatch: "/sys/user/deleteUserInDepartBatch",
}
};
}
},
created() {
},
methods: {
initUserInfo(id) {
this.currentDeptId = id
this.visible = true
this.initData(1);
},
searchReset() {
this.queryParam = {};
this.initData(1);
this.queryParam = {}
this.lastQueryParam = {}
this.loadData(1);
},
initData(arg) {
loadData(arg) {
if (!this.url.list) {
this.$message.error("请设置url.list属性!");
return;
this.$message.error("请设置url.list属性!")
return
}
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
@@ -178,36 +187,43 @@ export default {
this.dataSource = res.result.records;
this.ipagination.total = res.result.total;
}
});
})
},
batchDel: function() {
batchDel: function () {
if (!this.url.deleteBatch) {
this.$message.error("请设置url.deleteBatch属性!");
return;
this.$message.error("请设置url.deleteBatch属性!")
return
}
if (!this.currentDeptId) {
this.$message.error("未选中任何部门,无法取消部门与用户的关联!");
return;
this.$message.error("未选中任何部门,无法取消部门与用户的关联!")
return
}
if (this.selectedRowKeys.length <= 0) {
this.$message.warning("请选择一条记录!");
this.$message.warning('请选择一条记录!');
return;
} else {
let ids = "";
for (let a = 0; a < this.selectedRowKeys.length; a++) {
var ids = "";
for (var a = 0; a < this.selectedRowKeys.length; a++) {
ids += this.selectedRowKeys[a] + ",";
}
let that = this;
var that = this;
console.log(this.currentDeptId);
this.$confirm({
title: "确认取消",
content: "是否取消用户与选中部门的关联?",
onOk: function() {
deleteAction(that.url.deleteBatch, { depId: that.currentDeptId, userIds: ids }).then((res) => {
onOk: function () {
deleteAction(that.url.deleteBatch, {depId: that.currentDeptId, userIds: ids}).then((res) => {
if (res.success) {
that.$message.success("删除用户与选中部门关系成功!");
that.initData();
// 判断当前删除的数据是否是最后一页的全部数据,如果是的话页码减一
if (that.ipagination.current > 1 && (that.ipagination.current === Math.ceil(that.ipagination.total / that.ipagination.pageSize)) &&
that.selectedRowKeys.length === that.dataSource.length
) {
that.ipagination.current -= 1
}
that.loadData();
that.onClearSelected();
} else {
that.$message.warning(res.message);
@@ -217,80 +233,86 @@ export default {
});
}
},
handleDelete: function(id) {
handleDelete: function (id) {
if (!this.url.delete) {
this.$message.error("请设置url.delete属性!");
return;
this.$message.error("请设置url.delete属性!")
return
}
if (!this.currentDeptId) {
this.$message.error("未选中任何部门,无法取消部门与用户的关联!");
return;
this.$message.error("未选中任何部门,无法取消部门与用户的关联!")
return
}
let that = this;
var that = this;
this.$confirm({
title: "确认删除",
content: "是否删除选中数据?",
title: "确认取消",
content: "是否取消用户与选中部门的关联?",
onOk: function () {
deleteAction(that.url.delete, { depId: that.currentDeptId, userId: id }).then((res) => {
deleteAction(that.url.delete, {depId: that.currentDeptId, userId: id}).then((res) => {
if (res.success) {
that.$message.success("删除用户与选中部门关系成功!");
if (that.selectedRowKeys.length > 0) {
for (let i = 0; i < that.selectedRowKeys.length; i++) {
if (that.selectedRowKeys[i] == id) {
this.selectedRowKeys.splice(i, 1);
that.selectedRowKeys.splice(i, 1);
break;
}
}
}
that.initData();
// 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一
if (that.ipagination.current > 1 && ((that.ipagination.current - 1) * that.ipagination.pageSize) + 1 === that.ipagination.total) {
that.ipagination.current -= 1
}
that.loadData();
} else {
that.$message.warning(res.message);
}
});
}
});
})
},
open(record) {
//console.log(record);
this.currentDeptId = record.id;
this.currentDept = record;
this.initData(1);
this.loadData(1);
},
handleOk() {
this.visible = false
this.$emit('ok');
clearList() {
this.currentDeptId = '';
this.dataSource = [];
},
handleCancel() {
this.close();
},
close() {
this.$emit("close");
this.visible = false;
hasSelectDept() {
if (this.currentDeptId == '') {
this.$message.error("请选择一个部门!")
return false;
}
return true;
},
handleAddUserDepart() {
if (this.currentDeptId == "") {
this.$message.error("请选择一个部门!");
if (this.currentDeptId == '') {
this.$message.error("请选择一个部门!")
} else {
this.$refs.selectUserModal.visible = true;
this.$refs.selectUserModal.add()
}
},
handleEdit: function(record) {
handleEdit: function (record) {
this.$refs.modalForm.title = "编辑";
this.$refs.modalForm.departDisabled = true;
this.$refs.modalForm.disableSubmit = false;
this.$refs.modalForm.edit(record);
},
handleAdd: function() {
if (this.currentDeptId == "") {
this.$message.error("请选择一个部门!");
handleAdd: function () {
if (this.currentDeptId == '') {
this.$message.error("请选择一个部门!")
} else {
this.$refs.modalForm.departDisabled = true;
//初始化负责部门
this.$refs.modalForm.userDepartModel.departIdList = [this.currentDeptId]; //传入一个部门id
this.$refs.modalForm.add();
//update-begin---author:liusq Date:20210223 forhttps://gitee.com/jeecg/jeecg-boot/issues/I2SDU1------------
this.$refs.modalForm.resultDepartOptions = [{ key: this.currentDept.key, title: this.currentDept.title }];
this.$refs.modalForm.resultDepartOptions = [{key: this.currentDept.key, title: this.currentDept.title}]
//update-end---author:liusq Date:20210223 forhttps://gitee.com/jeecg/jeecg-boot/issues/I2SDU1------------
this.$refs.modalForm.title = "新增";
}
@@ -299,21 +321,21 @@ export default {
let params = {};
params.depId = this.currentDeptId;
params.userIdList = [];
for (let a = 0; a < data.length; a++) {
for (var a = 0; a < data.length; a++) {
params.userIdList.push(data[a]);
}
console.log(params);
postAction(this.url.edit, params).then((res) => {
if (res.success) {
this.$message.success(res.message);
this.initData();
this.loadData();
} else {
this.$message.warning(res.message);
}
});
})
},
handleDeptRole(record) {
if (this.currentDeptId != "") {
if (this.currentDeptId != '') {
this.$refs.deptRoleUser.add(record, this.currentDeptId);
this.$refs.deptRoleUser.title = "部门角色分配";
} else {
@@ -321,9 +343,10 @@ export default {
}
}
}
};
}
</script>
<style scoped>
@import '~@assets/less/common.less';
/** Button按钮间距 */
.ant-btn {
margin-left: 3px
@@ -335,12 +358,12 @@ export default {
margin-right: -30px;
}
.table-box {
margin-top: 20px;
}
.table-page-search-wrapper {
/*margin-top: -16px;*/
margin-top: -16px;
margin-bottom: 16px;
}
.table-operator {
margin-bottom: 8px;
}
</style>
+2 -2
View File
@@ -15,14 +15,14 @@
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="名称">
<a-input placeholder="请输入名称" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator.trim="['itemText', validatorRules.itemText]"/>
<a-input placeholder="请输入名称" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator="['itemText', validatorRules.itemText]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="数据值">
<a-input placeholder="请输入数据值" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator.trim="['itemValue', validatorRules.itemValue]"/>
<a-input placeholder="请输入数据值" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator="['itemValue', validatorRules.itemValue]"/>
</a-form-item>
<a-form-item
+10 -4
View File
@@ -68,10 +68,12 @@
description: '',
// 查询条件
queryParam: {},
// 记录上次查询条件
lastQueryParam:{},
// 表头
columns1: [
{
title: '#',
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 50,
@@ -138,7 +140,7 @@
ipagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
pageSizeOptions: ['2','10', '20', '30'],
showTotal: (total, range) => {
return range[0] + "-" + range[1] + " 共" + total + "条"
},
@@ -163,10 +165,12 @@
},
methods: {
searchQuery() {
this.lastQueryParam = { ...this.queryParam }
this.loadData(1);
},
searchReset() {
this.queryParam = {};
this.lastQueryParam = {}
this.loadData(1);
},
handleCancel() {
@@ -180,6 +184,8 @@
},
add() {
this.visible = true;
// 再次打开 清除之前的选中状态
this.onClearSelected()
},
loadData(arg) {
//加载数据 若传入参数1则加载第一页的内容
@@ -195,7 +201,7 @@
})
},
getQueryParams() {
var param = Object.assign({}, this.queryParam, this.isorter);
var param = Object.assign({}, this.lastQueryParam, this.isorter);
param.field = this.getQueryField();
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
@@ -284,4 +290,4 @@
height: 90% !important;
overflow-y: hidden
}
</style>
</style>
+9 -10
View File
@@ -24,23 +24,23 @@
<a-form-item label="用户账号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入用户账号" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator.trim="[ 'username', validatorRules.username]"
:readOnly="!!model.id"/>
:readOnly="!!model.id" :disabled="disableSubmit" />
</a-form-item>
<template v-if="!model.id">
<a-form-item label="登录密码" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input type="password" placeholder="请输入登录密码" :maxLength="50" autocomplete='new-password'
@change="event => event.target.value = event.target.value.trim()" v-decorator="[ 'password',validatorRules.password]"/>
@change="event => event.target.value = event.target.value.trim()" :disabled="disableSubmit" v-decorator="[ 'password',validatorRules.password]"/>
</a-form-item>
<a-form-item label="确认密码" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input type="password" @blur="handleConfirmBlur" :maxLength="50" placeholder="请重新输入登录密码"
<a-input type="password" @blur="handleConfirmBlur" :maxLength="50" placeholder="请重新输入登录密码" :disabled="disableSubmit"
@change="event => event.target.value = event.target.value.trim()" v-decorator="[ 'confirmpassword', validatorRules.confirmpassword]"/>
</a-form-item>
</template>
<a-form-item label="用户姓名" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入用户姓名" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator.trim="[ 'realname', validatorRules.realname]"/>
<a-input placeholder="请输入用户姓名" :disabled="disableSubmit" @change="event => event.target.value = event.target.value.trim()" :maxLength="50" v-decorator.trim="[ 'realname', validatorRules.realname]"/>
</a-form-item>
<!--<a-form-item label="工号" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
@@ -54,7 +54,7 @@
<a-form-item label="角色分配" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!roleDisabled">
<a-select
mode="multiple"
:disabled="departDisabled"
:disabled="departDisabled || disableSubmit"
style="width: 100%"
placeholder="请选择用户角色"
optionFilterProp="children"
@@ -84,6 +84,7 @@
optionFilterProp="children"
:getPopupContainer="(target) => target.parentNode"
:dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
:disabled="disableSubmit"
>
<a-select-option v-for="item in resultDepartOptions" :key="item.key" :value="item.key"
>{{ item.title }}
@@ -93,18 +94,18 @@
</a-form-item>
<a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol" v-has="'user:sex'">
<a-select v-decorator="[ 'sex', {}]" placeholder="请选择性别" :getPopupContainer="(target) => target.parentNode">
<a-select v-decorator="[ 'sex', {}]" placeholder="请选择性别" :disabled="disableSubmit" :getPopupContainer="(target) => target.parentNode">
<a-select-option :value="1"></a-select-option>
<a-select-option :value="2"></a-select-option>
</a-select>
</a-form-item>
<a-form-item label="邮箱" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入邮箱" @change="event => event.target.value = event.target.value.trim()" v-decorator="[ 'email', validatorRules.email]" :maxLength="50"/>
<a-input placeholder="请输入邮箱" :disabled="disableSubmit" @change="event => event.target.value = event.target.value.trim()" v-decorator="[ 'email', validatorRules.email]" :maxLength="50"/>
</a-form-item>
<a-form-item label="手机号码" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入手机号码" @change="event => event.target.value = event.target.value.trim()" :disabled="isDisabledAuth('user:form:phone')"
<a-input placeholder="请输入手机号码" @change="event => event.target.value = event.target.value.trim()" :disabled="isDisabledAuth('user:form:phone') || disableSubmit"
v-decorator="[ 'phone', validatorRules.phone]" :maxLength="11"/>
</a-form-item>
@@ -418,8 +419,6 @@ export default {
formData.confirmpassword = formData.password
formData.phone = encrypt(that.rsaPublicKey,values.phone)
formData.email = encrypt(that.rsaPublicKey,values.email)
debugger
//update-begin-author:taoyan date:2020710 for:多租户配置
formData.relTenantIds = this.currentTenant.length > 0 ? this.currentTenant.join(',') : ''
//update-end-author:taoyan date:2020710 for:多租户配置
+3 -3
View File
@@ -66,8 +66,8 @@ module.exports = {
less: {
modifyVars: {
/* less 变量覆盖,用于自定义 ant design 主题 */
'primary-color': '#1890FF',
'link-color': '#1890FF',
'primary-color': '#069f99',
'link-color': '#069f99',
'border-radius-base': '4px',
},
javascriptEnabled: true,
@@ -95,4 +95,4 @@ module.exports = {
},
lintOnSave: undefined
}
}