JeecgBoot 2.1.1 代码生成器AI版本发布

This commit is contained in:
zhangdaihao
2019-10-18 18:37:41 +08:00
parent 5b67b76b98
commit 6dbc37c410
267 changed files with 16761 additions and 26860 deletions

View File

@ -0,0 +1,98 @@
<template>
<a-card :loading="cardLoading" :bordered="false" style="height: 100%;">
<a-spin :spinning="loading">
<a-input-search @search="handleSearch" style="width:100%;margin-top: 10px" placeholder="输入组织机构名称进行查询..."/>
<a-tree
showLine
checkStrictly
:expandedKeys.sync="expandedKeys"
:selectedKeys="selectedKeys"
:dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
:treeData="treeDataSource"
@select="handleTreeSelect"
/>
</a-spin>
</a-card>
</template>
<script>
import { queryDepartTreeList, searchByKeywords } from '@/api/api'
export default {
name: 'AddressListLeft',
props: ['value'],
data() {
return {
cardLoading: true,
loading: false,
treeDataSource: [],
selectedKeys: [],
expandedKeys: []
}
},
created() {
this.queryTreeData()
},
methods: {
queryTreeData(keyword) {
this.commonRequestThen(queryDepartTreeList({
departName: keyword ? keyword : undefined
}))
},
handleSearch(value) {
if (value) {
this.commonRequestThen(searchByKeywords({ keyWord: value }))
} else {
this.queryTreeData()
}
},
handleTreeSelect(selectedKeys, event) {
if (selectedKeys.length > 0 && this.selectedKeys[0] !== selectedKeys[0]) {
this.selectedKeys = [selectedKeys[0]]
let orgCode = event.node.dataRef.orgCode
this.emitInput(orgCode)
}
},
emitInput(orgCode) {
this.$emit('input', orgCode)
},
commonRequestThen(promise) {
this.loading = true
promise.then(res => {
if (res.success) {
this.treeDataSource = res.result
// 默认选中第一条数据、默认展开所有第一级
if (res.result.length > 0) {
this.expandedKeys = []
res.result.forEach((item, index) => {
if (index === 0) {
this.selectedKeys = [item.id]
this.emitInput(item.orgCode)
}
this.expandedKeys.push(item.id)
})
}
} else {
this.$message.warn('组织机构查询失败' + res.message)
console.error('组织机构查询失败:', res)
}
}).finally(() => {
this.loading = false
this.cardLoading = false
})
},
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,198 @@
<template>
<a-card class="j-address-list-right-card-box" :loading="cardLoading" :bordered="false">
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="10">
<a-col :md="6" :sm="12">
<a-form-item label="姓名" style="margin-left:8px">
<a-input placeholder="请输入姓名查询" v-model="queryParam.realname"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="12">
<a-form-item label="工号" style="margin-left:8px">
<a-input placeholder="请输入工号查询" v-model="queryParam.workNo"></a-input>
</a-form-item>
</a-col>
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 18px">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<a-table
ref="table"
size="middle"
bordered
rowKey="userId"
:pagination="ipagination"
:columns="columns"
:dataSource="dataSource"
:loading="loading"
@change="handleTableChange">
</a-table>
</a-card>
</template>
<script>
import { getAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
name: 'AddressListRight',
mixins: [JeecgListMixin],
components: {},
props: ['value'],
data() {
return {
description: '用户信息',
cardLoading: true,
positionInfo: {},
columns: [
{
title: '#',
key: 'rowIndex',
dataIndex: '',
width: 60,
align: 'center',
customRender: (t, r, i) => parseInt(i) + 1
},
{
title: '部门',
width: '20%',
align: 'center',
dataIndex: 'departName'
},
{
title: '姓名',
width: '15%',
align: 'center',
dataIndex: 'realname'
},
{
title: '工号',
width: '15%',
align: 'center',
dataIndex: 'workNo'
},
{
title: '职务',
width: '15%',
align: 'center',
dataIndex: 'post',
customRender: (text) => (text || '').split(',').map(t => this.positionInfo[t] ? this.positionInfo[t] : t).join(',')
},
{
title: '座机',
width: '15%',
align: 'center',
dataIndex: 'telephone'
},
// {
// title: '手机号',
// width: '12%',
// align: 'center',
// dataIndex: 'phone'
// },
{
title: '公司邮箱',
width: '15%',
align: 'center',
dataIndex: 'email'
}
],
url: {
list: '/sys/user/queryByOrgCodeForAddressList',
listByPosition: '/sys/position/list'
}
}
},
watch: {
value: {
immediate: true,
handler(orgCode) {
this.dataSource = []
this.loadData(1, orgCode)
}
},
},
created() {
this.queryPositionInfo()
},
methods: {
loadData(pageNum, orgCode) {
if (!orgCode) {
return
}
//加载数据 若传入参数1则加载第一页的内容
if (pageNum === 1) {
this.ipagination.current = 1
}
this.loading = true
getAction(this.url.list, {
orgCode,
...this.getQueryParams()
}).then((res) => {
if (res.success) {
this.dataSource = res.result.records
this.ipagination.total = res.result.total
}
}).finally(() => {
this.loading = false
this.cardLoading = false
})
},
searchQuery() {
this.loadData(1, this.value)
},
searchReset() {
this.queryParam = {}
this.loadData(1, this.value)
},
handleTableChange(pagination, filters, sorter) {
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field
this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc'
}
this.ipagination = pagination
this.loadData(null, this.value)
},
// 查询职务信息
queryPositionInfo() {
getAction(this.url.listByPosition, { pageSize: 99999 }).then(res => {
if (res.success) {
let positionInfo = {}
res.result.records.forEach(record => {
positionInfo[record['code']] = record['name']
})
this.positionInfo = positionInfo
}
})
}
}
}
</script>
<style>
.j-address-list-right-card-box .ant-table-placeholder {
min-height: 46px;
}
</style>
<style scoped>
.j-address-list-right-card-box {
height: 100%;
min-height: 300px;
}
</style>

View File

@ -30,6 +30,28 @@
:disabled="condition">
</a-tree-select>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="机构类型">
<template v-if="seen">
<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"
@ -107,6 +129,7 @@
url: {
add: "/sys/sysDepart/add",
},
dictDisabled:true,
}
},
created () {
@ -128,8 +151,10 @@
add (depart) {
if(depart){
this.seen = false;
this.dictDisabled = false;
}else{
this.seen = true;
this.dictDisabled = true;
}
this.edit(depart);
},
@ -139,8 +164,13 @@
this.visible = true;
this.loadTreeData();
this.model.parentId = record!=null?record.toString():null;
if(this.seen){
this.model.orgCategory = '1';
}else{
this.model.orgCategory = '2';
}
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'departName','departNameEn','departNameAbbr','departOrder','description','orgType','orgCode','mobile','fax','address','memo','status','delFlag'))
this.form.setFieldsValue(pick(this.model,'orgCategory','departName','departNameEn','departNameAbbr','departOrder','description','orgType','orgCode','mobile','fax','address','memo','status','delFlag'))
});
},
close () {

View File

@ -23,6 +23,22 @@
label="机构编码">
<a-input style="border:0px;" placeholder="" v-decorator="['orgCode', {}]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="机构类型">
<a-radio-group :disabled="true" v-decorator="['orgCategory',{}]" placeholder="请选择机构类型">
<a-radio value="1">
公司
</a-radio>
<a-radio value="2">
部门
</a-radio>
<a-radio value="3">
岗位
</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
@ -98,7 +114,7 @@
console.log("record:");
console.log(record);
this.$nextTick(() => {
this.form.setFieldsValue(pick(record, 'departName', 'parentId', 'orgCode', 'departOrder', 'mobile', 'fax', 'address', 'memo'));
this.form.setFieldsValue(pick(record, 'orgCategory','departName', 'parentId', 'orgCode', 'departOrder', 'mobile', 'fax', 'address', 'memo'));
});
},
clearForm() {

View File

@ -148,6 +148,16 @@
<a-switch checkedChildren="" unCheckedChildren="" v-model="alwaysShow"/>
</a-form-item>
<!--update_begin author:wuxianquan date:20190908 for:增加组件外链打开方式可选 -->
<a-form-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="打开方式">
<a-switch checkedChildren="外部" unCheckedChildren="内部" v-model="internalOrExternal"/>
</a-form-item>
<!--update_end author:wuxianquan date:20190908 for:增加组件外链打开方式可选 -->
</a-form>
@ -186,6 +196,9 @@
alwaysShow:false,//表单元素-聚合路由
menuHidden:false,//表单元素-隐藏路由
routeSwitch:true, //是否路由菜单
/*update_begin author:wuxianquan date:20190908 for:定义变量,初始值代表内部打开*/
internalOrExternal:false,//菜单打开方式
/*update_end author:wuxianquan date:20190908 for:定义变量,初始值代表内部打开*/
isKeepalive:true, //是否缓存路由
show:true,//根据菜单类型,动态显示隐藏表单元素
menuLabel:'菜单名称',
@ -213,7 +226,7 @@
component:{rules: [{ required: this.show, message: '请输入前端组件!' }]},
url:{rules: [{ required: this.show, message: '请输入菜单路径!' }]},
permsType:{rules: [{ required: true, message: '请输入授权策略!' }]},
sortNo:{initialValue:1.0,rules: [{validator: this.validateNumber}]},
sortNo:{initialValue:1.0},
}
}
},
@ -254,13 +267,20 @@
if(record.route!=null){
this.routeSwitch = record.route?true:false;
}
if(record.keepAlive!=null){
this.isKeepalive = record.keepAlive?true:false;
}else{
this.isKeepalive = false; // 升级兼容 如果没有后台没有传过来、或者是新建默认为false
}
/*update_begin author:wuxianquan date:20190908 for:编辑初始化数据*/
if(record.internalOrExternal!=null){
this.internalOrExternal = record.internalOrExternal?true:false;
}else{
this.internalOrExternal = false;
}
/*update_end author:wuxianquan date:20190908 for:编辑初始化数据*/
//console.log('record.menuType', record.menuType);
@ -295,6 +315,10 @@
this.model.hidden = this.menuHidden;
this.model.route = this.routeSwitch;
this.model.keepAlive = this.isKeepalive;
/*update_begin author:wuxianquan date:20190908 for:获取值*/
this.model.internalOrExternal = this.internalOrExternal;
/*update_end author:wuxianquan date:20190908 for:获取值*/
let formData = Object.assign(this.model, values);
if ((formData.menuType == 1 || formData.menuType == 2) && !formData.parentId) {
that.validateStatus = 'error';

View File

@ -28,7 +28,8 @@
<!-- <a-icon type="share-alt" />-->
<!-- 在线cron表达式生成-->
<!-- </a>-->
<j-cron ref="innerVueCron" v-decorator="['cronExpression', {'initialValue':'0/1 * * * * ?',rules: [{ required: true, message: '请输入cron表达式!' }]}]" @change="setCorn"></j-cron>
<!-- <j-cron ref="innerVueCron" v-decorator="['cronExpression', {'initialValue':'0/1 * * * * ?',rules: [{ required: true, message: '请输入cron表达式!' }]}]" @change="setCorn"></j-cron>-->
<j-cron ref="innerVueCron" v-decorator="['cronExpression', { initialValue: '* * * * * ? *' }]" @change="setCorn"></j-cron>
</a-form-item>
<a-form-item
:labelCol="labelCol"
@ -61,9 +62,9 @@
<script>
import { httpAction } from '@/api/manage'
import JCron from "@/components/jeecg/JCron.vue";
import JCron from "@/components/jeecg/JCron";
import pick from 'lodash.pick'
import moment from "moment"
// import moment from "moment"
export default {
name: "QuartzJobModal",
@ -109,6 +110,8 @@
this.edit({});
},
edit (record) {
let that = this;
that.form.resetFields();
this.model = Object.assign({},record);
console.log(this.model)
this.visible = true;
@ -127,10 +130,10 @@
this.form.validateFields((err, values) => {
console.log('values',values)
if (!err) {
// if (typeof values.cronExpression == "undefined" || Object.keys(values.cronExpression).length==0 ) {
// this.$message.warning('请输入cron表达式!');
// return false;
// }
if (typeof values.cronExpression == "undefined" || Object.keys(values.cronExpression).length==0 ) {
this.$message.warning('请输入cron表达式!');
return false;
}
that.confirmLoading = true;
let httpurl = '';
@ -171,9 +174,9 @@
})
// console.log(Object.keys(data).length==0);
// if (Object.keys(data).length==0) {
// this.$message.warning('请输入cron表达式!');
// }
if (Object.keys(data).length==0) {
this.$message.warning('请输入cron表达式!');
}
},
validateCron(rule, value, callback){
if(!value){

View File

@ -66,17 +66,17 @@
</a-row>
</a-form>
</div>
<!-- update-begin author:kangxiaolin date:20190921 for:系统发送通知 用户多选失败 #513 -->
<a-table
ref="table"
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,onSelect:onSelect}"
@change="handleTableChange"
>
<!-- update-end author:kangxiaolin date:20190921 for:系统发送通知 用户多选失败 #513 -->
</a-table>
</a-modal>
</template>
@ -178,7 +178,13 @@
if(!selectUser){
this.selectionRows=[]
}else{
this.selectionRows = selectUser;
var that=this;
that.selectionRows=[];
selectUser.forEach(function(record,index){
console.log(record)
that.selectionRows.push({id: that.selectedRowKeys[index],realname:record})
})
// this.selectionRows = selectUser;
}
},
loadData (arg){
@ -211,11 +217,23 @@
}
return str;
},
onSelectChange (selectedRowKeys,selectionRows) {
//--update-begin----author:kangxiaolin---date:20190921------for:系统发送通知 用户多选失败 #513----
onSelectChange (selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys;
console.log(this.selectedRowKeys);
this.selectionRows = selectionRows;
},
onSelect(record, selected){
if(selected == true ){
this.selectionRows.push(record);
}else {
this.selectionRows.forEach(function(item,index,arr){
if(item.id == record.id) {
arr.splice(index, 1);
}
})
}
//--update-end----author:kangxiaolin---date:20190921------for:系统发送通知 用户多选失败 #513----
},
searchReset(){
let that = this;
Object.keys(that.queryParam).forEach(function(key){

View File

@ -17,7 +17,8 @@
placeholder="请选择父级节点"
v-decorator="['pid', validatorRules.pid]"
dict="sys_category,name,id"
pidField="pid">
pidField="pid"
pidValue="0">
</j-tree-select>
</a-form-item>
@ -25,9 +26,16 @@
<a-input v-decorator="[ 'name', validatorRules.name]" placeholder="请输入类型名称"></a-input>
</a-form-item>
<a-form-item label="类型编码" :labelCol="labelCol" :wrapperCol="wrapperCol">
<!--<a-form-item label="类型编码" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="[ 'code', validatorRules.code]" placeholder="请输入类型编码"></a-input>
</a-form-item>
</a-form-item>-->
<!--<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol">
<span style="font-size: 12px;color:red" slot="label">编码规则()</span>
<span style="font-size: 12px;color:red">
编码值前缀需和父节点保持一致,比如父级节点编码是A01则当前编码必须以A01开头
</span>
</a-form-item>-->
</a-form>
@ -37,7 +45,7 @@
<script>
import { httpAction } from '@/api/manage'
import { httpAction,getAction } from '@/api/manage'
import pick from 'lodash.pick'
import JTreeSelect from '@/components/jeecg/JTreeSelect'
@ -64,13 +72,20 @@
confirmLoading: false,
validatorRules:{
pid:{},
name:{},
code:{},
code:{
rules: [{
required: true, message: '请输入类型编码!'
},{
validator: this.validateMyCode
}]
},
pid:{},
name:{}
},
url: {
add: "/sys/category/add",
edit: "/sys/category/edit",
checkCode:"/sys/category/checkCode"
},
expandedRowKeys:[],
pidField:"pid"
@ -154,7 +169,20 @@
}
}
}
}
},
validateMyCode(rule, value, callback){
let params = {
pid: this.form.getFieldValue('pid'),
code: value
}
getAction(this.url.checkCode,params).then((res) => {
if (res.success) {
callback()
} else {
callback(res.message)
}
})
},
}

