县级部门管理
This commit is contained in:
parent
3f8b911945
commit
46baaf6c55
|
@ -3,7 +3,8 @@ ENV = 'development'
|
||||||
|
|
||||||
# base api
|
# base api
|
||||||
#VUE_APP_BASE_API = '/dev-api'
|
#VUE_APP_BASE_API = '/dev-api'
|
||||||
VUE_APP_BASE_API = 'http://app.rt.xianci.info/'
|
#VUE_APP_BASE_API = 'http://app.rt.xianci.info/'
|
||||||
|
VUE_APP_BASE_API = 'http://office.xianci.info:18904/'
|
||||||
#VUE_APP_BASE_API = 'http://api.rt.myntv.cn/'
|
#VUE_APP_BASE_API = 'http://api.rt.myntv.cn/'
|
||||||
|
|
||||||
# base url
|
# base url
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function list(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/convenience/dept/list',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function add(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/convenience/dept/add',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(params) {
|
||||||
|
return request({
|
||||||
|
url: '/api/convenience/dept',
|
||||||
|
method: 'DELETE',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateStaffIds(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/convenience/dept/updateStaffIds',
|
||||||
|
method: 'PUT',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getStaffListByDeptId(params) {
|
||||||
|
return request({
|
||||||
|
url: '/api/convenience/dept/getStaffListByDeptId',
|
||||||
|
method: 'GET',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
|
@ -330,6 +330,43 @@ export const asyncRoutes = [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/dept",
|
||||||
|
component: Layout,
|
||||||
|
name: "Dept",
|
||||||
|
redirect: "/dept/list",
|
||||||
|
meta: {
|
||||||
|
title: "县级部门管理",
|
||||||
|
icon: "townRanking",
|
||||||
|
roles: ["SSS"]
|
||||||
|
},
|
||||||
|
hidden: false,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "list",
|
||||||
|
component: () => import("@/views/dept/list"),
|
||||||
|
name: "DeptList",
|
||||||
|
meta: {
|
||||||
|
title: "部门列表",
|
||||||
|
icon: "townRanking",
|
||||||
|
affix: true,
|
||||||
|
parentTitle: "县级部门管理"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "staff",
|
||||||
|
component: () => import("@/views/dept/staff"),
|
||||||
|
name: "DeptStaff",
|
||||||
|
meta: {
|
||||||
|
title: "人员列表",
|
||||||
|
icon: "townRanking",
|
||||||
|
affix: true,
|
||||||
|
parentTitle: "县级部门管理"
|
||||||
|
},
|
||||||
|
hidden: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
// {
|
// {
|
||||||
// path: '/permission',
|
// path: '/permission',
|
||||||
// component: Layout,
|
// component: Layout,
|
||||||
|
|
|
@ -0,0 +1,217 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="mini"
|
||||||
|
style="margin-bottom:20px"
|
||||||
|
@click="handleAdd()"
|
||||||
|
>新增部门</el-button>
|
||||||
|
<el-table :data="list" border style="width: 100%">
|
||||||
|
|
||||||
|
<el-table-column label="部门名称" prop="name" />
|
||||||
|
<el-table-column label="部门名称(藏语)" prop="nameZ" />
|
||||||
|
|
||||||
|
<el-table-column label="创建时间">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{
|
||||||
|
scope.row.createDate | parseTime("{y}-{m}-{d} {h}:{i}:{s}")
|
||||||
|
}}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="最后更新时间">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{
|
||||||
|
scope.row.lastUpdateDate | parseTime("{y}-{m}-{d} {h}:{i}:{s}")
|
||||||
|
}}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="操作" fixed="right" align="center" width="280px">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
round
|
||||||
|
style="font-size:14px;padding:10px 20px"
|
||||||
|
@click="jumpStaff(scope.row)"
|
||||||
|
>人员管理</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
round
|
||||||
|
style="font-size:14px;padding:10px 20px"
|
||||||
|
@click="handleAdd(scope.row)"
|
||||||
|
>编辑</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="danger"
|
||||||
|
round
|
||||||
|
style="font-size:14px;padding:10px 20px"
|
||||||
|
@click="handleDel(scope.row)"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-if="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="listQuery.lastPageIndex"
|
||||||
|
:limit.sync="listQuery.size"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
class="dialog"
|
||||||
|
:title="diaTitle"
|
||||||
|
append-to-body
|
||||||
|
center
|
||||||
|
width="434px"
|
||||||
|
:visible.sync="diaVisible"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
:close="closeDia"
|
||||||
|
>
|
||||||
|
<div class="preview-container">
|
||||||
|
<el-form
|
||||||
|
ref="form"
|
||||||
|
label-position="top"
|
||||||
|
:rules="rules"
|
||||||
|
:model="form"
|
||||||
|
>
|
||||||
|
<el-form-item label="部门名称" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="form.name"
|
||||||
|
placeholder="请输入"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="部门名称(藏语)" prop="nameZ">
|
||||||
|
<el-input
|
||||||
|
v-model="form.nameZ"
|
||||||
|
placeholder="请输入"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="default" @click="closeDia">取消</el-button>
|
||||||
|
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Pagination from '@/components/Pagination'
|
||||||
|
import { list, add, del } from '@/api/dept'
|
||||||
|
export default {
|
||||||
|
components: { Pagination },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
total: 0,
|
||||||
|
listQuery: {
|
||||||
|
lastPageIndex: 1,
|
||||||
|
// params: {},
|
||||||
|
size: 10
|
||||||
|
},
|
||||||
|
list: undefined,
|
||||||
|
|
||||||
|
diaTitle: '',
|
||||||
|
diaVisible: false,
|
||||||
|
form: {
|
||||||
|
name: undefined,
|
||||||
|
nameZ: undefined
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
name: [{ required: true, message: '请输入', trigger: 'change' }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'listQuery.lastPageIndex': {
|
||||||
|
handler(val) {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
deep: true // true 深度监听
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
list(this.listQuery).then(res => {
|
||||||
|
// console.log(res);
|
||||||
|
this.list = res.d.records
|
||||||
|
this.total = res.d.total
|
||||||
|
this.pageSize = res.d.pageSize
|
||||||
|
// if (!res.d.lastPageIndex) {
|
||||||
|
// this.listQuery.lastPageIndex;
|
||||||
|
// }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleAdd(item) {
|
||||||
|
if (item) {
|
||||||
|
this.diaTitle = '编辑部门'
|
||||||
|
this.form = JSON.parse(JSON.stringify(item))
|
||||||
|
} else {
|
||||||
|
this.diaTitle = '新增部门'
|
||||||
|
this.form = {
|
||||||
|
name: undefined,
|
||||||
|
nameZ: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const formEl = this.$refs['form']
|
||||||
|
if (formEl) formEl.clearValidate()
|
||||||
|
this.diaVisible = true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
submitForm() {
|
||||||
|
this.$refs['form'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
add(this.form).then(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: '操作成功!'
|
||||||
|
})
|
||||||
|
this.closeDia()
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDel(item) {
|
||||||
|
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
del({ id: item.id }).then(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: '删除成功!'
|
||||||
|
})
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
jumpStaff(item) {
|
||||||
|
const { name, id } = item
|
||||||
|
this.$router.push({
|
||||||
|
path: '/dept/staff',
|
||||||
|
query: {
|
||||||
|
name,
|
||||||
|
id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
closeDia() {
|
||||||
|
this.diaVisible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
|
@ -0,0 +1,235 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container" style="padding-top:0">
|
||||||
|
<!-- <div>{{ list }}</div> -->
|
||||||
|
<div class="filter-container">
|
||||||
|
<!-- <el-button v-if="list" id="te" type="warning" v-has="'editor'">abc</el-button> -->
|
||||||
|
|
||||||
|
<el-input
|
||||||
|
v-model="listQuery.params.name"
|
||||||
|
style="width:200px;margin-right:10px"
|
||||||
|
class="filter-item"
|
||||||
|
placeholder="姓名"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
<!-- <el-input
|
||||||
|
v-model="listQuery.params.nameZ"
|
||||||
|
style="width:200px;margin-right:10px"
|
||||||
|
class="filter-item"
|
||||||
|
placeholder="姓名(藏语)"
|
||||||
|
clearable
|
||||||
|
/> -->
|
||||||
|
<el-input
|
||||||
|
v-model="listQuery.params.phone"
|
||||||
|
style="width:200px;margin-right:10px"
|
||||||
|
class="filter-item"
|
||||||
|
placeholder="手机号"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
<el-input
|
||||||
|
v-model="listQuery.params.idCard"
|
||||||
|
style="width:200px;margin-right:10px"
|
||||||
|
class="filter-item"
|
||||||
|
placeholder="身份证号"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
<!-- isConvenience -->
|
||||||
|
|
||||||
|
<!-- <RegionSelect v-model="regionSearchVal" class="filter-item" /> -->
|
||||||
|
<!-- <el-cascader
|
||||||
|
v-model="regionSearchVal"
|
||||||
|
class="filter-item"
|
||||||
|
style="width:240px"
|
||||||
|
:options="regions"
|
||||||
|
:props="{ checkStrictly: true }"
|
||||||
|
placeholder="行政区域"
|
||||||
|
clearable
|
||||||
|
/> -->
|
||||||
|
|
||||||
|
<!-- <span style="margin-left:10px;margin-right:10px;"
|
||||||
|
>是否是便民工作人员</span
|
||||||
|
> -->
|
||||||
|
<!-- <el-checkbox
|
||||||
|
v-model="isStaff"
|
||||||
|
style="margin-left:10px"
|
||||||
|
@change="handleIsStaff"
|
||||||
|
>是否是便民工作人员</el-checkbox> -->
|
||||||
|
<!-- <el-switch
|
||||||
|
v-model="listQuery.params.isConvenience"
|
||||||
|
active-color="#13ce66"
|
||||||
|
inactive-color="#ff4949"
|
||||||
|
>
|
||||||
|
</el-switch> -->
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
style="margin-left:10px"
|
||||||
|
@click="handleSearch"
|
||||||
|
>搜索</el-button>
|
||||||
|
</div>
|
||||||
|
<!-- <el-button
|
||||||
|
type="primary"
|
||||||
|
size="mini"
|
||||||
|
style="font-size:12px;padding:10px 20px;margin-bottom:20px"
|
||||||
|
@click="handleAdd"
|
||||||
|
>新增</el-button> -->
|
||||||
|
<el-table v-loading="listLoading" :data="list" style="width: 100%" border>
|
||||||
|
<el-table-column prop="name" label="姓名">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.name }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="nameZ" label="姓名(藏语)">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.nameZ }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="phone" label="手机号">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.phone }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="phone" label="身份证号">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.idCard }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<!-- <el-table-column prop="phone" label="是否是便民工作人员" width="150">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.isConvenience ? "是" : "否" }}
|
||||||
|
</template>
|
||||||
|
</el-table-column> -->
|
||||||
|
|
||||||
|
<!-- <el-table-column prop="phone" label="所属行政区域">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{
|
||||||
|
scope.row.permanentResidenceRegion +
|
||||||
|
(scope.row.permanentResidenceTown
|
||||||
|
? "-" + scope.row.permanentResidenceTown
|
||||||
|
: "") +
|
||||||
|
(scope.row.permanentResidenceTownShip
|
||||||
|
? "-" + scope.row.permanentResidenceTownShip
|
||||||
|
: "")
|
||||||
|
}}
|
||||||
|
</template>
|
||||||
|
</el-table-column> -->
|
||||||
|
<el-table-column label="操作" width="300px" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
v-if="joinItems[scope.row.id]"
|
||||||
|
type="danger"
|
||||||
|
size="mini"
|
||||||
|
style="font-size:12px;padding:10px 20px;border-radius:21px"
|
||||||
|
@click="handleUpdate(scope.row, false)"
|
||||||
|
>移出</el-button>
|
||||||
|
<el-button
|
||||||
|
v-else
|
||||||
|
type="primary"
|
||||||
|
size="mini"
|
||||||
|
style="font-size:12px;padding:10px 20px"
|
||||||
|
@click="handleUpdate(scope.row, true)"
|
||||||
|
>添加</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-if="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="listQuery.lastPageIndex"
|
||||||
|
:limit.sync="listQuery.size"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getResidentInfoList } from '@/api/residentInformation'
|
||||||
|
import { updateStaffIds, getStaffListByDeptId } from '@/api/dept'
|
||||||
|
import Pagination from '@/components/Pagination'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { Pagination },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
pageId: '',
|
||||||
|
pageName: '',
|
||||||
|
|
||||||
|
listLoading: false,
|
||||||
|
total: 0,
|
||||||
|
listQuery: {
|
||||||
|
lastPageIndex: 1,
|
||||||
|
size: 20,
|
||||||
|
params: {
|
||||||
|
name: '',
|
||||||
|
phone: '',
|
||||||
|
idCard: '',
|
||||||
|
isConvenience: true,
|
||||||
|
// PermanentResidenceRegion: '壤塘县',
|
||||||
|
regionIds: '606fb5c63f4fd670fa8a9352'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
list: [],
|
||||||
|
|
||||||
|
joinItems: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async created() {
|
||||||
|
const { name, id } = this.$route.query
|
||||||
|
this.pageId = id
|
||||||
|
this.pageName = name
|
||||||
|
await this.getStaffList()
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
this.listLoading = true
|
||||||
|
getResidentInfoList(this.listQuery).then(res => {
|
||||||
|
this.list = res.d.list
|
||||||
|
this.total = res.d.total
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async getStaffList() {
|
||||||
|
const { d = [] } = await getStaffListByDeptId({ id: this.pageId })
|
||||||
|
this.joinItems = d.reduce((prev, curr) => {
|
||||||
|
prev[curr.id] = true
|
||||||
|
return prev
|
||||||
|
}, {})
|
||||||
|
},
|
||||||
|
handleUpdate(item, add) {
|
||||||
|
this.$confirm(`是否把 [${item.name}] ${add ? '添加到' : '移出'} [${this.pageName}] 部门`, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
updateStaffIds({
|
||||||
|
id: this.pageId,
|
||||||
|
updateParam: [
|
||||||
|
{
|
||||||
|
add,
|
||||||
|
staffId: item.id
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}).then(() => {
|
||||||
|
this.$set(this.joinItems, item.id, add)
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: '操作成功!'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleSearch() {
|
||||||
|
this.listQuery.lastPageIndex = 1
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
Loading…
Reference in New Issue