|
@@ -1,311 +1,520 @@
|
|
<template>
|
|
<template>
|
|
- <div class="app-container">
|
|
|
|
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
|
- <el-form-item label="岗位编码" prop="postCode">
|
|
|
|
- <el-input
|
|
|
|
- v-model="queryParams.postCode"
|
|
|
|
- placeholder="请输入岗位编码"
|
|
|
|
- clearable
|
|
|
|
- size="small"
|
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
|
- />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="岗位名称" prop="postName">
|
|
|
|
- <el-input
|
|
|
|
- v-model="queryParams.postName"
|
|
|
|
- placeholder="请输入岗位名称"
|
|
|
|
- clearable
|
|
|
|
- size="small"
|
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
|
- />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="状态" prop="status">
|
|
|
|
- <el-select v-model="queryParams.status" placeholder="岗位状态" clearable size="small">
|
|
|
|
- <el-option
|
|
|
|
- v-for="dict in dict.type.sys_normal_disable"
|
|
|
|
- :key="dict.value"
|
|
|
|
- :label="dict.label"
|
|
|
|
- :value="dict.value"
|
|
|
|
- />
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item>
|
|
|
|
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
|
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
|
|
+ <div class="app-container">
|
|
|
|
+ <div class="item">
|
|
|
|
+ <div class="left_tag">
|
|
|
|
+ <div class="role border_role" :class="{ activeClass: over == 1 }" @click="getNature">性质</div>
|
|
|
|
+ <div class="role functional" :class="{ activeClass: over == 2 }" @click="getPostList">岗位</div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="right_add">
|
|
|
|
+ <el-button type="primary" icon="el-icon-plus" class="add_btn" @click="handleAddNature" v-show="natureShow">添加</el-button>
|
|
|
|
+ <el-button type="primary" icon="el-icon-plus" class="add_btn" @click="handleAddPost" v-show="postShow">添加</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- 性质列表 -->
|
|
|
|
+ <el-table
|
|
|
|
+ v-loading="loading"
|
|
|
|
+ :data="natureList"
|
|
|
|
+ :row-class-name="tableRowClassName"
|
|
|
|
+ :row-style="selectedstyle"
|
|
|
|
+ border
|
|
|
|
+ class="roleTable"
|
|
|
|
+ @row-click="natureLineClick"
|
|
|
|
+ @row-dblclick="natureLineDbclick"
|
|
|
|
+ v-show="natureShow"
|
|
|
|
+ >
|
|
|
|
+ <el-table-column label="性质" prop="natureName" width="198" />
|
|
|
|
+ <el-table-column label="描述" prop="remarks" width="416" />
|
|
|
|
+ <el-table-column label="操作" class-name="small-padding fixed-width">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-edit" v-hasPermi="['system:role:edit']" @click="handleUpdate(scope.row)">编辑</el-button>
|
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-delete-solid" v-hasPermi="['system:role:remove']" @click="handleDelete(scope.row)">删除</el-button>
|
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-top" @click="natureRise(scope.row)">上升</el-button>
|
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-bottom" @click="natureDecline(scope.row)">下降</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <!-- 岗位列表 -->
|
|
|
|
+ <el-table
|
|
|
|
+ v-loading="loading"
|
|
|
|
+ :data="postList"
|
|
|
|
+ border
|
|
|
|
+ :row-class-name="tableRowClassName"
|
|
|
|
+ :row-style="selectedstyle1"
|
|
|
|
+ class="roleTable"
|
|
|
|
+ @row-click="postLineClick"
|
|
|
|
+ v-show="postShow"
|
|
|
|
+ >
|
|
|
|
+ <el-table-column label="岗位" prop="postName" width="198" />
|
|
|
|
+ <el-table-column label="性质" width="102">
|
|
|
|
+ {{natureName}}
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="描述" prop="remark" width="231" />
|
|
|
|
+ <el-table-column label="操作" class-name="small-padding fixed-width">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-edit" @click="updataPost(scope.row)">编辑</el-button>
|
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-delete-solid" @click="deletePost(scope.row)">删除</el-button>
|
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-top" @click="postRise(scope.row)">上升</el-button>
|
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-bottom" @click="postDecline(scope.row)">下降</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <!-- <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> -->
|
|
|
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
|
- <el-col :span="1.5">
|
|
|
|
- <el-button
|
|
|
|
- type="primary"
|
|
|
|
- plain
|
|
|
|
- icon="el-icon-plus"
|
|
|
|
- size="mini"
|
|
|
|
- @click="handleAdd"
|
|
|
|
- v-hasPermi="['system:post:add']"
|
|
|
|
- >新增</el-button>
|
|
|
|
- </el-col>
|
|
|
|
- <el-col :span="1.5">
|
|
|
|
- <el-button
|
|
|
|
- type="success"
|
|
|
|
- plain
|
|
|
|
- icon="el-icon-edit"
|
|
|
|
- size="mini"
|
|
|
|
- :disabled="single"
|
|
|
|
- @click="handleUpdate"
|
|
|
|
- v-hasPermi="['system:post:edit']"
|
|
|
|
- >修改</el-button>
|
|
|
|
- </el-col>
|
|
|
|
- <el-col :span="1.5">
|
|
|
|
- <el-button
|
|
|
|
- type="danger"
|
|
|
|
- plain
|
|
|
|
- icon="el-icon-delete"
|
|
|
|
- size="mini"
|
|
|
|
- :disabled="multiple"
|
|
|
|
- @click="handleDelete"
|
|
|
|
- v-hasPermi="['system:post:remove']"
|
|
|
|
- >删除</el-button>
|
|
|
|
- </el-col>
|
|
|
|
- <el-col :span="1.5">
|
|
|
|
- <el-button
|
|
|
|
- type="warning"
|
|
|
|
- plain
|
|
|
|
- icon="el-icon-download"
|
|
|
|
- size="mini"
|
|
|
|
- @click="handleExport"
|
|
|
|
- v-hasPermi="['system:post:export']"
|
|
|
|
- >导出</el-button>
|
|
|
|
- </el-col>
|
|
|
|
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
- </el-row>
|
|
|
|
-
|
|
|
|
- <el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
|
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
|
- <el-table-column label="岗位编号" align="center" prop="postId" />
|
|
|
|
- <el-table-column label="岗位编码" align="center" prop="postCode" />
|
|
|
|
- <el-table-column label="岗位名称" align="center" prop="postName" />
|
|
|
|
- <el-table-column label="岗位排序" align="center" prop="postSort" />
|
|
|
|
- <el-table-column label="状态" align="center" prop="status">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <el-button
|
|
|
|
- size="mini"
|
|
|
|
- type="text"
|
|
|
|
- icon="el-icon-edit"
|
|
|
|
- @click="handleUpdate(scope.row)"
|
|
|
|
- v-hasPermi="['system:post:edit']"
|
|
|
|
- >修改</el-button>
|
|
|
|
- <el-button
|
|
|
|
- size="mini"
|
|
|
|
- type="text"
|
|
|
|
- icon="el-icon-delete"
|
|
|
|
- @click="handleDelete(scope.row)"
|
|
|
|
- v-hasPermi="['system:post:remove']"
|
|
|
|
- >删除</el-button>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
-
|
|
|
|
- <pagination
|
|
|
|
- v-show="total>0"
|
|
|
|
- :total="total"
|
|
|
|
- :page.sync="queryParams.pageNum"
|
|
|
|
- :limit.sync="queryParams.pageSize"
|
|
|
|
- @pagination="getList"
|
|
|
|
- />
|
|
|
|
-
|
|
|
|
- <!-- 添加或修改岗位对话框 -->
|
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
|
- <el-form-item label="岗位名称" prop="postName">
|
|
|
|
- <el-input v-model="form.postName" placeholder="请输入岗位名称" />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="岗位编码" prop="postCode">
|
|
|
|
- <el-input v-model="form.postCode" placeholder="请输入编码名称" />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="岗位顺序" prop="postSort">
|
|
|
|
- <el-input-number v-model="form.postSort" controls-position="right" :min="0" />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="岗位状态" prop="status">
|
|
|
|
- <el-radio-group v-model="form.status">
|
|
|
|
- <el-radio
|
|
|
|
- v-for="dict in dict.type.sys_normal_disable"
|
|
|
|
- :key="dict.value"
|
|
|
|
- :label="dict.value"
|
|
|
|
- >{{dict.label}}</el-radio>
|
|
|
|
- </el-radio-group>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="备注" prop="remark">
|
|
|
|
- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
|
- </div>
|
|
|
|
- </el-dialog>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <!-- 添加或修改性质对话框 -->
|
|
|
|
+ <el-dialog :title="title" :visible.sync="natureOpen" width="500px" append-to-body>
|
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
|
+ <el-form-item label="性质" prop="natureName">
|
|
|
|
+ <el-input v-model="form.natureName" placeholder="请输入性质" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="描述" prop="remarks">
|
|
|
|
+ <el-input v-model="form.remarks" placeholder="请输入描述" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="cancelNature">取 消</el-button>
|
|
|
|
+ <el-button type="primary" @click="submitFormNature">保 存</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ <!-- 岗位添加或修改对话框 -->
|
|
|
|
+ <el-dialog :title="title" :visible.sync="postOpen" width="500px" append-to-body>
|
|
|
|
+ <el-form ref="formPost" :model="formPost" :rules="rulesPost" label-width="80px">
|
|
|
|
+ <el-form-item label="岗位" prop="postName">
|
|
|
|
+ <el-input v-model="formPost.postName" placeholder="请输入岗位" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="性质">
|
|
|
|
+ <el-input v-model="natureName" disabled />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="描述" prop="remark">
|
|
|
|
+ <el-input v-model="formPost.remark" placeholder="请输入描述" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="cancelPost">取 消</el-button>
|
|
|
|
+ <el-button type="primary" @click="submitFormPost">保 存</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/post";
|
|
|
|
|
|
+import { listPost, getPost, delPost, addPost, updatePost, updateSortPost, getNature, addNature, delNature, updateNature, getNatureByNatureId, updateSortNature } from '@/api/system/post'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
- name: "Post",
|
|
|
|
- dicts: ['sys_normal_disable'],
|
|
|
|
- data() {
|
|
|
|
- return {
|
|
|
|
- // 遮罩层
|
|
|
|
- loading: true,
|
|
|
|
- // 选中数组
|
|
|
|
- ids: [],
|
|
|
|
- // 非单个禁用
|
|
|
|
- single: true,
|
|
|
|
- // 非多个禁用
|
|
|
|
- multiple: true,
|
|
|
|
- // 显示搜索条件
|
|
|
|
- showSearch: true,
|
|
|
|
- // 总条数
|
|
|
|
- total: 0,
|
|
|
|
- // 岗位表格数据
|
|
|
|
- postList: [],
|
|
|
|
- // 弹出层标题
|
|
|
|
- title: "",
|
|
|
|
- // 是否显示弹出层
|
|
|
|
- open: false,
|
|
|
|
- // 查询参数
|
|
|
|
- queryParams: {
|
|
|
|
- pageNum: 1,
|
|
|
|
- pageSize: 10,
|
|
|
|
- postCode: undefined,
|
|
|
|
- postName: undefined,
|
|
|
|
- status: undefined
|
|
|
|
- },
|
|
|
|
- // 表单参数
|
|
|
|
- form: {},
|
|
|
|
- // 表单校验
|
|
|
|
- rules: {
|
|
|
|
- postName: [
|
|
|
|
- { required: true, message: "岗位名称不能为空", trigger: "blur" }
|
|
|
|
- ],
|
|
|
|
- postCode: [
|
|
|
|
- { required: true, message: "岗位编码不能为空", trigger: "blur" }
|
|
|
|
- ],
|
|
|
|
- postSort: [
|
|
|
|
- { required: true, message: "岗位顺序不能为空", trigger: "blur" }
|
|
|
|
- ]
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
- created() {
|
|
|
|
- this.getList();
|
|
|
|
- },
|
|
|
|
- methods: {
|
|
|
|
- /** 查询岗位列表 */
|
|
|
|
- getList() {
|
|
|
|
- this.loading = true;
|
|
|
|
- listPost(this.queryParams).then(response => {
|
|
|
|
- this.postList = response.rows;
|
|
|
|
- this.total = response.total;
|
|
|
|
- this.loading = false;
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- // 取消按钮
|
|
|
|
- cancel() {
|
|
|
|
- this.open = false;
|
|
|
|
- this.reset();
|
|
|
|
- },
|
|
|
|
- // 表单重置
|
|
|
|
- reset() {
|
|
|
|
- this.form = {
|
|
|
|
- postId: undefined,
|
|
|
|
- postCode: undefined,
|
|
|
|
- postName: undefined,
|
|
|
|
- postSort: 0,
|
|
|
|
- status: "0",
|
|
|
|
- remark: undefined
|
|
|
|
- };
|
|
|
|
- this.resetForm("form");
|
|
|
|
- },
|
|
|
|
- /** 搜索按钮操作 */
|
|
|
|
- handleQuery() {
|
|
|
|
- this.queryParams.pageNum = 1;
|
|
|
|
- this.getList();
|
|
|
|
- },
|
|
|
|
- /** 重置按钮操作 */
|
|
|
|
- resetQuery() {
|
|
|
|
- this.resetForm("queryForm");
|
|
|
|
- this.handleQuery();
|
|
|
|
- },
|
|
|
|
- // 多选框选中数据
|
|
|
|
- handleSelectionChange(selection) {
|
|
|
|
- this.ids = selection.map(item => item.postId)
|
|
|
|
- this.single = selection.length!=1
|
|
|
|
- this.multiple = !selection.length
|
|
|
|
- },
|
|
|
|
- /** 新增按钮操作 */
|
|
|
|
- handleAdd() {
|
|
|
|
- this.reset();
|
|
|
|
- this.open = true;
|
|
|
|
- this.title = "添加岗位";
|
|
|
|
- },
|
|
|
|
- /** 修改按钮操作 */
|
|
|
|
- handleUpdate(row) {
|
|
|
|
- this.reset();
|
|
|
|
- const postId = row.postId || this.ids
|
|
|
|
- getPost(postId).then(response => {
|
|
|
|
- this.form = response.data;
|
|
|
|
- this.open = true;
|
|
|
|
- this.title = "修改岗位";
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- /** 提交按钮 */
|
|
|
|
- submitForm: function() {
|
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
|
- if (valid) {
|
|
|
|
- if (this.form.postId != undefined) {
|
|
|
|
- updatePost(this.form).then(response => {
|
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
|
- this.open = false;
|
|
|
|
- this.getList();
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- addPost(this.form).then(response => {
|
|
|
|
- this.$modal.msgSuccess("新增成功");
|
|
|
|
- this.open = false;
|
|
|
|
- this.getList();
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- /** 删除按钮操作 */
|
|
|
|
- handleDelete(row) {
|
|
|
|
- const postIds = row.postId || this.ids;
|
|
|
|
- this.$modal.confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?').then(function() {
|
|
|
|
- return delPost(postIds);
|
|
|
|
- }).then(() => {
|
|
|
|
- this.getList();
|
|
|
|
- this.$modal.msgSuccess("删除成功");
|
|
|
|
- }).catch(() => {});
|
|
|
|
- },
|
|
|
|
- /** 导出按钮操作 */
|
|
|
|
- handleExport() {
|
|
|
|
- this.download('system/post/export', {
|
|
|
|
- ...this.queryParams
|
|
|
|
- }, `post_${new Date().getTime()}.xlsx`)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-};
|
|
|
|
|
|
+ name: 'Post',
|
|
|
|
+ dicts: ['sys_normal_disable'],
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ // 遮罩层
|
|
|
|
+ loading: true,
|
|
|
|
+ // 选中数组
|
|
|
|
+ ids: [],
|
|
|
|
+ // 非单个禁用
|
|
|
|
+ single: true,
|
|
|
|
+ // 非多个禁用
|
|
|
|
+ multiple: true,
|
|
|
|
+ // 显示搜索条件
|
|
|
|
+ showSearch: true,
|
|
|
|
+ // 总条数
|
|
|
|
+ // total: 0,
|
|
|
|
+ // 岗位表格数据
|
|
|
|
+ postList: [],
|
|
|
|
+ // 弹出层标题
|
|
|
|
+ title: '',
|
|
|
|
+ // 是否显示弹出层
|
|
|
|
+ natureOpen: false,
|
|
|
|
+ // 查询参数
|
|
|
|
+ queryParams: {
|
|
|
|
+ natureId: 0,
|
|
|
|
+ postName: '',
|
|
|
|
+ },
|
|
|
|
+ // 表单参数
|
|
|
|
+ form: {},
|
|
|
|
+ // 表单校验
|
|
|
|
+ rules: {
|
|
|
|
+ natureName: [{ required: true, message: '性质不能为空', trigger: 'blur' }]
|
|
|
|
+ },
|
|
|
|
+ rulesPost: {
|
|
|
|
+ postName: [{ required: true, message: '岗位不能为空', trigger: 'blur' }]
|
|
|
|
+ },
|
|
|
|
+ over: 1,
|
|
|
|
+ natureShow: true,
|
|
|
|
+ postShow: false, //
|
|
|
|
+ postOpen: false,
|
|
|
|
+ getIndex: 0,
|
|
|
|
+ getIndex1: 0,
|
|
|
|
+ natureList: [], // 性质列表
|
|
|
|
+ perId: 0, // 前一个id
|
|
|
|
+ decId: 0, // 后一个id
|
|
|
|
+ natureName: '',
|
|
|
|
+ formPost: {},
|
|
|
|
+ nature: {},
|
|
|
|
+ perPostId: 0,
|
|
|
|
+ decPostId: 0,
|
|
|
|
+ natureObj: {},
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+ this.getList()
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ /** 查询岗位列表 */
|
|
|
|
+ getList() {
|
|
|
|
+ this.loading = true
|
|
|
|
+ getNature().then((response) => {
|
|
|
|
+ this.natureList = response.data
|
|
|
|
+ this.loading = false
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 性质列表
|
|
|
|
+ getNature() {
|
|
|
|
+ this.getList()
|
|
|
|
+ this.over = 1
|
|
|
|
+ this.natureShow = true
|
|
|
|
+ this.postShow = false
|
|
|
|
+ },
|
|
|
|
+ // 岗位列表
|
|
|
|
+ getPostList() {
|
|
|
|
+ this.getList()
|
|
|
|
+ this.over = 2
|
|
|
|
+ this.natureShow = false
|
|
|
|
+ this.postShow = true
|
|
|
|
+ this.natureLineDbclick(this.natureObj)
|
|
|
|
+ },
|
|
|
|
+ //为行对象(row)设置index属性
|
|
|
|
+ tableRowClassName({ row, rowIndex }) {
|
|
|
|
+ row.index = rowIndex
|
|
|
|
+ },
|
|
|
|
+ //设置行对象(row)的样式(style)
|
|
|
|
+ selectedstyle({ row, rowIndex }) {
|
|
|
|
+ if (this.getIndex === rowIndex) {
|
|
|
|
+ return { 'background-color': '#EBEEF5' }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ selectedstyle1({ row, rowIndex }) {
|
|
|
|
+ if (this.getIndex1 === rowIndex) {
|
|
|
|
+ return { 'background-color': '#EBEEF5' }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 单击性质表格某一行
|
|
|
|
+ natureLineClick(row, event, column) {
|
|
|
|
+ this.getIndex = row.index
|
|
|
|
+ this.natureObj = row
|
|
|
|
+ },
|
|
|
|
+ // 双击性质表格某一行
|
|
|
|
+ natureLineDbclick(row) {
|
|
|
|
+ this.queryParams.natureId = row.natureId
|
|
|
|
+ this.natureName = row.natureName
|
|
|
|
+ this.nature = row
|
|
|
|
+ listPost(this.queryParams).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ this.postList = res.data
|
|
|
|
+ this.natureShow = false
|
|
|
|
+ this.postShow = true
|
|
|
|
+ this.over = 2
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 单击岗位表格某一行
|
|
|
|
+ postLineClick(row, event, column) {
|
|
|
|
+ this.getIndex1 = row.index
|
|
|
|
+ },
|
|
|
|
+ // 取消按钮
|
|
|
|
+ cancelNature() {
|
|
|
|
+ this.natureOpen = false
|
|
|
|
+ this.form = {}
|
|
|
|
+ },
|
|
|
|
+ // 取消岗位
|
|
|
|
+ cancelPost() {
|
|
|
|
+ this.postOpen = false
|
|
|
|
+ this.formPost = {}
|
|
|
|
+ },
|
|
|
|
+ // 岗位添加提交
|
|
|
|
+ submitFormPost() {
|
|
|
|
+ this.$refs['formPost'].validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ if (this.formPost.postId != undefined) {
|
|
|
|
+ updatePost(this.formPost).then((response) => {
|
|
|
|
+ this.$modal.msgSuccess('修改成功')
|
|
|
|
+ this.postOpen = false
|
|
|
|
+ this.getList()
|
|
|
|
+ this.natureLineDbclick(this.nature)
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ if (this.postList.length > 0) {
|
|
|
|
+ this.formPost.natureId = this.queryParams.natureId
|
|
|
|
+ this.formPost.postSort = parseInt(this.postList[0].postSort) + 1
|
|
|
|
+ addPost(this.formPost).then((response) => {
|
|
|
|
+ this.$modal.msgSuccess('新增成功')
|
|
|
|
+ this.formPost = {}
|
|
|
|
+ this.postOpen = false
|
|
|
|
+ this.getList()
|
|
|
|
+ this.natureLineDbclick(this.nature)
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ this.formPost.postSort = 1
|
|
|
|
+ this.formPost.natureId = this.queryParams.natureId
|
|
|
|
+ addPost(this.formPost).then((response) => {
|
|
|
|
+ this.$modal.msgSuccess('新增成功')
|
|
|
|
+ this.formPost = {}
|
|
|
|
+ this.formPost.postSort = null
|
|
|
|
+ this.postOpen = false
|
|
|
|
+ this.getList()
|
|
|
|
+ this.natureLineDbclick(this.nature)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ /** 新增性质按钮操作 */
|
|
|
|
+ handleAddNature() {
|
|
|
|
+ this.natureOpen = true
|
|
|
|
+ this.title = '性质添加'
|
|
|
|
+ },
|
|
|
|
+ // 新增岗位
|
|
|
|
+ handleAddPost() {
|
|
|
|
+ this.title = '岗位添加'
|
|
|
|
+ this.postOpen = true
|
|
|
|
+ },
|
|
|
|
+ /** 修改性质按钮操作 */
|
|
|
|
+ handleUpdate(row) {
|
|
|
|
+ getNatureByNatureId(row.natureId).then((response) => {
|
|
|
|
+ this.form = response.data
|
|
|
|
+ this.natureOpen = true
|
|
|
|
+ this.title = '修改性质'
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 修改岗位按钮
|
|
|
|
+ updataPost(row) {
|
|
|
|
+ getPost(row.postId).then(res => {
|
|
|
|
+ this.formPost = res.data
|
|
|
|
+ this.postOpen = true
|
|
|
|
+ this.title = '修改岗位'
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 删除岗位
|
|
|
|
+ deletePost(row) {
|
|
|
|
+ this.$modal
|
|
|
|
+ .confirm('是否确认删除岗位为"' + row.postName + '"的数据项?')
|
|
|
|
+ .then(function () {
|
|
|
|
+ return delPost(row.postId)
|
|
|
|
+ })
|
|
|
|
+ .then((res) => {
|
|
|
|
+ console.log(res)
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ this.getList()
|
|
|
|
+ this.natureLineDbclick(this.nature)
|
|
|
|
+ this.$modal.msgSuccess('删除成功')
|
|
|
|
+ }else if (res.code === 500) {
|
|
|
|
+ this.getList()
|
|
|
|
+ this.$notify({title: '警告', message: res.msg, type: 'warning'});
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {})
|
|
|
|
+ },
|
|
|
|
+ /** 性质提交按钮 */
|
|
|
|
+ submitFormNature: function () {
|
|
|
|
+ this.$refs['form'].validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ if (this.form.natureId != undefined) {
|
|
|
|
+ updateNature(this.form).then((response) => {
|
|
|
|
+ this.$modal.msgSuccess('修改成功')
|
|
|
|
+ this.natureOpen = false
|
|
|
|
+ this.getList()
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ if (this.natureList.length > 0) {
|
|
|
|
+ this.form.natureSort = parseInt(this.natureList[0].natureSort) + 1
|
|
|
|
+ addNature(this.form).then((response) => {
|
|
|
|
+ this.$modal.msgSuccess('新增成功')
|
|
|
|
+ this.form = {}
|
|
|
|
+ this.natureOpen = false
|
|
|
|
+ this.getList()
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ this.form.natureSort = 1
|
|
|
|
+ addNature(this.form).then((response) => {
|
|
|
|
+ console.log(response)
|
|
|
|
+ this.$modal.msgSuccess('新增成功')
|
|
|
|
+ this.form = {}
|
|
|
|
+ this.form.natureSort = null
|
|
|
|
+ this.natureOpen = false
|
|
|
|
+ this.getList()
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 性质上升
|
|
|
|
+ natureRise(row) {
|
|
|
|
+ this.perId = row.natureSort
|
|
|
|
+ let sysNatureEditBOs = []
|
|
|
|
+ let item = {}
|
|
|
|
+ let previous = {}
|
|
|
|
+ if (row.index === 0) {
|
|
|
|
+ this.$notify({title: '警告', message: '已经是最高级,无法上升!', type: 'warning'});
|
|
|
|
+ }else{
|
|
|
|
+ row.natureSort = this.natureList[row.index - 1].natureSort
|
|
|
|
+ this.natureList[row.index - 1].natureSort = this.perId
|
|
|
|
+ item = {
|
|
|
|
+ natureId: row.natureId,
|
|
|
|
+ natureSort: row.natureSort
|
|
|
|
+ }
|
|
|
|
+ previous = {
|
|
|
|
+ natureId: this.natureList[row.index - 1].natureId,
|
|
|
|
+ natureSort: this.natureList[row.index - 1].natureSort
|
|
|
|
+ }
|
|
|
|
+ sysNatureEditBOs = [item, previous]
|
|
|
|
+ updateSortNature(sysNatureEditBOs).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ this.$modal.msgSuccess('上升成功')
|
|
|
|
+ this.getList()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 岗位上升
|
|
|
|
+ postRise(row) {
|
|
|
|
+ this.perPostId = row.postSort
|
|
|
|
+ let sysNatureEditBOs = []
|
|
|
|
+ let item = {}
|
|
|
|
+ let previous = {}
|
|
|
|
+ if (row.index === 0) {
|
|
|
|
+ this.$notify({title: '警告', message: '已经是最高级,无法上升!', type: 'warning'});
|
|
|
|
+ }else{
|
|
|
|
+ row.postSort = this.postList[row.index - 1].postSort
|
|
|
|
+ this.postList[row.index - 1].postSort = this.perPostId
|
|
|
|
+ item = {
|
|
|
|
+ postId: row.postId,
|
|
|
|
+ postSort: row.postSort
|
|
|
|
+ }
|
|
|
|
+ previous = {
|
|
|
|
+ postId: this.postList[row.index - 1].postId,
|
|
|
|
+ postSort: this.postList[row.index - 1].postSort
|
|
|
|
+ }
|
|
|
|
+ sysNatureEditBOs = [item, previous]
|
|
|
|
+ updateSortPost(sysNatureEditBOs).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ this.$modal.msgSuccess('上升成功')
|
|
|
|
+ this.getList()
|
|
|
|
+ this.natureLineDbclick(this.nature)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 性质下降
|
|
|
|
+ natureDecline(row) {
|
|
|
|
+ this.decId = row.natureSort
|
|
|
|
+ let sysNatureEditBOs = []
|
|
|
|
+ let item = {}
|
|
|
|
+ let previous = {}
|
|
|
|
+ if (row.index === this.natureList.length - 1) {
|
|
|
|
+ this.$notify({title: '警告', message: '已经是最低级,无法下降!', type: 'warning'});
|
|
|
|
+ }else{
|
|
|
|
+ row.natureSort = this.natureList[row.index + 1].natureSort
|
|
|
|
+ this.natureList[row.index + 1].natureSort = this.decId
|
|
|
|
+ item = {
|
|
|
|
+ natureId: row.natureId,
|
|
|
|
+ natureSort: row.natureSort
|
|
|
|
+ }
|
|
|
|
+ previous = {
|
|
|
|
+ natureId: this.natureList[row.index + 1].natureId,
|
|
|
|
+ natureSort: this.natureList[row.index + 1].natureSort
|
|
|
|
+ }
|
|
|
|
+ sysNatureEditBOs = [item, previous]
|
|
|
|
+ updateSortNature(sysNatureEditBOs).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ this.$modal.msgSuccess('下降成功')
|
|
|
|
+ this.getList()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 岗位下降
|
|
|
|
+ postDecline(row) {
|
|
|
|
+ this.decPostId = row.postSort
|
|
|
|
+ let sysNatureEditBOs = []
|
|
|
|
+ let item = {}
|
|
|
|
+ let previous = {}
|
|
|
|
+ if (row.index === this.postList.length - 1) {
|
|
|
|
+ this.$notify({title: '警告', message: '已经是最低级,无法下降!', type: 'warning'});
|
|
|
|
+ }else{
|
|
|
|
+ row.postSort = this.postList[row.index + 1].postSort
|
|
|
|
+ this.postList[row.index + 1].postSort = this.decPostId
|
|
|
|
+ item = {
|
|
|
|
+ postId: row.postId,
|
|
|
|
+ postSort: row.postSort
|
|
|
|
+ }
|
|
|
|
+ previous = {
|
|
|
|
+ postId: this.postList[row.index + 1].postId,
|
|
|
|
+ postSort: this.postList[row.index + 1].postSort
|
|
|
|
+ }
|
|
|
|
+ sysNatureEditBOs = [item, previous]
|
|
|
|
+ updateSortPost(sysNatureEditBOs).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ this.$modal.msgSuccess('下降成功')
|
|
|
|
+ this.getList()
|
|
|
|
+ this.natureLineDbclick(this.nature)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ /** 删除性质按钮操作 */
|
|
|
|
+ handleDelete(row) {
|
|
|
|
+ this.$modal
|
|
|
|
+ .confirm('是否确认删除性质为"' + row.natureName + '"的数据项?')
|
|
|
|
+ .then(function () {
|
|
|
|
+ return delNature(row.natureId)
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.getList()
|
|
|
|
+ this.$modal.msgSuccess('删除成功')
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {})
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
|
|
+<style scoped>
|
|
|
|
+.role {
|
|
|
|
+ width: 90px;
|
|
|
|
+ height: 40px;
|
|
|
|
+ text-align: center;
|
|
|
|
+ line-height: 40px;
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ border: 1px solid #dfe6ec;
|
|
|
|
+ border-bottom: none;
|
|
|
|
+}
|
|
|
|
+.roleTable {
|
|
|
|
+ width: 1154px;
|
|
|
|
+}
|
|
|
|
+.add_btn {
|
|
|
|
+ width: 80px;
|
|
|
|
+ height: 35px;
|
|
|
|
+ text-align: center;
|
|
|
|
+}
|
|
|
|
+.item {
|
|
|
|
+ width: 1154px;
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+}
|
|
|
|
+.dataTable {
|
|
|
|
+ width: 656px;
|
|
|
|
+}
|
|
|
|
+.left_tag {
|
|
|
|
+ display: flex;
|
|
|
|
+}
|
|
|
|
+.border_role {
|
|
|
|
+ border-right: none;
|
|
|
|
+}
|
|
|
|
+.activeClass {
|
|
|
|
+ color: #409eff;
|
|
|
|
+}
|
|
|
|
+.tableRowClassName {
|
|
|
|
+ background: olive;
|
|
|
|
+}
|
|
|
|
+.pagination-container[data-v-72233bcd] {
|
|
|
|
+ width: 1154px;
|
|
|
|
+}
|
|
|
|
+</style>
|