View File

@ -0,0 +1,180 @@
<template>
<a-modal
:title="title"
:width="800"
:visible="visible"
:maskClosable="false"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="职务编码">
<a-input placeholder="请输入职务编码" v-decorator="['code', validatorRules.code]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="职务名称">
<a-input placeholder="请输入职务名称" v-decorator="['name', validatorRules.name]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="职级"
>
<j-dict-select-tag
placeholder="请选择职级"
:triggerChange="true"
dictCode="position_rank"
v-decorator="['rank', validatorRules.rank]"
/>
</a-form-item>
<!--<a-form-item-->
<!-- :labelCol="labelCol"-->
<!-- :wrapperCol="wrapperCol"-->
<!-- label="公司id">-->
<!-- <a-input placeholder="请输入公司id" v-decorator="['companyId', {}]"/>-->
<!--</a-form-item>-->
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import pick from 'lodash.pick'
import { httpAction } from '@/api/manage'
import { duplicateCheck } from '@/api/api'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
let validatorCodeTimer = null
export default {
name: 'SysPositionModal',
components: { JDictSelectTag },
data() {
return {
title: '操作',
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: {
code: {
rules: [
{ required: true, message: '请输入职务编码' },
{
validator: (rule, value, callback) => {
// 函数消抖的简单实现,防止一段时间内发送多次请求
if (validatorCodeTimer) {
// 停止上次开启的定时器
clearTimeout(validatorCodeTimer)
}
validatorCodeTimer = setTimeout(() => {
duplicateCheck({
tableName: 'sys_position',
fieldName: 'code',
fieldVal: value,
dataId: this.model.id
}).then((res) => {
if (res.success) {
callback()
} else {
callback(res.message)
}
}).catch(console.error)
}, 300)
}
}
]
},
name: { rules: [{ required: true, message: '请输入职务名称' }] },
rank: { rules: [{ required: true, message: '请选择职级' }] },
},
url: {
add: '/sys/position/add',
edit: '/sys/position/edit',
},
}
},
created() {
},
methods: {
add() {
this.edit({})
},
edit(record) {
this.form.resetFields()
this.model = Object.assign({}, record)
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,
'code',
'name',
'rank',
// 'companyId'
))
})
},
close() {
this.$emit('close')
this.visible = false
},
handleOk() {
const that = this
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true
let httpurl = ''
let method = ''
if (!this.model.id) {
httpurl += this.url.add
method = 'post'
} else {
httpurl += this.url.edit
method = 'put'
}
let formData = Object.assign(this.model, values)
httpAction(httpurl, formData, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
that.close()
})
}
})
},
handleCancel() {
this.close()
},
}
}
</script>
<style lang="less" scoped>
</style>

