From 49348bb0d49a8d74206eee90857a5194774c985e Mon Sep 17 00:00:00 2001
From: Alan <1124498879@qq.com>
Date: 星期二, 16 二月 2021 14:17:55 +0800
Subject: [PATCH] 岗位管理提交
---
src/views/febs/system/job/Index.vue | 271 ++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 192 insertions(+), 79 deletions(-)
diff --git a/src/views/febs/system/job/Index.vue b/src/views/febs/system/job/Index.vue
index 7c042be..372d613 100644
--- a/src/views/febs/system/job/Index.vue
+++ b/src/views/febs/system/job/Index.vue
@@ -1,81 +1,194 @@
-<template>
- <div>
- <el-button type="danger" @click="showXzgw">添加岗位</el-button>
- <el-button type="primary">删除岗位</el-button>
- <el-table :data="jobData" style="width: 100%">
- <el-table-column prop="prop0" label="" width="180" />
- <el-table-column prop="prop1" label="序号" width="180" />
- <el-table-column prop="prop2" label="岗位名称" width="180" />
- <el-table-column prop="prop3" label="在岗人数" width="180" />
- </el-table>
-
- <el-dialog title="新增岗位" :visible.sync="dialogShowXzgw" width="50%">
- <el-form :model="baseicInformationForm" label-position="right" label-width="120px">
- <el-row>
- <el-col span="24">
- <el-form-item label="岗位名称">
- <el-input v-model="name" />
- </el-form-item>
- <el-form-item label="岗位描述">
- <el-input v-model="name" type="textarea" :rows="4" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogIsShow()">取 消</el-button>
- <el-button type="primary" @click="dialogIsShow()">确 定</el-button>
- </div>
-
- </el-dialog>
- </div>
-</template>
-
-<script>
-export default {
- data() {
+<template>
+ <div class="app-container">
+ <div class="filter-container">
+ <el-input v-model="queryParams.positionName" placeholder="岗位名称" class="filter-item search-item" />
+ <el-button class="filter-item" type="primary" @click="search">
+ {{ $t('table.search') }}
+ </el-button>
+ <el-button class="filter-item" type="success" @click="reset">
+ {{ $t('table.reset') }}
+ </el-button>
+ <el-dropdown v-has-any-permission="['position:add','position:delete']" trigger="click" class="filter-item">
+ <el-button>
+ {{ $t('table.more') }}<i class="el-icon-arrow-down el-icon--right" />
+ </el-button>
+ <el-dropdown-menu slot="dropdown">
+ <el-dropdown-item v-has-permission="['position:add']" @click.native="add">{{ $t('table.add') }}</el-dropdown-item>
+ </el-dropdown-menu>
+ </el-dropdown>
+ </div>
+ <el-table
+ ref="table"
+ :key="tableKey"
+ v-loading="loading"
+ :data="list"
+ border
+ fit
+ style="width: 100%;"
+ :highlight-current-row="true"
+ @selection-change="onSelectChange"
+ >
+ <el-table-column type="selection" align="center" width="40px" />
+ <el-table-column v-if="fsnumShow" label="" prop="positionId" :show-overflow-tooltip="false" align="center" />
+ <el-table-column label="岗位名称" prop="positionName" :show-overflow-tooltip="true" align="center" min-width="100px" />
+ <el-table-column label="岗位编码" prop="positionCode" :show-overflow-tooltip="true" align="center" />
+ <el-table-column label="创建时间" prop="createTime" :show-overflow-tooltip="true" align="center" min-width="170px" />
+ <el-table-column label="创建人" prop="creator" :show-overflow-tooltip="true" align="center" min-width="160px" />
+ <el-table-column :label="$t('table.operation')" align="center" min-width="150px" class-name="small-padding fixed-width" fixed="right">
+ <template slot-scope="{row}">
+ <i v-hasPermission="['position:update']" class="el-icon-setting table-operation" style="color: #2db7f5;" @click="edit(row)" />
+ <i v-hasPermission="['position:delete']" class="el-icon-delete table-operation" style="color: #f50;" @click="singleDelete(row)" />
+ <el-link v-has-no-permission="['position:update','position:delete']" class="no-perm">
+ {{ $t('tips.noPermission') }}
+ </el-link>
+ </template>
+ </el-table-column>
+ </el-table>
+ <pagination v-show="total>0" :total="total" :page.sync="pagination.num" :limit.sync="pagination.size" @pagination="search" />
+ <client-edit
+ ref="edit"
+ :dialog-visible="dialog.isVisible"
+ :title="dialog.title"
+ :type="dialog.type"
+ @close="editClose"
+ @success="editSuccess"
+ />
+ </div>
+</template>
+<script>
+import Pagination from '@/components/Pagination'
+import ClientEdit from './PositionEdit'
+
+export default {
+ name: 'ClientManage',
+ components: { Pagination, ClientEdit },
+ filters: {
+ approveFilter(status) {
+ const map = {
+ 1: 'success',
+ 0: 'danger'
+ }
+ return map[status]
+ }
+ },
+ data() {
return {
- dialogShowXzgw: false,
- jobData: [{
- 'prop0': '',
- 'prop1': '1',
- 'prop2': '市场部总监',
- 'prop3': '1'
- }, {
- 'prop0': '',
- 'prop1': '2',
- 'prop2': '市场部经理',
- 'prop3': '2'
- }, {
- 'prop0': '',
- 'prop1': '3',
- 'prop2': '高级客户经理',
- 'prop3': '5'
- }, {
- 'prop0': '',
- 'prop1': '4',
- 'prop2': '客户经理',
- 'prop3': '10'
- }, {
- 'prop0': '',
- 'prop1': '5',
- 'prop2': '销售内勤',
- 'prop3': '1'
- }, {
- 'prop0': '',
- 'prop1': '6',
- 'prop2': '销售助理',
- 'prop3': '1'
- }]
- }
- },
- methods: {
- showXzgw() {
- this.dialogShowXzgw = true
- }
- }
-}
-</script>
-
-<style>
+ fsnumShow: false,
+ dialog: {
+ isVisible: false,
+ title: '',
+ type: ''
+ },
+ tableKey: 0,
+ loading: false,
+ list: null,
+ total: 0,
+ queryParams: {},
+ selection: [],
+ pagination: {
+ size: 10,
+ num: 1
+ }
+ }
+ },
+ mounted() {
+ this.fetch()
+ },
+ methods: {
+ transApprove(v) {
+ switch (v) {
+ case 0:
+ return 'false'
+ case 1:
+ return 'true'
+ default:
+ return ''
+ }
+ },
+ editSuccess() {
+ this.search()
+ },
+ editClose() {
+ this.dialog.isVisible = false
+ },
+ onSelectChange(selection) {
+ this.selection = selection
+ },
+ add() {
+ this.dialog.title = this.$t('common.add')
+ this.dialog.isVisible = true
+ this.dialog.type = 'add'
+ },
+ edit(row) {
+ this.$refs.edit.setposition(row)
+ this.dialog.title = this.$t('common.edit')
+ this.dialog.isVisible = true
+ this.dialog.type = 'edit'
+ },
+ batchDelete() {
+ if (!this.selection.length) {
+ this.$message({
+ message: this.$t('tips.noDataSelected'),
+ type: 'warning'
+ })
+ return
+ }
+ this.$confirm(this.$t('tips.confirmDelete'), this.$t('common.tips'), {
+ confirmButtonText: this.$t('common.confirm'),
+ cancelButtonText: this.$t('common.cancel'),
+ type: 'warning'
+ }).then(() => {
+ const positionId = []
+ this.selection.forEach((c) => {
+ positionId.push(c.positionId)
+ })
+ this.delete(positionId)
+ }).catch(() => {
+ this.clearSelections()
+ })
+ },
+ singleDelete(row) {
+ this.$refs.table.toggleRowSelection(row, true)
+ this.batchDelete()
+ },
+ delete(positionId) {
+ this.loading = true
+ this.$delete(`system/position`, { positionId }).then(() => {
+ this.$message({
+ message: this.$t('tips.deleteSuccess'),
+ type: 'success'
+ })
+ this.search()
+ })
+ },
+ clearSelections() {
+ this.$refs.table.clearSelection()
+ },
+ search() {
+ this.fetch({
+ ...this.queryParams
+ })
+ },
+ reset() {
+ this.queryParams = {}
+ this.search()
+ },
+
+ fetch(params = {}) {
+ params.pageSize = this.pagination.size
+ params.pageNum = this.pagination.num
+ this.loading = true
+ this.$get('system/position', {
+ ...params
+ }).then((r) => {
+ const data = r.data.data
+ this.total = data.total
+ this.list = data.rows
+ this.loading = false
+ })
+ }
+ }
+}
+</script>
+<style lang="scss" scoped>
</style>
--
Gitblit v1.8.0