Merge branch 'develop' of https://gitee.com/siwa-team/dawa-vue into develop

This commit is contained in:
18571350067 2021-12-30 10:09:56 +08:00
commit 2f2717bbd7
5 changed files with 201 additions and 120 deletions

View File

@ -9,7 +9,9 @@ const personApi = {
quit: 'person/quit', quit: 'person/quit',
resetPwd: 'person/resetPwd', resetPwd: 'person/resetPwd',
setAdmin: 'person/setAdmin', setAdmin: 'person/setAdmin',
changeLogPage: '/person/changeLog/pageList' changeLogPage: '/person/changeLog/pageList',
exportList: '/person/exportList',
importList: '/person/importList'
} }
export function personAddOrUpdate (params) { export function personAddOrUpdate (params) {
@ -75,3 +77,17 @@ export function personChangeLogPage (params) {
params: 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
})
}

View File

@ -15,7 +15,7 @@
id: 'ueditor' + Math.random(), id: 'ueditor' + Math.random(),
editorConfig: { editorConfig: {
UEDITOR_HOME_URL: '/static/plugins/ueditor/', UEDITOR_HOME_URL: '/static/plugins/ueditor/',
serverUrl: '/api/sys/ueditor/config', serverUrl: '/dawa/sys/ueditor/config',
}, },
} }
}, },
@ -44,7 +44,7 @@
handler: function (config) { handler: function (config) {
const defaults = { const defaults = {
UEDITOR_HOME_URL: '/static/plugins/ueditor/', UEDITOR_HOME_URL: '/static/plugins/ueditor/',
serverUrl: '/api/sys/ueditor/config', serverUrl: '/dawa/sys/ueditor/config',
} }
this.editorConfig = { ...defaults, ...config } this.editorConfig = { ...defaults, ...config }
}, },

View File

@ -67,8 +67,8 @@
data () { data () {
return { return {
// //
queryParam: { orgType: 1 },
expandedRowKeys: [], expandedRowKeys: [],
orgType: 1,
// //
columns: [ columns: [
{ {
@ -90,7 +90,7 @@
], ],
// Promise // Promise
loadData: parameter => { 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) const orgList = listToTree(res.data, [], rootParentId)
// //
orgList.forEach(item => { orgList.forEach(item => {
@ -114,11 +114,11 @@
methods: { methods: {
tabsCallback (key) { tabsCallback (key) {
if (key === '1') { if (key === '1') {
this.queryParam.orgType = 1 this.orgType = 1
this.$refs.table1.refresh(true) this.$refs.table1.refresh(true)
} }
if (key === '2') { if (key === '2') {
this.queryParam.orgType = 2 this.orgType = 2
this.$refs.table2.refresh(true) this.$refs.table2.refresh(true)
} }
}, },
@ -129,14 +129,23 @@
orgDel({ id: record.id, deleteReason: '' }).then((res) => { orgDel({ id: record.id, deleteReason: '' }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.$message.success('删除成功') this.$message.success('删除成功')
this.$refs.table.refresh(true)
if (this.orgType === 1) {
this.$refs.table1.refresh(true)
} else {
this.$refs.table2.refresh(true)
}
} else { } else {
this.$message.error('删除失败:' + res.msg) this.$message.error('删除失败:' + res.msg)
} }
}) })
}, },
handleOk () { handleOk () {
this.$refs.table.refresh() if (this.orgType === 1) {
this.$refs.table1.refresh()
} else {
this.$refs.table2.refresh()
}
} }
} }
} }

View File

@ -169,7 +169,7 @@
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
has-feedback 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>
<a-form-item style="display: none;"> <a-form-item style="display: none;">
<a-input v-decorator="['orgId']" /> <a-input v-decorator="['orgId']" />
@ -304,8 +304,8 @@
// age: data.age, // age: data.age,
// sex: data.sex, // sex: data.sex,
phone: data.phone, phone: data.phone,
jobs: parseInt(data.jobs), jobs: data.jobs ? parseInt(data.jobs) : undefined,
workType: parseInt(data.workType), workType: data.workType ? parseInt(data.workType) : undefined,
degreeId: data.degreeId, degreeId: data.degreeId,
orgId: data.orgId, orgId: data.orgId,
orgName: data.orgName orgName: data.orgName

View File

@ -1,5 +1,6 @@
<template> <template>
<a-row :gutter="24"> <a-spin :spinning="spinning">
<a-row :gutter="24" >
<a-col :md="5" :sm="24"> <a-col :md="5" :sm="24">
<a-card :bordered="false" :loading="treeLoading"> <a-card :bordered="false" :loading="treeLoading">
<div v-if="this.orgTree != ''"> <div v-if="this.orgTree != ''">
@ -52,9 +53,10 @@
<template v-if="orgType === 1"> <template v-if="orgType === 1">
<a-button @click="transfer" type="primary" v-if="hasPerm('person:transfer')">转移部门</a-button> <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="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="setAdmin" type="primary" v-if="hasPerm('person:setAdmin')">设置管理员</a-button>
<!-- <a-button @click="import" type="primary" v-if="hasPerm('person:import')">批量导入</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> </template>
</div> </div>
@ -110,16 +112,26 @@
</a-card> </a-card>
</a-col> </a-col>
</a-row> </a-row>
</a-spin>
</template> </template>
<script> <script>
import { STable } from '@/components' import { STable } from '@/components'
import { Empty } from 'ant-design-vue' import { Empty } from 'ant-design-vue'
import { orgList } from '@/api/org/org' import { orgList } from '@/api/org/org'
import { listToTree } from '@/utils/util' 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 PersonForm from './PersonForm'
import PersonDetail from './PersonDetail' import PersonDetail from './PersonDetail'
import OrgTree from '../org/OrgTree' 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 const rootParentId = 0
export default { export default {
@ -181,7 +193,8 @@ export default {
value: 'id' value: 'id'
}, },
orgId: '', orgId: '',
orgType: 1 orgType: 1,
spinning: false
} }
}, },
mounted () { 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)
})
},
/** /**
* 点击左侧机构树查询列表 * 点击左侧机构树查询列表
*/ */