View File

@ -40,6 +40,14 @@
<a-input placeholder="请输入用户名称" v-decorator="[ 'realname', validatorRules.realname]" />
</a-form-item>
<a-form-item label="工号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入工号" v-decorator="[ 'workNo', validatorRules.workNo]" />
</a-form-item>
<a-form-item label="职务" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-select-position placeholder="请选择职务" :multiple="false" v-decorator="['post', {}]"/>
</a-form-item>
<a-form-item label="角色分配" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!roleDisabled" >
<a-select
mode="multiple"
@ -104,6 +112,10 @@
<a-input placeholder="请输入手机号码" :disabled="isDisabledAuth('user:form:phone')" v-decorator="[ 'phone', validatorRules.phone]" />
</a-form-item>
<a-form-item label="座机" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入座机" v-decorator="[ 'telephone', validatorRules.telephone]"/>
</a-form-item>
<a-form-item label="工作流引擎" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag v-decorator="['activitiSync', {}]" placeholder="请选择是否同步工作流引擎" :type="'radio'" :triggerChange="true" dictCode="activiti_sync"/>
</a-form-item>
@ -127,6 +139,7 @@
import Vue from 'vue'
// 引入搜索部门弹出框的组件
import departWindow from './DepartWindow'
import JSelectPosition from '@/components/jeecgbiz/JSelectPosition'
import { ACCESS_TOKEN } from "@/store/mutation-types"
import { getAction } from '@/api/manage'
import {addUser,editUser,queryUserRole,queryall } from '@/api/api'
@ -134,9 +147,10 @@
import {duplicateCheck } from '@/api/api'
export default {
name: "RoleModal",
name: "UserModal",
components: {
departWindow,
JSelectPosition
},
data () {
return {
@ -185,8 +199,19 @@
validator: this.validateEmail
}],
},
roles:{}
roles:{},
// sex:{initialValue:((!this.model.sex)?"": (this.model.sex+""))}
workNo: {
rules: [
{ required: true, message: '请输入工号' },
{ validator: this.validateWorkNo }
]
},
telephone: {
rules: [
{ pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '请输入正确的座机号码' },
]
}
},
title:"操作",
visible: false,
@ -282,7 +307,7 @@
that.visible = true;
that.model = Object.assign({}, record);
that.$nextTick(() => {
that.form.setFieldsValue(pick(this.model,'username','sex','realname','email','phone','activitiSync'))
that.form.setFieldsValue(pick(this.model,'username','sex','realname','email','phone','activitiSync','workNo','telephone','post'))
});
// 调用查询用户对应的部门信息的方法
that.checkedDepartKeys = [];
@ -389,7 +414,10 @@
if(!value){
callback()
}else{
if(new RegExp(/^1[3|4|5|7|8][0-9]\d{8}$/).test(value)){
//update-begin--Author:kangxiaolin Date:20190826 for[05] 手机号不支持199号码段--------------------
if(new RegExp(/^1[3|4|5|7|8|9][0-9]\d{8}$/).test(value)){
//update-end--Author:kangxiaolin Date:20190826 for[05] 手机号不支持199号码段--------------------
var params = {
tableName: 'sys_user',
fieldName: 'phone',
@ -447,6 +475,21 @@
}
})
},
validateWorkNo(rule, value, callback){
var params = {
tableName: 'sys_user',
fieldName: 'work_no',
fieldVal: value,
dataId: this.userId
};
duplicateCheck(params).then((res) => {
if (res.success) {
callback()
} else {
callback("工号已存在!")
}
})
},
handleConfirmBlur (e) {
const value = e.target.value;
this.confirmDirty = this.confirmDirty || !!value

View File

@ -18,6 +18,7 @@
:treeData="treeData"
@expand="onExpand"
@select="onTreeNodeSelect"
:selectedKeys="selectedKeys"
:expandedKeys="expandedKeysss"
:checkStrictly="checkStrictly">
<span slot="hasDatarule" slot-scope="{slotTitle,ruleFlag}">
@ -30,8 +31,10 @@
<div class="drawer-bootom-button">
<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>
@ -67,25 +70,28 @@
treeData: [],
defaultCheckedKeys:[],
checkedKeys:[],
halfCheckedKeys:[],
expandedKeysss:[],
allTreeKeys:[],
autoExpandParent: true,
checkStrictly: true,
checkStrictly: false,
title:"角色权限配置",
visible: false,
loading: false,
selectedKeys:[]
}
},
methods: {
onTreeNodeSelect(id){
this.$refs.datarule.show(id[0],this.roleId)
},
onCheck (o) {
if(this.checkStrictly){
this.checkedKeys = o.checked;
}else{
this.checkedKeys = o
if(id && id.length>0){
this.selectedKeys = id
}
this.$refs.datarule.show(this.selectedKeys[0],this.roleId)
},
onCheck (checkedKeys, { halfCheckedKeys }) {
// 保存选中的和半选中的,后面保存的时候合并提交
this.checkedKeys = checkedKeys
this.halfCheckedKeys = halfCheckedKeys
},
show(roleId){
this.roleId=roleId
@ -116,24 +122,18 @@
this.checkedKeys = this.allTreeKeys
},
cancelCheckALL () {
//this.checkedKeys = this.defaultCheckedKeys
this.checkedKeys = []
},
switchCheckStrictly (v) {
if(v==1){
this.checkStrictly = false
}else if(v==2){
this.checkStrictly = true
}
},
handleCancel () {
this.close()
},
handleSubmit(){
let that = this;
let checkedKeys = [...that.checkedKeys, ...that.halfCheckedKeys]
const permissionIds = checkedKeys.join(",")
let params = {
roleId:that.roleId,
permissionIds:that.checkedKeys.join(","),
permissionIds,
lastpermissionIds:that.defaultCheckedKeys.join(","),
};
that.loading = true;
@ -150,6 +150,15 @@
}
})
},
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;
},
},
watch: {
visible () {
@ -157,11 +166,23 @@
queryTreeListForRole().then((res) => {
this.treeData = res.result.treeList
this.allTreeKeys = res.result.ids
const keyLeafPairs = this.convertTreeListToKeyLeafPairs(this.treeData)
queryRolePermission({roleId:this.roleId}).then((res)=>{
this.checkedKeys = [...res.result];
this.defaultCheckedKeys = [...res.result];
this.expandedKeysss = this.allTreeKeys;
//console.log(this.defaultCheckedKeys)
// 过滤出 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;
})
})
}