Merge branch 'develop' of https://gitee.com/siwa-team/dawa-vue into develop
This commit is contained in:
commit
2f2717bbd7
|
@ -9,7 +9,9 @@ const personApi = {
|
|||
quit: 'person/quit',
|
||||
resetPwd: 'person/resetPwd',
|
||||
setAdmin: 'person/setAdmin',
|
||||
changeLogPage: '/person/changeLog/pageList'
|
||||
changeLogPage: '/person/changeLog/pageList',
|
||||
exportList: '/person/exportList',
|
||||
importList: '/person/importList'
|
||||
}
|
||||
|
||||
export function personAddOrUpdate (params) {
|
||||
|
@ -75,3 +77,17 @@ export function personChangeLogPage (params) {
|
|||
params: params
|
||||
})
|
||||
}
|
||||
export function personExport (params) {
|
||||
return request({
|
||||
url: personApi.exportList,
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
export function personImport (params) {
|
||||
return request({
|
||||
url: personApi.importList,
|
||||
method: 'post',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
id: 'ueditor' + Math.random(),
|
||||
editorConfig: {
|
||||
UEDITOR_HOME_URL: '/static/plugins/ueditor/',
|
||||
serverUrl: '/api/sys/ueditor/config',
|
||||
serverUrl: '/dawa/sys/ueditor/config',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -44,7 +44,7 @@
|
|||
handler: function (config) {
|
||||
const defaults = {
|
||||
UEDITOR_HOME_URL: '/static/plugins/ueditor/',
|
||||
serverUrl: '/api/sys/ueditor/config',
|
||||
serverUrl: '/dawa/sys/ueditor/config',
|
||||
}
|
||||
this.editorConfig = { ...defaults, ...config }
|
||||
},
|
||||
|
|
|
@ -67,8 +67,8 @@
|
|||
data () {
|
||||
return {
|
||||
// 查询参数
|
||||
queryParam: { orgType: 1 },
|
||||
expandedRowKeys: [],
|
||||
orgType: 1,
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
|
@ -90,7 +90,7 @@
|
|||
],
|
||||
// 加载数据方法 必须为 Promise 对象
|
||||
loadData: parameter => {
|
||||
return orgList(Object.assign(parameter, this.queryParam)).then((res) => {
|
||||
return orgList(Object.assign(parameter, { orgType: this.orgType })).then((res) => {
|
||||
const orgList = listToTree(res.data, [], rootParentId)
|
||||
// 默认展开目录级
|
||||
orgList.forEach(item => {
|
||||
|
@ -114,11 +114,11 @@
|
|||
methods: {
|
||||
tabsCallback (key) {
|
||||
if (key === '1') {
|
||||
this.queryParam.orgType = 1
|
||||
this.orgType = 1
|
||||
this.$refs.table1.refresh(true)
|
||||
}
|
||||
if (key === '2') {
|
||||
this.queryParam.orgType = 2
|
||||
this.orgType = 2
|
||||
this.$refs.table2.refresh(true)
|
||||
}
|
||||
},
|
||||
|
@ -129,14 +129,23 @@
|
|||
orgDel({ id: record.id, deleteReason: '' }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success('删除成功')
|
||||
this.$refs.table.refresh(true)
|
||||
|
||||
if (this.orgType === 1) {
|
||||
this.$refs.table1.refresh(true)
|
||||
} else {
|
||||
this.$refs.table2.refresh(true)
|
||||
}
|
||||
} else {
|
||||
this.$message.error('删除失败:' + res.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
handleOk () {
|
||||
this.$refs.table.refresh()
|
||||
if (this.orgType === 1) {
|
||||
this.$refs.table1.refresh()
|
||||
} else {
|
||||
this.$refs.table2.refresh()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
:wrapperCol="wrapperCol"
|
||||
has-feedback
|
||||
>
|
||||
<a-input readOnly @click="openOrgTree" :disabled="registerDisabled" v-decorator="['orgName',{rules: [{ required: true, message: '请选择机构!' }]}]" />
|
||||
<a-input readOnly @click="openOrgTree" v-decorator="['orgName',{rules: [{ required: true, message: '请选择机构!' }]}]" />
|
||||
</a-form-item>
|
||||
<a-form-item style="display: none;">
|
||||
<a-input v-decorator="['orgId']" />
|
||||
|
@ -304,8 +304,8 @@
|
|||
// age: data.age,
|
||||
// sex: data.sex,
|
||||
phone: data.phone,
|
||||
jobs: parseInt(data.jobs),
|
||||
workType: parseInt(data.workType),
|
||||
jobs: data.jobs ? parseInt(data.jobs) : undefined,
|
||||
workType: data.workType ? parseInt(data.workType) : undefined,
|
||||
degreeId: data.degreeId,
|
||||
orgId: data.orgId,
|
||||
orgName: data.orgName
|
||||
|
|
|
@ -1,125 +1,137 @@
|
|||
<template>
|
||||
<a-row :gutter="24">
|
||||
<a-col :md="5" :sm="24">
|
||||
<a-card :bordered="false" :loading="treeLoading">
|
||||
<div v-if="this.orgTree != ''">
|
||||
<a-tree
|
||||
:treeData="orgTree"
|
||||
:onLoadData="orgTree"
|
||||
v-if="orgTree.length"
|
||||
@select="handleClick"
|
||||
:defaultExpandAll="true"
|
||||
:defaultExpandedKeys="defaultExpandedKeys"
|
||||
:defaultSelectedKeys="defaultSelectedKeys"
|
||||
:replaceFields="replaceFields" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<a-empty :image="simpleImage" />
|
||||
</div>
|
||||
|
||||
<a-button type="primary" @click="changeOrgType" style="display: block; margin: 10px auto;">
|
||||
{{ orgType === 1 ? '切换到项目组' : '切换到人员管理' }}
|
||||
</a-button>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :md="19" :sm="24">
|
||||
<a-card :bordered="false">
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline">
|
||||
<a-row :gutter="48">
|
||||
<a-col :md="8" :sm="24">
|
||||
<a-form-item label="姓名">
|
||||
<a-input v-model="queryParam.name" allow-clear placeholder="请输入姓名" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="8" :sm="24">
|
||||
<a-form-item label="用户名">
|
||||
<a-input v-model="queryParam.userName" allow-clear placeholder="请输入用户名" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="8" :sm="24">
|
||||
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
|
||||
<a-button style="margin-left: 8px" @click="() => {queryParam = {}, this.loadData()}">重置</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
</a-card>
|
||||
<a-card :bordered="false">
|
||||
<div class="table-operator">
|
||||
<a-button @click="addPerson" icon="plus" type="primary" v-if="hasPerm('person:add')">新增人员</a-button>
|
||||
|
||||
<template v-if="orgType === 1">
|
||||
<a-button @click="transfer" type="primary" v-if="hasPerm('person:transfer')">转移部门</a-button>
|
||||
<a-button @click="quit" type="primary" v-if="hasPerm('person:quit')">离职</a-button>
|
||||
<!-- <a-button @click="export" type="primary" >导出</a-button> -->
|
||||
<a-button @click="setAdmin" type="primary" v-if="hasPerm('person:setAdmin')">设置管理员</a-button>
|
||||
<!-- <a-button @click="import" type="primary" v-if="hasPerm('person:import')">批量导入</a-button> -->
|
||||
</template>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="table-operator">
|
||||
<div class="person-type">
|
||||
<a-radio-group v-model="queryParam.isAdmin" @change="onRadioChange">
|
||||
<a-radio :value="2">学员</a-radio>
|
||||
<a-radio :value="1">管理员</a-radio>
|
||||
</a-radio-group>
|
||||
<a-spin :spinning="spinning">
|
||||
<a-row :gutter="24" >
|
||||
<a-col :md="5" :sm="24">
|
||||
<a-card :bordered="false" :loading="treeLoading">
|
||||
<div v-if="this.orgTree != ''">
|
||||
<a-tree
|
||||
:treeData="orgTree"
|
||||
:onLoadData="orgTree"
|
||||
v-if="orgTree.length"
|
||||
@select="handleClick"
|
||||
:defaultExpandAll="true"
|
||||
:defaultExpandedKeys="defaultExpandedKeys"
|
||||
:defaultSelectedKeys="defaultSelectedKeys"
|
||||
:replaceFields="replaceFields" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<a-empty :image="simpleImage" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<s-table ref="table" :columns="columns" :data="loadData" :rowKey="(record) => record.id" :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
|
||||
<template slot="registerDate" slot-scope="text, record">
|
||||
{{ record.registerDate | moment('YYYY-MM-DD') }}
|
||||
</template>
|
||||
<a-button type="primary" @click="changeOrgType" style="display: block; margin: 10px auto;">
|
||||
{{ orgType === 1 ? '切换到项目组' : '切换到人员管理' }}
|
||||
</a-button>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :md="19" :sm="24">
|
||||
<a-card :bordered="false">
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline">
|
||||
<a-row :gutter="48">
|
||||
<a-col :md="8" :sm="24">
|
||||
<a-form-item label="姓名">
|
||||
<a-input v-model="queryParam.name" allow-clear placeholder="请输入姓名" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="8" :sm="24">
|
||||
<a-form-item label="用户名">
|
||||
<a-input v-model="queryParam.userName" allow-clear placeholder="请输入用户名" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="8" :sm="24">
|
||||
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
|
||||
<a-button style="margin-left: 8px" @click="() => {queryParam = {}, this.loadData()}">重置</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
</a-card>
|
||||
<a-card :bordered="false">
|
||||
<div class="table-operator">
|
||||
<a-button @click="addPerson" icon="plus" type="primary" v-if="hasPerm('person:add')">新增人员</a-button>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a v-if="hasPerm('person:detail')" @click="$refs.personDetail.detail(record)">详情</a>
|
||||
<a-divider type="vertical" v-if="hasPerm('person:detail')" />
|
||||
<a-dropdown v-if="hasPerm('person:edit') || hasPerm('person:resetPwd') || hasPerm('person:del')">
|
||||
<a class="ant-dropdown-link">
|
||||
更多
|
||||
<a-icon type="down" />
|
||||
</a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item v-if="hasPerm('person:edit')">
|
||||
<a @click="$refs.personForm.edit(record)">编辑</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-if="hasPerm('person:resetPwd')">
|
||||
<a-popconfirm placement="topRight" title="确认重置密码?" @confirm="() => resetPwd(record)">
|
||||
<a>重置密码</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-if="hasPerm('person:certificate:edit')">
|
||||
<a @click="addPersonCertificate(record)">添加证书</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-if="hasPerm('person:del')">
|
||||
<a-popconfirm placement="topRight" title="确认删除?" @confirm="() => personDelete(record)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
</s-table>
|
||||
<template v-if="orgType === 1">
|
||||
<a-button @click="transfer" type="primary" v-if="hasPerm('person:transfer')">转移部门</a-button>
|
||||
<a-button @click="quit" type="primary" v-if="hasPerm('person:quit')">离职</a-button>
|
||||
<a-button @click="setAdmin" type="primary" v-if="hasPerm('person:setAdmin')">设置管理员</a-button>
|
||||
<a-button @click="personExport" type="primary" v-if="hasPerm('person:export')">导出</a-button>
|
||||
<a-button @click="personBatch" type="primary" v-if="hasPerm('person:import')">批量导入</a-button>
|
||||
<input ref="inputFile" type="file" style="display: none" @change="personImport" />
|
||||
</template>
|
||||
|
||||
<person-form ref="personForm" @ok="handleOk" />
|
||||
<person-detail ref="personDetail" @ok="handleOk" />
|
||||
<org-tree @selectOrg="selectOrg($event)" ref="orgModal" />
|
||||
</div>
|
||||
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<div class="table-operator">
|
||||
<div class="person-type">
|
||||
<a-radio-group v-model="queryParam.isAdmin" @change="onRadioChange">
|
||||
<a-radio :value="2">学员</a-radio>
|
||||
<a-radio :value="1">管理员</a-radio>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<s-table ref="table" :columns="columns" :data="loadData" :rowKey="(record) => record.id" :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
|
||||
<template slot="registerDate" slot-scope="text, record">
|
||||
{{ record.registerDate | moment('YYYY-MM-DD') }}
|
||||
</template>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a v-if="hasPerm('person:detail')" @click="$refs.personDetail.detail(record)">详情</a>
|
||||
<a-divider type="vertical" v-if="hasPerm('person:detail')" />
|
||||
<a-dropdown v-if="hasPerm('person:edit') || hasPerm('person:resetPwd') || hasPerm('person:del')">
|
||||
<a class="ant-dropdown-link">
|
||||
更多
|
||||
<a-icon type="down" />
|
||||
</a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item v-if="hasPerm('person:edit')">
|
||||
<a @click="$refs.personForm.edit(record)">编辑</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-if="hasPerm('person:resetPwd')">
|
||||
<a-popconfirm placement="topRight" title="确认重置密码?" @confirm="() => resetPwd(record)">
|
||||
<a>重置密码</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-if="hasPerm('person:certificate:edit')">
|
||||
<a @click="addPersonCertificate(record)">添加证书</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-if="hasPerm('person:del')">
|
||||
<a-popconfirm placement="topRight" title="确认删除?" @confirm="() => personDelete(record)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
</s-table>
|
||||
|
||||
<person-form ref="personForm" @ok="handleOk" />
|
||||
<person-detail ref="personDetail" @ok="handleOk" />
|
||||
<org-tree @selectOrg="selectOrg($event)" ref="orgModal" />
|
||||
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-spin>
|
||||
</template>
|
||||
<script>
|
||||
import { STable } from '@/components'
|
||||
import { Empty } from 'ant-design-vue'
|
||||
import { orgList } from '@/api/org/org'
|
||||
import { listToTree } from '@/utils/util'
|
||||
import { personPage, personDel, personQuit, personTransferOrg, personSetAdmin, personResetPwd } from '@/api/person/person'
|
||||
import { personPage, personDel, personQuit, personTransferOrg, personSetAdmin, personResetPwd,
|
||||
personExport, personImport } from '@/api/person/person'
|
||||
import PersonForm from './PersonForm'
|
||||
import PersonDetail from './PersonDetail'
|
||||
import OrgTree from '../org/OrgTree'
|
||||
import { downloadExportFile } from '@/api/common/common'
|
||||
|
||||
import { ossUpload } from '@/api/sys/oss'
|
||||
|
||||
import axios from 'axios'
|
||||
import storage from 'store'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
|
||||
const rootParentId = 0
|
||||
|
||||
export default {
|
||||
|
@ -181,7 +193,8 @@ export default {
|
|||
value: 'id'
|
||||
},
|
||||
orgId: '',
|
||||
orgType: 1
|
||||
orgType: 1,
|
||||
spinning: false
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
|
@ -367,6 +380,49 @@ export default {
|
|||
})
|
||||
}
|
||||
},
|
||||
personExport () {
|
||||
personExport(this.queryParam).then(res => {
|
||||
downloadExportFile(res.data)
|
||||
})
|
||||
},
|
||||
// 批量导入
|
||||
personBatch () {
|
||||
this.$refs.inputFile.click()
|
||||
},
|
||||
personImport () {
|
||||
if (!this.$refs.inputFile.value || this.$refs.inputFile.value === '') return
|
||||
this.spinning = true
|
||||
const data = new FormData()
|
||||
data.append('file', this.$refs.inputFile.files[0])
|
||||
data.append('sourceId', 'personImport')
|
||||
data.append('fileType', 'excel')
|
||||
|
||||
const header = {}
|
||||
header['Content-Type'] = 'multipart/form-data'
|
||||
header[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN)
|
||||
|
||||
axios
|
||||
.post(ossUpload(), data, { headers: header })
|
||||
.then((res) => {
|
||||
this.$refs.inputFile.value = ''
|
||||
if (res.data.code === 200) {
|
||||
const params = { fileUrl: res.data.url, orgId: this.orgId }
|
||||
personImport(params).then((res1) => {
|
||||
this.$message.success('导入成功!')
|
||||
this.$refs.table.refresh()
|
||||
this.spinning = false
|
||||
})
|
||||
} else {
|
||||
this.$message.error(res.data.msg)
|
||||
this.spinning = false
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$refs.inputFile.value = ''
|
||||
this.$message.error(err)
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 点击左侧机构树查询列表
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue