【modify】使用ESLint格式化代码
This commit is contained in:
@@ -58,8 +58,6 @@
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
@change="handleTableChange">
|
||||
|
||||
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
|
||||
@@ -84,7 +82,6 @@
|
||||
</a-dropdown>
|
||||
</span>
|
||||
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
<!-- table区域-end -->
|
||||
@@ -96,216 +93,214 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {JeroListMixin} from '@/mixins/JeroListMixin'
|
||||
import {getAction, postAction, deleteAction} from '@/api/manage'
|
||||
import SelectUserModal from './SelectUserModal'
|
||||
import UserModal from './UserModal'
|
||||
import { JeroListMixin } from '@/mixins/JeroListMixin'
|
||||
import { getAction, postAction, deleteAction } from '@/api/manage'
|
||||
import SelectUserModal from './SelectUserModal'
|
||||
import UserModal from './UserModal'
|
||||
|
||||
export default {
|
||||
name: "DeptUserInfo",
|
||||
mixins: [JeroListMixin],
|
||||
components: {
|
||||
SelectUserModal,
|
||||
UserModal
|
||||
export default {
|
||||
name: 'DeptUserInfo',
|
||||
mixins: [JeroListMixin],
|
||||
components: {
|
||||
SelectUserModal,
|
||||
UserModal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
description: '用户信息',
|
||||
currentDeptId: '',
|
||||
currentDept: {},
|
||||
// 表头
|
||||
columns: [{
|
||||
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: 150
|
||||
}],
|
||||
url: {
|
||||
list: '/sys/user/departUserList',
|
||||
edit: '/sys/user/editSysDepartWithUser',
|
||||
delete: '/sys/user/deleteUserInDepart',
|
||||
deleteBatch: '/sys/user/deleteUserInDepartBatch'
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
},
|
||||
|
||||
methods: {
|
||||
searchReset () {
|
||||
this.queryParam = {}
|
||||
this.loadData(1)
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
description: '用户信息',
|
||||
currentDeptId: '',
|
||||
currentDept: {},
|
||||
// 表头
|
||||
columns: [{
|
||||
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: 150
|
||||
}],
|
||||
url: {
|
||||
list: "/sys/user/departUserList",
|
||||
edit: "/sys/user/editSysDepartWithUser",
|
||||
delete: "/sys/user/deleteUserInDepart",
|
||||
deleteBatch: "/sys/user/deleteUserInDepartBatch",
|
||||
loadData (arg) {
|
||||
if (!this.url.list) {
|
||||
this.$message.error('请设置url.list属性!')
|
||||
return
|
||||
}
|
||||
// 加载数据 若传入参数1则加载第一页的内容
|
||||
if (arg === 1) {
|
||||
this.ipagination.current = 1
|
||||
}
|
||||
// if (this.currentDeptId === '') return;
|
||||
const params = this.getQueryParams()// 查询条件
|
||||
params.depId = this.currentDeptId
|
||||
getAction(this.url.list, params).then((res) => {
|
||||
if (res.success && res.result) {
|
||||
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.currentDeptId) {
|
||||
this.$message.error('未选中任何部门,无法取消部门与用户的关联!')
|
||||
return
|
||||
}
|
||||
|
||||
if (this.selectedRowKeys.length <= 0) {
|
||||
this.$message.warning('请选择一条记录!')
|
||||
} 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('删除用户与选中部门关系成功!')
|
||||
that.loadData()
|
||||
that.onClearSelected()
|
||||
} else {
|
||||
that.$message.warning(res.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
handleDelete: function (id) {
|
||||
if (!this.url.delete) {
|
||||
this.$message.error('请设置url.delete属性!')
|
||||
return
|
||||
}
|
||||
if (!this.currentDeptId) {
|
||||
this.$message.error('未选中任何部门,无法取消部门与用户的关联!')
|
||||
return
|
||||
}
|
||||
|
||||
var that = this
|
||||
deleteAction(that.url.delete, { depId: this.currentDeptId, userId: id }).then((res) => {
|
||||
if (res.success) {
|
||||
that.$message.success('删除用户与选中部门关系成功!')
|
||||
if (this.selectedRowKeys.length > 0) {
|
||||
for (let i = 0; i < this.selectedRowKeys.length; i++) {
|
||||
if (this.selectedRowKeys[i] == id) {
|
||||
this.selectedRowKeys.splice(i, 1)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
that.loadData()
|
||||
} else {
|
||||
that.$message.warning(res.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
searchReset() {
|
||||
this.queryParam = {}
|
||||
this.loadData(1);
|
||||
},
|
||||
loadData(arg) {
|
||||
if (!this.url.list) {
|
||||
this.$message.error("请设置url.list属性!")
|
||||
return
|
||||
}
|
||||
//加载数据 若传入参数1则加载第一页的内容
|
||||
if (arg === 1) {
|
||||
this.ipagination.current = 1;
|
||||
}
|
||||
//if (this.currentDeptId === '') return;
|
||||
let params = this.getQueryParams();//查询条件
|
||||
params.depId = this.currentDeptId;
|
||||
getAction(this.url.list, params).then((res) => {
|
||||
if (res.success && res.result) {
|
||||
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.currentDeptId) {
|
||||
this.$message.error("未选中任何部门,无法取消部门与用户的关联!")
|
||||
return
|
||||
}
|
||||
|
||||
if (this.selectedRowKeys.length <= 0) {
|
||||
this.$message.warning('请选择一条记录!');
|
||||
return;
|
||||
open (record) {
|
||||
this.currentDeptId = record.id
|
||||
this.currentDept = record
|
||||
this.loadData(1)
|
||||
},
|
||||
clearList () {
|
||||
this.currentDeptId = ''
|
||||
this.dataSource = []
|
||||
},
|
||||
hasSelectDept () {
|
||||
if (this.currentDeptId == '') {
|
||||
this.$message.error('请选择一个部门!')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
handleAddUserDepart () {
|
||||
if (this.currentDeptId == '') {
|
||||
this.$message.error('请选择一个部门!')
|
||||
} else {
|
||||
this.$refs.selectUserModal.visible = true
|
||||
}
|
||||
},
|
||||
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('请选择一个部门!')
|
||||
} else {
|
||||
this.$refs.modalForm.departDisabled = true
|
||||
// 初始化负责部门
|
||||
this.$refs.modalForm.nextDepartOptions = [{ value: this.currentDept.key, label: this.currentDept.title }]
|
||||
this.$refs.modalForm.title = '新增'
|
||||
this.$refs.modalForm.edit({ activitiSync: '1', userIdentity: 1, selecteddeparts: this.currentDeptId })
|
||||
}
|
||||
},
|
||||
selectOK (data) {
|
||||
const 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 {
|
||||
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("删除用户与选中部门关系成功!");
|
||||
that.loadData();
|
||||
that.onClearSelected();
|
||||
} else {
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
},
|
||||
handleDelete: function (id) {
|
||||
if (!this.url.delete) {
|
||||
this.$message.error("请设置url.delete属性!")
|
||||
return
|
||||
}
|
||||
if (!this.currentDeptId) {
|
||||
this.$message.error("未选中任何部门,无法取消部门与用户的关联!")
|
||||
return
|
||||
}
|
||||
|
||||
var that = this;
|
||||
deleteAction(that.url.delete, {depId: this.currentDeptId, userId: id}).then((res) => {
|
||||
if (res.success) {
|
||||
that.$message.success("删除用户与选中部门关系成功!");
|
||||
if (this.selectedRowKeys.length>0){
|
||||
for(let i =0; i<this.selectedRowKeys.length;i++){
|
||||
if (this.selectedRowKeys[i] == id){
|
||||
this.selectedRowKeys.splice(i,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
that.loadData();
|
||||
} else {
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
open(record) {
|
||||
this.currentDeptId = record.id;
|
||||
this.currentDept = record;
|
||||
this.loadData(1);
|
||||
},
|
||||
clearList() {
|
||||
this.currentDeptId = '';
|
||||
this.dataSource = [];
|
||||
},
|
||||
hasSelectDept() {
|
||||
if (this.currentDeptId == '') {
|
||||
this.$message.error("请选择一个部门!")
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
handleAddUserDepart() {
|
||||
if (this.currentDeptId == '' ) {
|
||||
this.$message.error("请选择一个部门!")
|
||||
} else {
|
||||
this.$refs.selectUserModal.visible = true;
|
||||
}
|
||||
},
|
||||
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("请选择一个部门!")
|
||||
} else {
|
||||
this.$refs.modalForm.departDisabled = true;
|
||||
//初始化负责部门
|
||||
this.$refs.modalForm.nextDepartOptions=[{value:this.currentDept.key,label:this.currentDept.title}]
|
||||
this.$refs.modalForm.title = "新增";
|
||||
this.$refs.modalForm.edit({activitiSync:'1',userIdentity:1,selecteddeparts:this.currentDeptId})
|
||||
}
|
||||
},
|
||||
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按钮间距 */
|
||||
@@ -323,4 +318,4 @@
|
||||
margin-top: -16px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user