mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-02-04 01:25:34 +08:00
jeecg-boot 2.0 模块开发版本发布
This commit is contained in:
113
ant-design-jeecg-vue/src/views/system/modules/DeptBaseInfo.vue
Normal file
113
ant-design-jeecg-vue/src/views/system/modules/DeptBaseInfo.vue
Normal file
@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<a-card :visible="visible">
|
||||
<a-form :form="form">
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="机构名称">
|
||||
<a-input style="border:0px;" placeholder="" v-decorator="['departName', {}]"/>
|
||||
</a-form-item>
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="上级部门">
|
||||
<a-tree-select
|
||||
disabled
|
||||
style="width:100%;border: 0px;border: none;outline:none;"
|
||||
:dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
|
||||
:treeData="treeData"
|
||||
v-model="model.parentId"
|
||||
placeholder="无">
|
||||
</a-tree-select>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="机构编码">
|
||||
<a-input style="border:0px;" placeholder="" v-decorator="['orgCode', {}]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="排序">
|
||||
<a-input-number style="border:0px;" v-decorator="[ 'departOrder',{}]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="手机号">
|
||||
<a-input style="border:0px;" placeholder="" v-decorator="['mobile', {}]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="地址">
|
||||
<a-input style="border:0px;" placeholder="" v-decorator="['address', {}]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="备注">
|
||||
<a-textarea style="border:0px;" placeholder="" v-decorator="['memo', {}]"/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-card>
|
||||
</template>
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import {queryIdTree} from '@/api/api'
|
||||
|
||||
export default {
|
||||
name: 'DeptBaseInfo',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
departTree: [],
|
||||
id: '',
|
||||
model: {},
|
||||
visible: false,
|
||||
disable: true,
|
||||
treeData: [],
|
||||
form: this.$form.createForm(this),
|
||||
labelCol: {
|
||||
xs: {span: 24},
|
||||
sm: {span: 3}
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: {span: 24},
|
||||
sm: {span: 16}
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadTreeData();
|
||||
},
|
||||
methods: {
|
||||
loadTreeData() {
|
||||
queryIdTree().then((res) => {
|
||||
if (res.success) {
|
||||
for (let i = 0; i < res.result.length; i++) {
|
||||
let temp = res.result[i];
|
||||
this.treeData.push(temp);
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
open(record) {
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
console.log("record:");
|
||||
console.log(record);
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(record, 'departName', 'parentId', 'orgCode', 'departOrder', 'mobile', 'fax', 'address', 'memo'));
|
||||
});
|
||||
},
|
||||
clearForm() {
|
||||
this.form.resetFields();
|
||||
this.treeData = [];
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
@import '~@assets/less/common.less'
|
||||
</style>
|
||||
285
ant-design-jeecg-vue/src/views/system/modules/DeptUserInfo.vue
Normal file
285
ant-design-jeecg-vue/src/views/system/modules/DeptUserInfo.vue
Normal file
@ -0,0 +1,285 @@
|
||||
<template>
|
||||
<a-card :bordered="false">
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<!-- 搜索区域 -->
|
||||
<a-form layout="inline">
|
||||
<a-row :gutter="10">
|
||||
<a-col :md="10" :sm="12">
|
||||
<a-form-item label="用户账号" style="margin-left:8px">
|
||||
<a-input placeholder="请输入名称查询" v-model="queryParam.username"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!--<a-col :md="8" :sm="8">-->
|
||||
<!--<a-form-item label="用户名称" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">-->
|
||||
<!--<a-input placeholder="请输入名称查询" v-model="queryParam.realname"></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>
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator" :md="24" :sm="24" style="margin: -46px 0px 10px 2px">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus" style="margin-top: 16px">用户录入</a-button>
|
||||
<!--<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-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>
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
|
||||
<a-divider type="vertical"/>
|
||||
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">
|
||||
更多 <a-icon type="down"/>
|
||||
</a>
|
||||
<a-menu slot="overlay">
|
||||
<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>
|
||||
</span>
|
||||
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
<!-- table区域-end -->
|
||||
|
||||
<!-- 表单区域 -->
|
||||
<user-modal ref="modalForm" @ok="modalFormOk"></user-modal>
|
||||
<Select-User-Modal ref="selectUserModal" @selectFinished="selectOK"></Select-User-Modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
|
||||
import {getAction, postAction, deleteAction} from '@/api/manage'
|
||||
import SelectUserModal from './SelectUserModal'
|
||||
import UserModal from './UserModal'
|
||||
|
||||
export default {
|
||||
name: "DeptUserInfo",
|
||||
mixins: [JeecgListMixin],
|
||||
components: {
|
||||
SelectUserModal,
|
||||
UserModal
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
description: '用户信息',
|
||||
currentDeptId: '',
|
||||
// 表头
|
||||
columns: [{
|
||||
title: '用户账号',
|
||||
align: "center",
|
||||
dataIndex: 'username'
|
||||
},
|
||||
{
|
||||
title: '用户名称',
|
||||
align: "center",
|
||||
dataIndex: 'realname'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
scopedSlots: {customRender: 'action'},
|
||||
align: "center",
|
||||
width: 170
|
||||
}],
|
||||
url: {
|
||||
list: "/sys/user/departUserList",
|
||||
edit: "/sys/user/editSysDepartWithUser",
|
||||
delete: "/sys/user/deleteUserInDepart",
|
||||
deleteBatch: "/sys/user/deleteUserInDepartBatch",
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
loadData(arg) {
|
||||
if (!this.url.list) {
|
||||
this.$message.error("请设置url.list属性!")
|
||||
return
|
||||
}
|
||||
//加载数据 若传入参数1则加载第一页的内容
|
||||
if (arg === 1) {
|
||||
this.ipagination.current = 1;
|
||||
}
|
||||
if (this.currentDeptId === '') return;
|
||||
var params = this.getQueryParams();//查询条件
|
||||
params.depId = this.currentDeptId;
|
||||
getAction(this.url.list, params).then((res) => {
|
||||
if (res.success) {
|
||||
this.dataSource = res.result.records;
|
||||
this.ipagination.total = res.result.total;
|
||||
}
|
||||
})
|
||||
},
|
||||
batchDel: function () {
|
||||
|
||||
if (!this.url.deleteBatch) {
|
||||
this.$message.error("请设置url.deleteBatch属性!")
|
||||
return
|
||||
}
|
||||
if (this.selectedRowKeys.length <= 0) {
|
||||
this.$message.warning('请选择一条记录!');
|
||||
return;
|
||||
} else {
|
||||
var ids = "";
|
||||
for (var a = 0; a < this.selectedRowKeys.length; a++) {
|
||||
ids += this.selectedRowKeys[a] + ",";
|
||||
}
|
||||
var that = this;
|
||||
console.log(this.currentDeptId);
|
||||
this.$confirm({
|
||||
title: "确认删除",
|
||||
content: "是否删除选中数据?",
|
||||
onOk: function () {
|
||||
deleteAction(that.url.deleteBatch, {depId: that.currentDeptId, userIds: ids}).then((res) => {
|
||||
if (res.success) {
|
||||
that.$message.success(res.message);
|
||||
that.loadData();
|
||||
that.onClearSelected();
|
||||
} else {
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
handleDelete: function (id) {
|
||||
if (!this.url.delete) {
|
||||
this.$message.error("请设置url.delete属性!")
|
||||
return
|
||||
}
|
||||
var that = this;
|
||||
deleteAction(that.url.delete, {depId: this.currentDeptId, userId: id}).then((res) => {
|
||||
if (res.success) {
|
||||
that.$message.success(res.message);
|
||||
that.loadData();
|
||||
} else {
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
open(record) {
|
||||
//console.log(record);
|
||||
this.currentDeptId = record.id;
|
||||
this.loadData(1);
|
||||
},
|
||||
clearList() {
|
||||
this.currentDeptId = '';
|
||||
this.dataSource = [];
|
||||
},
|
||||
hasSelectDept() {
|
||||
if (this.currentDeptId == null) {
|
||||
this.$message.error("请选择一个部门!")
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
handleAddUserDepart() {
|
||||
if (this.currentDeptId == '') {
|
||||
this.$message.error("请选择一个部门!")
|
||||
} else {
|
||||
this.$refs.selectUserModal.visible = true;
|
||||
}
|
||||
},
|
||||
handleAdd: function () {
|
||||
if (this.currentDeptId == '') {
|
||||
this.$message.error("请选择一个部门!")
|
||||
} else {
|
||||
this.$refs.modalForm.departDisabled = true;
|
||||
this.$refs.modalForm.deptId = this.currentDeptId;
|
||||
this.$refs.modalForm.add();
|
||||
this.$refs.modalForm.title = "新增";
|
||||
}
|
||||
},
|
||||
selectOK(data) {
|
||||
let params = {};
|
||||
params.depId = this.currentDeptId;
|
||||
params.userIdList = [];
|
||||
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.loadData();
|
||||
} else {
|
||||
this.$message.warning(res.message);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
/** Button按钮间距 */
|
||||
.ant-btn {
|
||||
margin-left: 3px
|
||||
}
|
||||
|
||||
.ant-card {
|
||||
margin-left: -30px;
|
||||
margin-right: -30px;
|
||||
}
|
||||
|
||||
.table-page-search-wrapper {
|
||||
margin-top: -16px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
</style>
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import {addDictItem, editDictItem, getDictItemList} from '@/api/api'
|
||||
import {addDictItem, editDictItem} from '@/api/api'
|
||||
|
||||
export default {
|
||||
name: "DictItemModal",
|
||||
@ -104,20 +104,6 @@
|
||||
this.form.setFieldsValue(pick(this.model, 'itemText', 'itemValue', 'description', 'sortOrder'))
|
||||
});
|
||||
},
|
||||
// 将查询字典对象数据的方法拆分出来,需要的时候再加载
|
||||
getDictItemList() {
|
||||
// 查询字典数据
|
||||
var params = this.getQueryParams();//查询条件
|
||||
getDictItemList(params).then((res) => {
|
||||
if (res.success) {
|
||||
this.dataSource = res.result.records;
|
||||
console.log(this.dataSource)
|
||||
this.ipagination.total = res.result.total;
|
||||
this.loadrefresh = false;
|
||||
this.loading = false;
|
||||
}
|
||||
})
|
||||
},
|
||||
onChose(checked) {
|
||||
if (checked) {
|
||||
this.status = 1;
|
||||
@ -134,6 +120,9 @@
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true;
|
||||
values.itemText = (values.itemText || '').trim()
|
||||
values.itemValue = (values.itemValue || '').trim()
|
||||
values.description = (values.description || '').trim()
|
||||
let formData = Object.assign(this.model, values);
|
||||
formData.status = this.status;
|
||||
let obj;
|
||||
|
||||
@ -39,33 +39,33 @@
|
||||
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import {addDict, editDict, duplicateCheck} from '@/api/api'
|
||||
import { addDict, editDict, duplicateCheck } from '@/api/api'
|
||||
|
||||
export default {
|
||||
name: "DictModal",
|
||||
name: 'DictModal',
|
||||
data() {
|
||||
return {
|
||||
value: 1,
|
||||
title: "操作",
|
||||
title: '操作',
|
||||
visible: false,
|
||||
model: {},
|
||||
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 }
|
||||
},
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
validatorRules: {
|
||||
dictName: {rules: [{required: true, message: '请输入字典名称!'}]},
|
||||
dictName: { rules: [{ required: true, message: '请输入字典名称!' }] },
|
||||
dictCode: {
|
||||
rules: [{required: true, message: '请输入字典编码!'},
|
||||
{validator: this.validateDictCode,}]
|
||||
},
|
||||
},
|
||||
rules: [{ required: true, message: '请输入字典编码!' },
|
||||
{ validator: this.validateDictCode }]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -74,76 +74,79 @@
|
||||
validateDictCode(rule, value, callback) {
|
||||
// 重复校验
|
||||
var params = {
|
||||
tableName: "sys_dict",
|
||||
fieldName: "dict_code",
|
||||
tableName: 'sys_dict',
|
||||
fieldName: 'dict_code',
|
||||
fieldVal: value,
|
||||
dataId: this.model.id,
|
||||
};
|
||||
dataId: this.model.id
|
||||
}
|
||||
duplicateCheck(params).then((res) => {
|
||||
if (res.success) {
|
||||
callback();
|
||||
callback()
|
||||
} else {
|
||||
callback(res.message);
|
||||
callback(res.message)
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
handleChange(value) {
|
||||
this.model.status = value;
|
||||
this.model.status = value
|
||||
},
|
||||
add() {
|
||||
this.edit({});
|
||||
this.edit({})
|
||||
},
|
||||
edit(record) {
|
||||
if (record.id) {
|
||||
this.visiblekey = true;
|
||||
this.visiblekey = true
|
||||
} else {
|
||||
this.visiblekey = false;
|
||||
this.visiblekey = false
|
||||
}
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
this.form.resetFields()
|
||||
this.model = Object.assign({}, record)
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'dictName', 'dictCode', 'description'))
|
||||
});
|
||||
})
|
||||
},
|
||||
// 确定
|
||||
handleOk() {
|
||||
const that = this;
|
||||
const that = this
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true;
|
||||
let formData = Object.assign(this.model, values);
|
||||
let obj;
|
||||
that.confirmLoading = true
|
||||
values.dictName = (values.dictName || '').trim()
|
||||
values.dictCode = (values.dictCode || '').trim()
|
||||
values.description = (values.description || '').trim()
|
||||
let formData = Object.assign(this.model, values)
|
||||
let obj
|
||||
console.log(formData)
|
||||
if (!this.model.id) {
|
||||
formData.delFlag = "1";
|
||||
obj = addDict(formData);
|
||||
formData.delFlag = '1'
|
||||
obj = addDict(formData)
|
||||
} else {
|
||||
obj = editDict(formData);
|
||||
obj = editDict(formData)
|
||||
}
|
||||
obj.then((res) => {
|
||||
if (res.success) {
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
that.$message.success(res.message)
|
||||
that.$emit('ok')
|
||||
} else {
|
||||
that.$message.warning(res.message);
|
||||
that.$message.warning(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.close();
|
||||
that.confirmLoading = false
|
||||
that.close()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 关闭
|
||||
handleCancel() {
|
||||
this.close();
|
||||
this.close()
|
||||
},
|
||||
close() {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
this.$emit('close')
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -113,6 +113,11 @@
|
||||
},
|
||||
validateToNextPassword (rule, value, callback) {
|
||||
const form = this.form;
|
||||
const confirmpassword=form.getFieldValue('confirmpassword');
|
||||
console.log("confirmpassword==>",confirmpassword);
|
||||
if (value && confirmpassword && value !== confirmpassword) {
|
||||
callback('两次输入的密码不一样!');
|
||||
}
|
||||
if (value && this.confirmDirty) {
|
||||
form.validateFields(['confirm'], { force: true })
|
||||
}
|
||||
@ -130,7 +135,6 @@
|
||||
const value = e.target.value
|
||||
this.confirmDirty = this.confirmDirty || !!value
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -36,12 +36,23 @@
|
||||
label="规则值">
|
||||
<a-input placeholder="请输入规则值" v-decorator="['ruleValue', validatorRules.ruleValue]"/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="状态">
|
||||
<a-radio-group buttonStyle="solid" v-decorator="['status',{initialValue:'1'}]">
|
||||
<a-radio-button value="1">有效</a-radio-button>
|
||||
<a-radio-button value="0">无效</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
<script>
|
||||
import {httpAction, getAction} from '@/api/manage'
|
||||
import { httpAction } from '@/api/manage'
|
||||
import pick from 'lodash.pick'
|
||||
|
||||
export default {
|
||||
@ -96,7 +107,7 @@
|
||||
this.visible = true
|
||||
this.initRuleCondition()
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'ruleName', 'ruleColumn', 'ruleConditions', 'ruleValue'))
|
||||
this.form.setFieldsValue(pick(this.model, 'status','ruleName', 'ruleColumn', 'ruleConditions', 'ruleValue'))
|
||||
})
|
||||
},
|
||||
close() {
|
||||
@ -119,6 +130,12 @@
|
||||
method = 'put'
|
||||
}
|
||||
let formData = Object.assign(this.model, values)
|
||||
if(formData.ruleColumn && formData.ruleColumn.length>0){
|
||||
formData.ruleColumn = formData.ruleColumn.trim()
|
||||
}
|
||||
if(formData.ruleValue && formData.ruleValue.length>0){
|
||||
formData.ruleValue = formData.ruleValue.trim()
|
||||
}
|
||||
httpAction(httpurl, formData, method).then((res) => {
|
||||
if (res.success) {
|
||||
that.$message.success(res.message)
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
<a-radio-group @change="onChangeMenuType" v-decorator="['menuType',{'initialValue':0}]">
|
||||
<a-radio :value="0">一级菜单</a-radio>
|
||||
<a-radio :value="1">子菜单</a-radio>
|
||||
<a-radio :value="2">按钮/数据权限</a-radio>
|
||||
<a-radio :value="2">按钮/权限</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
|
||||
@ -74,6 +74,24 @@
|
||||
<a-input placeholder="多个用逗号分隔, 如: user:list,user:create" v-decorator="[ 'perms', {}]" :readOnly="disableSubmit"/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
v-show="!show"
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="授权策略">
|
||||
<j-dict-select-tag v-decorator="['permsType', {}]" placeholder="请选择授权策略" :type="'radio'" :triggerChange="true" dictCode="global_perms_type"/>
|
||||
|
||||
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
v-show="!show"
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="状态">
|
||||
<j-dict-select-tag v-decorator="['status', {}]" placeholder="请选择状态" :type="'radio'" :triggerChange="true" dictCode="valid_status"/>
|
||||
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
v-show="show"
|
||||
:labelCol="labelCol"
|
||||
@ -136,6 +154,7 @@
|
||||
import {addPermission,editPermission,queryTreeList} from '@/api/api'
|
||||
import Icons from './icon/Icons'
|
||||
import pick from 'lodash.pick'
|
||||
import { initDictOptions } from '@/components/dict/JDictSelectUtil'
|
||||
|
||||
export default {
|
||||
name: "PermissionModal",
|
||||
@ -168,12 +187,14 @@
|
||||
form: this.$form.createForm(this),
|
||||
validatorRules:{
|
||||
name:{rules: [{ required: true, message: '请输入菜单标题!' }]},
|
||||
permsType:{rules: [{ required: true, message: '请输入授权策略!' }]},
|
||||
sortNo:{rules: [{validator: this.validateNumber}]},
|
||||
},
|
||||
iconChooseVisible: false,
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.initDictConfig();
|
||||
},
|
||||
methods: {
|
||||
loadTree(){
|
||||
@ -193,7 +214,7 @@
|
||||
});
|
||||
},
|
||||
add () {
|
||||
this.edit();
|
||||
this.edit({status:'1',permsType:'1'});
|
||||
},
|
||||
edit (record) {
|
||||
this.resetScreenSize(); // 调用此方法,根据屏幕宽度自适应调整抽屉的宽度
|
||||
@ -224,12 +245,13 @@
|
||||
}
|
||||
this.show = true;
|
||||
this.menuLabel = '菜单名称';
|
||||
this.routeSwitch = true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
this.visible = true;
|
||||
this.loadTree();
|
||||
let fieldsVal = pick(this.model,'name','perms','component','url','sortNo','menuType');
|
||||
let fieldsVal = pick(this.model,'name','perms','permsType','component','url','sortNo','menuType','status');
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(fieldsVal)
|
||||
});
|
||||
@ -312,6 +334,8 @@
|
||||
this.drawerWidth = 700;
|
||||
}
|
||||
},
|
||||
initDictConfig() {
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<a-drawer
|
||||
title="数据规则/按钮权限配置"
|
||||
width=365
|
||||
width="365"
|
||||
:closable="false"
|
||||
@close="onClose"
|
||||
:visible="visible"
|
||||
@ -75,8 +75,7 @@
|
||||
},
|
||||
saveDataruleForRole(){
|
||||
if(!this.dataruleChecked || this.dataruleChecked.length==0){
|
||||
this.$message.warning("请现勾选数据权限然后保存!")
|
||||
return false;
|
||||
this.$message.warning("请注意,现未勾选任何数据权限!")
|
||||
}
|
||||
let params = {
|
||||
permissionId:this.functionId,
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import {addRole,editRole,checkRoleCode } from '@/api/api'
|
||||
import {addRole,editRole,duplicateCheck } from '@/api/api'
|
||||
|
||||
export default {
|
||||
name: "RoleModal",
|
||||
@ -133,14 +133,16 @@
|
||||
callback("角色编码不可输入汉字!");
|
||||
}else{
|
||||
var params = {
|
||||
id:this.model.id,
|
||||
roleCode:value
|
||||
tableName: "sys_role",
|
||||
fieldName: "role_code",
|
||||
fieldVal: value,
|
||||
dataId: this.model.id,
|
||||
};
|
||||
checkRoleCode(params).then((res)=>{
|
||||
duplicateCheck(params).then((res)=>{
|
||||
if(res.success){
|
||||
callback();
|
||||
}else{
|
||||
callback("角色编码已存在!");
|
||||
callback(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -0,0 +1,266 @@
|
||||
<template>
|
||||
<a-modal
|
||||
:title="title"
|
||||
:width="1200"
|
||||
:visible="visible"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline">
|
||||
<a-row :gutter="24">
|
||||
|
||||
<a-col :span="6">
|
||||
<a-form-item label="账号">
|
||||
<a-input placeholder="请输入账号查询" v-model="queryParam.username"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="6">
|
||||
<a-form-item label="性别">
|
||||
<a-select v-model="queryParam.sex" placeholder="请选择性别查询">
|
||||
<a-select-option value="">请选择性别查询</a-select-option>
|
||||
<a-select-option value="1">男性</a-select-option>
|
||||
<a-select-option value="2">女性</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
|
||||
<template v-if="toggleSearchStatus">
|
||||
<a-col :span="6">
|
||||
<a-form-item label="邮箱">
|
||||
<a-input placeholder="请输入邮箱查询" v-model="queryParam.email"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="6">
|
||||
<a-form-item label="手机号码">
|
||||
<a-input placeholder="请输入手机号码查询" v-model="queryParam.phone"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="6">
|
||||
<a-form-item label="状态">
|
||||
<a-select v-model="queryParam.status" placeholder="请选择用户状态查询">
|
||||
<a-select-option value="">请选择用户状态</a-select-option>
|
||||
<a-select-option value="1">正常</a-select-option>
|
||||
<a-select-option value="2">解冻</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</template>
|
||||
|
||||
<a-col :span="6" >
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchByquery" icon="search">查询</a-button>
|
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="handleToggleSearch" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||
</a>
|
||||
</span>
|
||||
</a-col>
|
||||
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
@change="handleTableChange"
|
||||
>
|
||||
|
||||
</a-table>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { filterObj } from '@/utils/util';
|
||||
|
||||
import { getUserList } from '@/api/api'
|
||||
|
||||
export default {
|
||||
name: "SelectUserListModal",
|
||||
components: {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
title:"选择用户",
|
||||
queryParam: {},
|
||||
columns: [{
|
||||
title: '用户账号',
|
||||
align:"center",
|
||||
dataIndex: 'username',
|
||||
fixed:'left',
|
||||
width:200
|
||||
},{
|
||||
title: '真实姓名',
|
||||
align:"center",
|
||||
dataIndex: 'realname',
|
||||
},{
|
||||
title: '性别',
|
||||
align:"center",
|
||||
dataIndex: 'sex',
|
||||
customRender:function (text) {
|
||||
if(text==1){
|
||||
return "男";
|
||||
}else if(text==2){
|
||||
return "女";
|
||||
}else{
|
||||
return text;
|
||||
}
|
||||
}
|
||||
},{
|
||||
title: '手机号码',
|
||||
align:"center",
|
||||
dataIndex: 'phone'
|
||||
},{
|
||||
title: '邮箱',
|
||||
align:"center",
|
||||
dataIndex: 'email'
|
||||
},{
|
||||
title: '状态',
|
||||
align:"center",
|
||||
dataIndex: 'status',
|
||||
customRender:function (text) {
|
||||
if(text==1){
|
||||
return "正常";
|
||||
}else if(text==2){
|
||||
return "冻结";
|
||||
}else{
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}],
|
||||
dataSource:[],
|
||||
ipagination:{
|
||||
current: 1,
|
||||
pageSize: 5,
|
||||
pageSizeOptions: ['5', '10', '20'],
|
||||
showTotal: (total, range) => {
|
||||
return range[0] + "-" + range[1] + " 共" + total + "条"
|
||||
},
|
||||
showQuickJumper: true,
|
||||
showSizeChanger: true,
|
||||
total: 0
|
||||
},
|
||||
isorter:{
|
||||
column: 'createTime',
|
||||
order: 'desc',
|
||||
},
|
||||
selectedRowKeys: [],
|
||||
selectionRows: [],
|
||||
visible:false,
|
||||
toggleSearchStatus:false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadData();
|
||||
},
|
||||
methods: {
|
||||
add (selectUser,userIds) {
|
||||
this.visible = true;
|
||||
this.edit(selectUser,userIds);
|
||||
},
|
||||
edit(selectUser,userIds){
|
||||
this.selectionRows = selectUser;
|
||||
this.selectedRowKeys = userIds.split(',');
|
||||
},
|
||||
loadData (arg){
|
||||
if(arg===1){
|
||||
this.ipagination.current = 1;
|
||||
}
|
||||
let params = this.getQueryParams();//查询条件
|
||||
getUserList(params).then((res)=>{
|
||||
if(res.success){
|
||||
this.dataSource = res.result.records;
|
||||
this.ipagination.total = res.result.total;
|
||||
}
|
||||
})
|
||||
},
|
||||
getQueryParams(){
|
||||
let param = Object.assign({}, this.queryParam,this.isorter);
|
||||
param.field = this.getQueryField();
|
||||
param.current = this.ipagination.current;
|
||||
param.pageSize = this.ipagination.pageSize;
|
||||
return filterObj(param);
|
||||
},
|
||||
getQueryField(){
|
||||
let str = "id,";
|
||||
for(let a = 0;a<this.columns.length;a++){
|
||||
str+=","+this.columns[a].dataIndex;
|
||||
}
|
||||
return str;
|
||||
},
|
||||
onSelectChange (selectedRowKeys,selectionRows) {
|
||||
this.selectedRowKeys = selectedRowKeys;
|
||||
console.log(this.selectedRowKeys);
|
||||
this.selectionRows = selectionRows;
|
||||
},
|
||||
searchReset(){
|
||||
let that = this;
|
||||
Object.keys(that.queryParam).forEach(function(key){
|
||||
that.queryParam[key] = '';
|
||||
});
|
||||
that.loadData(1);
|
||||
},
|
||||
handleTableChange(pagination, filters, sorter){
|
||||
//TODO 筛选
|
||||
if (Object.keys(sorter).length>0){
|
||||
this.isorter.column = sorter.field;
|
||||
this.isorter.order = "ascend"==sorter.order?"asc":"desc"
|
||||
}
|
||||
this.ipagination = pagination;
|
||||
this.loadData();
|
||||
},
|
||||
handleCancel () {
|
||||
this.selectionRows = [];
|
||||
this.selectedRowKeys = [];
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
this.$emit("choseUser",this.selectionRows);
|
||||
this.handleCancel();
|
||||
},
|
||||
searchByquery(){
|
||||
this.loadData(1);
|
||||
},
|
||||
searchReset(){
|
||||
let that = this;
|
||||
Object.keys(that.queryParam).forEach(function(key){
|
||||
that.queryParam[key] = '';
|
||||
});
|
||||
that.loadData(1);
|
||||
},
|
||||
handleToggleSearch(){
|
||||
this.toggleSearchStatus = !this.toggleSearchStatus;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.ant-card-body .table-operator{
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.ant-table-tbody .ant-table-row td{
|
||||
padding-top:15px;
|
||||
padding-bottom:15px;
|
||||
}
|
||||
.anty-row-operator button{margin: 0 5px}
|
||||
.ant-btn-danger{background-color: #ffffff}
|
||||
|
||||
.ant-modal-cust-warp{height: 100%}
|
||||
.ant-modal-cust-warp .ant-modal-body{height:calc(100% - 110px) !important;overflow-y: auto}
|
||||
.ant-modal-cust-warp .ant-modal-content{height:90% !important;overflow-y: hidden}
|
||||
|
||||
.anty-img-wrap{height:25px;position: relative;}
|
||||
.anty-img-wrap > img{max-height:100%;}
|
||||
</style>
|
||||
@ -0,0 +1,275 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-modal
|
||||
centered
|
||||
:title="title"
|
||||
:width="1000"
|
||||
:visible="visible"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
|
||||
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline">
|
||||
<a-row :gutter="24">
|
||||
|
||||
<a-col :span="10">
|
||||
<a-form-item label="姓名">
|
||||
<a-input placeholder="请输入姓名" v-model="queryParam.username"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||
</span>
|
||||
</a-col>
|
||||
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!-- table区域-begin -->
|
||||
<div>
|
||||
<a-table
|
||||
size="small"
|
||||
bordered
|
||||
rowKey="id"
|
||||
:columns="columns1"
|
||||
:dataSource="dataSource1"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:scroll="{ y: 240 }"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys,onSelectAll:onSelectAll,onSelect:onSelect,onChange: onSelectChange}"
|
||||
@change="handleTableChange">
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
<!-- table区域-end -->
|
||||
|
||||
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {filterObj} from '@/utils/util'
|
||||
import {getAction} from '@/api/manage'
|
||||
|
||||
export default {
|
||||
name: "SelectUserModal",
|
||||
data() {
|
||||
return {
|
||||
title: "添加已有用户",
|
||||
names: [],
|
||||
visible: false,
|
||||
placement: 'right',
|
||||
description: '',
|
||||
// 查询条件
|
||||
queryParam: {},
|
||||
// 表头
|
||||
columns1: [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key: 'rowIndex',
|
||||
width: 50,
|
||||
align: "center",
|
||||
customRender: function (t, r, index) {
|
||||
return parseInt(index) + 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '用户账号',
|
||||
align: "center",
|
||||
width: 113,
|
||||
dataIndex: 'username'
|
||||
},
|
||||
{
|
||||
title: '用户名称',
|
||||
align: "center",
|
||||
width: 100,
|
||||
dataIndex: 'realname'
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
align: "center",
|
||||
width: 100,
|
||||
dataIndex: 'status'
|
||||
}
|
||||
],
|
||||
columns2: [
|
||||
{
|
||||
title: '用户账号',
|
||||
align: "center",
|
||||
dataIndex: 'username',
|
||||
|
||||
},
|
||||
{
|
||||
title: '用户名称',
|
||||
align: "center",
|
||||
dataIndex: 'realname',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: "center",
|
||||
width: 100,
|
||||
scopedSlots: {customRender: 'action'},
|
||||
}
|
||||
],
|
||||
//数据集
|
||||
dataSource1: [],
|
||||
dataSource2: [],
|
||||
// 分页参数
|
||||
ipagination: {
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
pageSizeOptions: ['10', '20', '30'],
|
||||
showTotal: (total, range) => {
|
||||
return range[0] + "-" + range[1] + " 共" + total + "条"
|
||||
},
|
||||
showQuickJumper: true,
|
||||
showSizeChanger: true,
|
||||
total: 0
|
||||
},
|
||||
isorter: {
|
||||
column: 'createTime',
|
||||
order: 'desc',
|
||||
},
|
||||
loading: false,
|
||||
selectedRowKeys: [],
|
||||
selectedRows: [],
|
||||
url: {
|
||||
list: "/sys/user/list",
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadData();
|
||||
},
|
||||
methods: {
|
||||
searchQuery() {
|
||||
this.loadData(1);
|
||||
},
|
||||
searchReset() {
|
||||
this.queryParam = {};
|
||||
this.loadData(1);
|
||||
},
|
||||
handleCancel() {
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk() {
|
||||
this.dataSource2 = this.selectedRowKeys;
|
||||
console.log("data:" + this.dataSource2);
|
||||
this.$emit("selectFinished", this.dataSource2);
|
||||
this.visible = false;
|
||||
},
|
||||
add() {
|
||||
this.visible = true;
|
||||
},
|
||||
loadData(arg) {
|
||||
//加载数据 若传入参数1则加载第一页的内容
|
||||
if (arg === 1) {
|
||||
this.ipagination.current = 1;
|
||||
}
|
||||
var params = this.getQueryParams();//查询条件
|
||||
getAction(this.url.list, params).then((res) => {
|
||||
if (res.success) {
|
||||
this.dataSource1 = res.result.records;
|
||||
this.ipagination.total = res.result.total;
|
||||
}
|
||||
})
|
||||
},
|
||||
getQueryParams() {
|
||||
var param = Object.assign({}, this.queryParam, this.isorter);
|
||||
param.field = this.getQueryField();
|
||||
param.pageNo = this.ipagination.current;
|
||||
param.pageSize = this.ipagination.pageSize;
|
||||
return filterObj(param);
|
||||
},
|
||||
getQueryField() {
|
||||
//TODO 字段权限控制
|
||||
},
|
||||
onSelectAll(selected, selectedRows, changeRows) {
|
||||
if (selected === true) {
|
||||
for (var a = 0; a < changeRows.length; a++) {
|
||||
this.dataSource2.push(changeRows[a]);
|
||||
}
|
||||
} else {
|
||||
for (var b = 0; b < changeRows.length; b++) {
|
||||
this.dataSource2.splice(this.dataSource2.indexOf(changeRows[b]), 1);
|
||||
}
|
||||
}
|
||||
// console.log(selected, selectedRows, changeRows);
|
||||
},
|
||||
onSelect(record, selected) {
|
||||
if (selected === true) {
|
||||
this.dataSource2.push(record);
|
||||
} else {
|
||||
var index = this.dataSource2.indexOf(record);
|
||||
//console.log();
|
||||
if (index >= 0) {
|
||||
this.dataSource2.splice(this.dataSource2.indexOf(record), 1);
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
onSelectChange(selectedRowKeys, selectedRows) {
|
||||
this.selectedRowKeys = selectedRowKeys;
|
||||
this.selectionRows = selectedRows;
|
||||
},
|
||||
onClearSelected() {
|
||||
this.selectedRowKeys = [];
|
||||
this.selectionRows = [];
|
||||
},
|
||||
handleDelete: function (record) {
|
||||
this.dataSource2.splice(this.dataSource2.indexOf(record), 1);
|
||||
},
|
||||
handleTableChange(pagination, filters, sorter) {
|
||||
//分页、排序、筛选变化时触发
|
||||
console.log(sorter);
|
||||
//TODO 筛选
|
||||
if (Object.keys(sorter).length > 0) {
|
||||
this.isorter.column = sorter.field;
|
||||
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
|
||||
}
|
||||
this.ipagination = pagination;
|
||||
this.loadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.ant-card-body .table-operator {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.ant-table-tbody .ant-table-row td {
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.anty-row-operator button {
|
||||
margin: 0 5px
|
||||
}
|
||||
|
||||
.ant-btn-danger {
|
||||
background-color: #ffffff
|
||||
}
|
||||
|
||||
.ant-modal-cust-warp {
|
||||
height: 100%
|
||||
}
|
||||
|
||||
.ant-modal-cust-warp .ant-modal-body {
|
||||
height: calc(100% - 110px) !important;
|
||||
overflow-y: auto
|
||||
}
|
||||
|
||||
.ant-modal-cust-warp .ant-modal-content {
|
||||
height: 90% !important;
|
||||
overflow-y: hidden
|
||||
}
|
||||
</style>
|
||||
@ -6,6 +6,7 @@
|
||||
:confirmLoading="confirmLoading"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
:okButtonProps="{ props: {disabled: disabled} }"
|
||||
cancelText="关闭">
|
||||
|
||||
<a-spin :spinning="confirmLoading">
|
||||
@ -17,6 +18,18 @@
|
||||
label="标题">
|
||||
<a-input placeholder="请输入标题" v-decorator="['titile', validatorRules.title]" :readOnly="disableSubmit" />
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="消息类型">
|
||||
<a-select
|
||||
v-decorator="[ 'msgCategory', validatorRules.msgCategory]"
|
||||
placeholder="请选择消息类型"
|
||||
:disabled="disableSubmit">
|
||||
<a-select-option value="1">通知公告</a-select-option>
|
||||
<a-select-option value="2">系统消息</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
@ -54,7 +67,7 @@
|
||||
:wrapperCol="wrapperCol"
|
||||
label="通告对象类型">
|
||||
<a-select
|
||||
v-decorator="[ 'msgType', {}]"
|
||||
v-decorator="[ 'msgType', validatorRules.msgType]"
|
||||
placeholder="请选择通告对象类型"
|
||||
:disabled="disableSubmit"
|
||||
@change="chooseMsgType">
|
||||
@ -67,24 +80,17 @@
|
||||
:wrapperCol="wrapperCol"
|
||||
label="指定用户"
|
||||
v-if="userType">
|
||||
<a-input placeholder="请选择用户" v-decorator="['userIds',{}]" @click="selectUserIds" disabled="true" />
|
||||
<a-select
|
||||
mode="multiple"
|
||||
style="width: 100%"
|
||||
placeholder="请选择用户"
|
||||
v-model="selectedUser"
|
||||
@dropdownVisibleChange="selectUserIds">
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<!--<a-modal
|
||||
:title="用户选择"
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
@ok="handleSubmit"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭"
|
||||
wrapClassName="ant-modal-cust-warp"
|
||||
style="top:5%;height: 95%;overflow-y: hidden" ref="modelSelectUser"
|
||||
>
|
||||
123
|
||||
|
||||
</a-modal>-->
|
||||
</a-form>
|
||||
</a-spin>
|
||||
<select-user-list-modal ref="UserListModal" @choseUser="choseUser"></select-user-list-modal>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
@ -92,8 +98,12 @@
|
||||
import { httpAction } from '@/api/manage'
|
||||
import pick from 'lodash.pick'
|
||||
import moment from "moment"
|
||||
import { getAction } from '@/api/manage'
|
||||
import JDate from '@/components/jeecg/JDate'
|
||||
import SelectUserListModal from "./SelectUserListModal";
|
||||
|
||||
export default {
|
||||
components: {SelectUserListModal},
|
||||
name: "SysAnnouncementModal",
|
||||
data () {
|
||||
return {
|
||||
@ -114,14 +124,19 @@
|
||||
form: this.$form.createForm(this),
|
||||
validatorRules:{
|
||||
title:{rules: [{ required: true, message: '请输入标题!' }]},
|
||||
msgCategory:{rules: [{ required: true, message: '请选择消息类型!' }]},
|
||||
msgType:{rules: [{ required: true, message: '请选择通告对象类型!' }]},
|
||||
},
|
||||
url: {
|
||||
queryByIds: "/sys/user/queryByIds",
|
||||
add: "/sys/annountCement/add",
|
||||
edit: "/sys/annountCement/edit",
|
||||
},
|
||||
userType:false,
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
userIds:[],
|
||||
selectedUser:[],
|
||||
disabled:false,
|
||||
msgContent:"",
|
||||
}
|
||||
},
|
||||
created () {
|
||||
@ -132,18 +147,38 @@
|
||||
},
|
||||
edit (record) {
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, record);
|
||||
this.disable = false;
|
||||
this.visible = true;
|
||||
this.getUser(record);
|
||||
},
|
||||
getUser(record){
|
||||
this.model = Object.assign({}, record);
|
||||
//this.model.msgContent.replace("<br/>","\n");
|
||||
console.log(this.model.msgContent);
|
||||
// 指定用户
|
||||
if(record&&record.msgType === "USER"){
|
||||
this.userType = true;
|
||||
this.userIds = record.userIds;
|
||||
getAction(this.url.queryByIds,{userIds:this.userIds}).then((res)=>{
|
||||
if(res.success){
|
||||
for(var i=0;i<res.result.length;i++){
|
||||
this.selectedUser.push(res.result[i].realname);
|
||||
}
|
||||
this.$refs.UserListModal.edit(res.result,this.userIds);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model,'titile','msgContent','priority','msgType'))
|
||||
//时间格式化
|
||||
this.form.setFieldsValue(pick(this.model,'titile','msgContent','sender','priority','msgCategory','msgType','sendStatus','delFlag'))
|
||||
this.form.setFieldsValue({startTime:this.model.startTime?moment(this.model.startTime):null})
|
||||
this.form.setFieldsValue({endTime:this.model.endTime?moment(this.model.endTime):null})
|
||||
this.form.setFieldsValue({sendTime:this.model.sendTime?moment(this.model.sendTime):null})
|
||||
this.form.setFieldsValue({cancelTime:this.model.cancelTime?moment(this.model.cancelTime):null})
|
||||
});
|
||||
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.selectedUser = [];
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
@ -162,6 +197,9 @@
|
||||
method = 'put';
|
||||
}
|
||||
let formData = Object.assign(this.model, values);
|
||||
if(this.userType){
|
||||
formData.userIds = this.userIds;
|
||||
}
|
||||
//时间格式化
|
||||
formData.startTime = formData.startTime?formData.startTime.format('YYYY-MM-DD HH:mm:ss'):null;
|
||||
formData.endTime = formData.endTime?formData.endTime.format('YYYY-MM-DD HH:mm:ss'):null;
|
||||
@ -185,18 +223,37 @@
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
this.visible = false;
|
||||
this.$emit('close');
|
||||
this.resetUser();
|
||||
},
|
||||
resetUser (){
|
||||
this.userType = false;
|
||||
this.userIds = [];
|
||||
this.selectedUser = [];
|
||||
this.disabled = false;
|
||||
this.$refs.UserListModal.edit(null,null);
|
||||
},
|
||||
selectUserIds() {
|
||||
this.$refs.UserListModal.add(this.selectedUser,this.userIds);
|
||||
},
|
||||
chooseMsgType(value) {
|
||||
if("USER" == value) {
|
||||
this.userType = true;
|
||||
} else {
|
||||
this.userType = false;
|
||||
this.selectedUser = [];
|
||||
this.userIds = [];
|
||||
}
|
||||
},
|
||||
selectUserIds() {
|
||||
console.log(1);
|
||||
this.$refs.modalSelectUser.show();
|
||||
// 子modal回调
|
||||
choseUser:function(userList){
|
||||
this.selectedUser = [];
|
||||
this.userIds = [];
|
||||
for(var i=0;i<userList.length;i++){
|
||||
this.selectedUser.push(userList[i].realname);
|
||||
this.userIds += userList[i].id+","
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,194 @@
|
||||
<template>
|
||||
<a-modal
|
||||
:title="title"
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
: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="['userName', {}]" readOnly="true"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="代理人用户名">
|
||||
<a-input-search
|
||||
placeholder="请输入代理人用户名"
|
||||
v-decorator="['agentUserName', validatorRules.agentUserName]"
|
||||
readOnly="true"
|
||||
@search="onSearchDepUser"
|
||||
size="large">
|
||||
<a-button slot="enterButton">选择用户</a-button>
|
||||
</a-input-search>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="代理开始时间">
|
||||
<a-date-picker showTime format='YYYY-MM-DD HH:mm:ss' v-decorator="[ 'startTime', validatorRules.startTime]" />
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="代理结束时间">
|
||||
<a-date-picker showTime format='YYYY-MM-DD HH:mm:ss' v-decorator="[ 'endTime', validatorRules.endTime]" />
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
label="状态">
|
||||
<a-radio-group class="fontiframe" name="radioGroup" v-decorator="[ 'status', {}]">
|
||||
<a-radio class="radioGroup" value="1">有效</a-radio>
|
||||
<a-radio class="radioGroup" value="0">无效</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
|
||||
</a-form>
|
||||
|
||||
<!-- 通过部门筛选,选择人 -->
|
||||
<j-search-user-by-dep ref="JSearchUserByDep" @ok="onSearchDepUserCallBack"></j-search-user-by-dep>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { httpAction, getAction } from '@/api/manage'
|
||||
import pick from 'lodash.pick'
|
||||
import moment from "moment"
|
||||
import JSearchUserByDep from '@/components/jeecgbiz/JSearchUserByDep'
|
||||
|
||||
export default {
|
||||
name: "SysUserAgentModal",
|
||||
components: {
|
||||
JSearchUserByDep
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
title:"操作",
|
||||
visible: false,
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
username:"",
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
validatorRules:{
|
||||
agentUserName:{rules: [{ required: true, message: '请输入代理人用户名!' }]},
|
||||
startTime:{rules: [{ required: true, message: '请输入代理开始时间!' }]},
|
||||
endTime:{rules: [{ required: true, message: '请输入代理结束时间!' }]},
|
||||
},
|
||||
url: {
|
||||
add: "/system/sysUserAgent/add",
|
||||
edit: "/system/sysUserAgent/edit",
|
||||
queryByUserName:"/system/sysUserAgent/queryByUserName",
|
||||
},
|
||||
}
|
||||
},
|
||||
created () {
|
||||
},
|
||||
methods: {
|
||||
agentSettings(username){
|
||||
this.username = username;
|
||||
this.init();
|
||||
|
||||
},
|
||||
init () {
|
||||
var params = {userName:this.username};//查询条件
|
||||
getAction(this.url.queryByUserName,params).then((res)=>{
|
||||
if(res.success){
|
||||
console.log("获取流程节点信息",res);
|
||||
this.edit (res.result);
|
||||
}else{
|
||||
this.edit({userName:this.username,status:"0"});
|
||||
}
|
||||
})
|
||||
},
|
||||
edit (record) {
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model,'userName','agentUserName','status'))
|
||||
//时间格式化
|
||||
this.form.setFieldsValue({startTime:this.model.startTime?moment(this.model.startTime):null})
|
||||
this.form.setFieldsValue({endTime:this.model.endTime?moment(this.model.endTime):null})
|
||||
});
|
||||
|
||||
},
|
||||
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);
|
||||
//时间格式化
|
||||
formData.startTime = formData.startTime?formData.startTime.format('YYYY-MM-DD HH:mm:ss'):null;
|
||||
formData.endTime = formData.endTime?formData.endTime.format('YYYY-MM-DD HH:mm:ss'):null;
|
||||
|
||||
console.log(formData)
|
||||
httpAction(httpurl,formData,method).then((res)=>{
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
//this.init();
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.close();
|
||||
})
|
||||
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
//通过组织机构筛选选择用户
|
||||
onSearchDepUser() {
|
||||
this.$refs.JSearchUserByDep.showModal();
|
||||
this.$refs.JSearchUserByDep.title = '根据部门查询用户';
|
||||
this.$refs.JSearchUserByDep.type = 'radio'
|
||||
},
|
||||
onSearchDepUserCallBack(selectedDepUsers) {
|
||||
this.form.setFieldsValue({agentUserName:selectedDepUsers});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@ -39,7 +39,7 @@
|
||||
<a-form-item label="用户名字" :labelCol="labelCol" :wrapperCol="wrapperCol" >
|
||||
<a-input placeholder="请输入用户名称" v-decorator="[ 'realname', validatorRules.realname]" />
|
||||
</a-form-item>
|
||||
|
||||
<template v-show="!roleDisabled">
|
||||
<a-form-item label="角色分配" :labelCol="labelCol" :wrapperCol="wrapperCol" >
|
||||
<a-select
|
||||
mode="multiple"
|
||||
@ -51,8 +51,10 @@
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</template>
|
||||
<!--部门分配-->
|
||||
<a-form-item label="部门分配" :labelCol="labelCol" :wrapperCol="wrapperCol" >
|
||||
<template v-show="!departDisabled">
|
||||
<a-form-item label="部门分配" :labelCol="labelCol" :wrapperCol="wrapperCol" >
|
||||
<a-input-search
|
||||
placeholder="点击右侧按钮选择部门"
|
||||
v-model="checkedDepartNameString"
|
||||
@ -61,7 +63,7 @@
|
||||
<a-button slot="enterButton" icon="search">选择</a-button>
|
||||
</a-input-search>
|
||||
</a-form-item>
|
||||
|
||||
</template>
|
||||
<a-form-item label="头像" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-upload
|
||||
listType="picture-card"
|
||||
@ -73,7 +75,7 @@
|
||||
:beforeUpload="beforeUpload"
|
||||
@change="handleChange"
|
||||
>
|
||||
<img v-if="model.avatar" :src="getAvatarView()" alt="头像" style="height:104px;max-width:300px"/>
|
||||
<img v-if="picUrl" :src="getAvatarView()" alt="头像" style="height:104px;max-width:300px"/>
|
||||
<div v-else>
|
||||
<a-icon :type="uploadLoading ? 'loading' : 'plus'" />
|
||||
<div class="ant-upload-text">上传</div>
|
||||
@ -100,7 +102,11 @@
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="手机号码" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input placeholder="请输入手机号码" v-decorator="[ 'phone', validatorRules.phone]" />
|
||||
<a-input placeholder="请输入手机号码" :disabled="disabledAuth('user:form:phone')" v-decorator="[ 'phone', validatorRules.phone]" />
|
||||
</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>
|
||||
|
||||
</a-form>
|
||||
@ -123,8 +129,10 @@
|
||||
// 引入搜索部门弹出框的组件
|
||||
import departWindow from './DepartWindow'
|
||||
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
||||
import { getAction, httpAction } from '@/api/manage'
|
||||
import { getAction, httpAction,putAction } from '@/api/manage'
|
||||
import {addUser,editUser,queryUserRole,queryall,checkUsername } from '@/api/api'
|
||||
import { disabledAuthFilter } from "@/utils/authFilter"
|
||||
|
||||
export default {
|
||||
name: "RoleModal",
|
||||
components: {
|
||||
@ -132,6 +140,10 @@
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
departDisabled: false, //是否是我的部门调用该页面
|
||||
deptId: '',
|
||||
roleDisabled: false, //是否是角色维护调用该页面
|
||||
roleId: '',
|
||||
modalWidth:800,
|
||||
drawerWidth:700,
|
||||
modaltoggleFlag:true,
|
||||
@ -170,7 +182,7 @@
|
||||
phone:{rules: [{validator: this.validatePhone}]},
|
||||
email:{rules: [{type: 'email', message: '请输入正确格式的电子邮箱!',}]},
|
||||
roles:{}
|
||||
// sex:{initialValue:((!this.model.sex)?"": (this.model.sex+""))}
|
||||
// sex:{initialValue:((!this.model.sex)?"": (this.model.sex+""))}
|
||||
},
|
||||
title:"操作",
|
||||
visible: false,
|
||||
@ -189,12 +201,15 @@
|
||||
confirmLoading: false,
|
||||
headers:{},
|
||||
form:this.$form.createForm(this),
|
||||
picUrl: "",
|
||||
url: {
|
||||
addUDepartIds:"/sys/user/addUDepartIds", // 引入为用户添加部门信息需要的url
|
||||
editUDepartIds:"/sys/user/editUDepartIds", // 引入为用户更新部门信息需要的url
|
||||
fileUpload: window._CONFIG['domianURL']+"/sys/common/upload",
|
||||
imgerver: window._CONFIG['domianURL']+"/sys/common/view",
|
||||
userWithDepart: "/sys/user/userDepartList", // 引入为指定用户查看部门信息需要的url
|
||||
userId:"/sys/user/generateUserId", // 引入生成添加用户情况下的url
|
||||
syncUserByUserName:"/process/extActProcess/doSyncUserByUserName",//同步用户到工作流
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -209,6 +224,9 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
disabledAuth(code){
|
||||
return disabledAuthFilter(code);
|
||||
},
|
||||
//窗口最大化切换
|
||||
toggleScreen(){
|
||||
if(this.modaltoggleFlag){
|
||||
@ -244,8 +262,9 @@
|
||||
this.userId=""
|
||||
},
|
||||
add () {
|
||||
this.picUrl = "";
|
||||
this.refresh()
|
||||
this.edit({});
|
||||
this.edit({activitiSync:'1'});
|
||||
},
|
||||
edit (record) {
|
||||
this.resetScreenSize(); // 调用此方法,根据屏幕宽度自适应调整抽屉的宽度
|
||||
@ -255,12 +274,13 @@
|
||||
that.form.resetFields();
|
||||
if(record.hasOwnProperty("id")){
|
||||
that.loadUserRoles(record.id);
|
||||
this.picUrl = "Has no pic url yet";
|
||||
}
|
||||
that.userId = record.id;
|
||||
that.visible = true;
|
||||
that.model = Object.assign({}, record);
|
||||
that.$nextTick(() => {
|
||||
that.form.setFieldsValue(pick(this.model,'username','sex','realname','email','phone'))
|
||||
that.form.setFieldsValue(pick(this.model,'username','sex','realname','email','phone','activitiSync'))
|
||||
});
|
||||
// 调用查询用户对应的部门信息的方法
|
||||
that.checkedDepartKeys = [];
|
||||
@ -292,6 +312,13 @@
|
||||
},
|
||||
moment,
|
||||
handleSubmit () {
|
||||
if(this.departDisabled===true){
|
||||
this.handleSubmitDepart();
|
||||
return
|
||||
}else if(this.roleDisabled===true){
|
||||
this.handleSubmitRole()
|
||||
return
|
||||
}
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
@ -319,6 +346,97 @@
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
//同步用户到工作流
|
||||
this.handleSyncUser(this.model.username);
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.checkedDepartNames = [];
|
||||
that.close();
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
// 提交表单(我的部门调用)
|
||||
handleSubmitDepart(){
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true;
|
||||
let avatar = that.model.avatar;
|
||||
if (!values.birthday) {
|
||||
values.birthday = '';
|
||||
} else {
|
||||
values.birthday = values.birthday.format(this.dateFormat);
|
||||
}
|
||||
let formData = Object.assign(this.model, values);
|
||||
formData.avatar = avatar;
|
||||
formData.selectedroles = this.roleId;
|
||||
|
||||
//生成userId
|
||||
getAction(this.url.userId).then((res) => {
|
||||
if (res.success) {
|
||||
this.userId = res.result;
|
||||
console.log("generateUserId:" + this.userId)
|
||||
formData.id = that.userId;
|
||||
console.log("formData.id:" + formData.id)
|
||||
this.addDepartsToUser1(that, formData); // 调用根据当前用户添加部门信息的方法
|
||||
addUser(formData).then((res) => {
|
||||
if (res.success) {
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
//同步用户到工作流
|
||||
this.handleSyncUser(this.model.username);
|
||||
} else {
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.checkedDepartNames = [];
|
||||
that.close();
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//提交表单(角色维护调用)
|
||||
handleSubmitRole(){
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true;
|
||||
let avatar = that.model.avatar;
|
||||
if(!values.birthday){
|
||||
values.birthday = '';
|
||||
}else{
|
||||
values.birthday = values.birthday.format(this.dateFormat);
|
||||
}
|
||||
let formData = Object.assign(this.model, values);
|
||||
formData.avatar = avatar;
|
||||
formData.selectedroles = this.selectedRole.length>0?this.selectedRole.join(","):'';
|
||||
if(this.roleId!=''){
|
||||
formData.selectedroles = this.roleId;
|
||||
}
|
||||
that.addDepartsToUser(that,formData); // 调用根据当前用户添加部门信息的方法
|
||||
let obj;
|
||||
if(!this.model.id){
|
||||
formData.id = this.userId;
|
||||
obj=addUser(formData);
|
||||
}else{
|
||||
obj=editUser(formData);
|
||||
}
|
||||
obj.then((res)=>{
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
//同步用户到工作流
|
||||
this.handleSyncUser(this.model.username);
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
@ -334,7 +452,6 @@
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
|
||||
// 根据当前用户添加部门信息的方法
|
||||
addDepartsToUser(that,formData){
|
||||
let httpurl = '';
|
||||
@ -354,8 +471,30 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
// 根据当前用户添加部门信息的方法(我的部门调用)
|
||||
addDepartsToUser1: function() {
|
||||
let httpurl = ''
|
||||
let method = ''
|
||||
httpurl += this.url.addUDepartIds
|
||||
method = 'post';
|
||||
let departIdList = [];
|
||||
departIdList.push(this.deptId);
|
||||
httpAction(httpurl, { userId: this.userId, departIdList: departIdList }, method).then((res) => {
|
||||
if (res.success) {
|
||||
this.userId = ''
|
||||
this.deptId = ''
|
||||
this.departIdList = []
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
validateToNextPassword (rule, value, callback) {
|
||||
const form = this.form;
|
||||
const confirmpassword=form.getFieldValue('confirmpassword');
|
||||
if (value && confirmpassword && value !== confirmpassword) {
|
||||
callback('两次输入的密码不一样!');
|
||||
}
|
||||
if (value && this.confirmDirty) {
|
||||
form.validateFields(['confirm'], { force: true })
|
||||
}
|
||||
@ -410,6 +549,7 @@
|
||||
//TODO 验证文件大小
|
||||
},
|
||||
handleChange (info) {
|
||||
this.picUrl = "";
|
||||
if (info.file.status === 'uploading') {
|
||||
this.uploadLoading = true
|
||||
return
|
||||
@ -420,6 +560,7 @@
|
||||
console.log(response);
|
||||
if(response.success){
|
||||
this.model.avatar = response.message;
|
||||
this.picUrl = "Has no pic url yet";
|
||||
}else{
|
||||
this.$message.warning(response.message);
|
||||
}
|
||||
@ -455,6 +596,18 @@
|
||||
this.drawerWidth = 700;
|
||||
}
|
||||
},
|
||||
handleSyncUser(userName) {
|
||||
try{
|
||||
var that = this;
|
||||
putAction(that.url.syncUserByUserName, {userName:userName}).then((res) => {
|
||||
//if (res.success) {
|
||||
//that.$message.success(res.message);
|
||||
// } else {
|
||||
//that.$message.warning(res.message);
|
||||
//}
|
||||
})
|
||||
}catch (e){}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
@select="onTreeNodeSelect"
|
||||
:expandedKeys="expandedKeysss"
|
||||
:checkStrictly="checkStrictly">
|
||||
<span slot="hasDatarule" slot-scope="{slotTitle,icon}">
|
||||
{{ slotTitle }}<a-icon v-if="icon" type="align-left" style="margin-left:5px;color: red;"></a-icon>
|
||||
<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>
|
||||
@ -132,8 +132,9 @@
|
||||
handleSubmit(){
|
||||
let that = this;
|
||||
let params = {
|
||||
roleId:that.roleId,
|
||||
permissionIds:that.checkedKeys.join(","),
|
||||
roleId:that.roleId
|
||||
lastpermissionIds:that.defaultCheckedKeys.join(","),
|
||||
};
|
||||
that.loading = true;
|
||||
console.log("请求参数:",params);
|
||||
|
||||
Reference in New Issue
Block a user