123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
- <meta http-equiv="pragma" content="no-cache">
- <meta http-equiv="Cache" content="no-cache">
- <meta http-equiv="cache-control" content="no-cache, must-revalidate">
- <meta http-equiv="expires" content="0">
- <meta name="viewport"
- content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <title>岗位管理</title>
- <link rel="stylesheet" href="../css/index.css">
- <link rel="stylesheet" href="../css/style.css">
- <script src="../js/vue.min.js"></script>
- <script src="../js/jquery.min.js"></script>
- <script src="../js/index.js"></script>
- <script src="../js/yz/init.js"></script>
- <script>
- checkLogin();
- </script>
- <style type="text/css">
- *{
- padding: 0;
- margin: 0;
- box-sizing: border-box;
- }
- body{
- padding: 10px;
- background-color: #040d32;
- }
- .search_ input {
- position: relative;
- width: 100%;
- height: 32px;
- line-height: 32px;
- border-radius: 4px;
- font-size: 14px;
- padding: 0 5px 0 25px;
- color: #dcdcdc;
- background-color: rgba(255, 255, 255, 0.2);
- border: 1px solid rgba(232, 232, 232, 0.3);
- }
- .search_ input::-webkit-input-placeholder {
- color: #dcdcdc;
- }
- .search_ .el-icon-search {
- position: absolute;
- left: 12px;
- top: 16px;
- color: #dcdcdc;
- }
- .elTable{
- width: 100%;
- border: 1px solid rgba(255, 255, 255, 0.2);
- }
- .el-table::before{
- height: 0;
- }
- .el-table::after{
- width: 0;
- }
- .el-table,.el-table__expanded-cell {
- color: #ddd;
- background-color: transparent !important;
- }
- .el-table tr,
- .el-table td {
- font-size: 14px;
- background-color: transparent !important;
- }
- .el-table td.el-table__cell,.el-table th.el-table__cell.is-leaf{
- border-bottom: 1px solid rgba(255, 255, 255, 0.2);
- }
- .el-table--border .el-table__cell{
- border-right: 1px solid rgba(255, 255, 255, 0.2);
- }
- .el-dialog__header{
- padding: 10px;
- }
- .el-dialog__title{
- font-size: 15px;
- }
- .el-dialog__headerbtn{
- top: 14px;
- }
- .el-dialog__body{
- padding: 10px;
- color: #fff;
- background-color: #082041;
- }
- .el-tree{
- color: #fff;
- background-color: transparent;
- }
- .br{
- border: 1px solid rgba(255, 255, 255, 0.2);
- }
- ._Form{
- flex:1;
- flex-direction: column;
- border-right: 1px solid rgba(255, 255, 255, 0.2);
-
- }
- ._Form>div{
- height: 20%;
- min-height: 60px;
- border-bottom: 1px solid rgba(255, 255, 255, 0.2);
- }
- ._Form>div>div:first-child{
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100px;
- height: 100%;
- min-height: 60px;
- border-right: 1px solid rgba(255, 255, 255, 0.2);
- }
- ._Form>div>div:last-child{
- width: calc(100% - 100px);
- padding: 0 10px;
- }
- .el-input__inner{
- height: 34px;
- line-height: 34px;
- }
- .el-input__inner,._Form .el-textarea__inner{
- color: #ececec;
- border-color: transparent;
- background-color: rgba(255, 255, 255, 0.2);
- }
- .el-input__inner::-webkit-input-placeholder {
- color: #b9b9b9;
- }
- ._Form .el-radio{
- color: #fff;
- }
- ._treeTxt{
- display: flex;
- align-items: center;
- justify-content: center;
- width: 120px;
- min-height: 360px;
- height: 100%;
- border-right: 1px solid rgba(255, 255, 255, 0.2);
- }
- .el-radio__input.is-checked .el-radio__inner,
- .el-checkbox__input.is-checked .el-checkbox__inner,
- .el-checkbox__input.is-indeterminate .el-checkbox__inner,
- .el-button--success{
- border-color: #39b54a;
- background: #39b54a;
- }
- .el-radio__input.is-checked+.el-radio__label{
- color: #39b54a;
- }
- .el-tree-node__content:hover,.el-tree-node:focus>.el-tree-node__content {
- background-color: transparent;
- }
- </style>
- </head>
- <body>
- <div id="app">
- <div>
- <div class="flex align-center margin-bottom-sm">
- <div>
- <el-input placeholder="请输入关键词" v-model="inpKey" @input="_Search">
- <i slot="prefix" class="el-input__icon el-icon-search"></i>
- </el-input>
- </div>
- <div class="tableTool">
- <el-button type="primary" size="small" class="margin-left-sm">查询</el-button>
- <el-button type="success" size="small" @click="newAdd">新增</el-button>
- </div>
- </div>
- <el-table class="elTable" :data="tableData" border :header-cell-style="{background:'#082041',color:'#fff'}">
- <el-table-column align="center" prop="postId" label="岗位编号"> </el-table-column>
- <el-table-column align="center" prop="postCode" label="岗位编码"> </el-table-column>
- <el-table-column align="center" prop="postName" label="岗位名称"> </el-table-column>
- <el-table-column align="center" prop="postSort" label="显示顺序"> </el-table-column>
- <el-table-column align="center" prop="status" label="状态">
- <template slot-scope="scope">
- <el-switch
- :value="scope.row.status == 0"
- disabled
- active-color="#13ce66"
- inactive-color="#cecece">
- </el-switch>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="createTime" label="创建时间"> </el-table-column>
- <el-table-column
- align="center"
- width="140"
- label="操作">
- <template slot-scope="scope" v-if="!scope.row.admin">
- <el-button type="text" size="small" @click="Edit(scope.row)" class="text-green"><i class="el-icon-edit"></i>编辑</el-button>
- <el-button type="text" size="small" @click="Delete(scope.row)" class="text-red"><i class="el-icon-delete"></i>删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <el-dialog title="岗位信息" :visible.sync="dialogVisible" width="400px">
- <div class="flex br" style="text-align: center;">
- <div class="_Form">
- <div class="flex align-center">
- <div><span class="text-red">*</span>岗位名称</div>
- <div><el-input v-model="nowForm.postName" placeholder="角色名称"></el-input></div>
- </div>
- <div class="flex align-center">
- <div><span class="text-red">*</span>岗位编码</div>
- <div><el-input v-model="nowForm.postCode" placeholder="权限字符"></el-input></div>
- </div>
- <div class="flex align-center">
- <div><span class="text-red">*</span>岗位顺序</div>
- <div><el-input type="number" min="0" v-model="nowForm.postSort" placeholder="请输入内容"></el-input></div>
- </div>
- <div class="flex align-center">
- <div>状态</div>
- <div class="text-left">
- <el-radio v-model="nowForm.status" label="0">正常</el-radio>
- <el-radio v-model="nowForm.status" label="1">停用</el-radio>
- </div>
- </div>
- <div class="flex align-center" style="border: none;">
- <div>备注</div>
- <div><el-input type="textarea" :rows="2" placeholder="请输入备注" v-model="nowForm.remark"></el-input></div>
- </div>
- </div>
- </div>
- <div class="padding-sm text-center">
- <el-button size="small" @click="dialogVisible = false;">取消</el-button>
- <el-button size="small" type="success" @click="conFirm">提交</el-button>
- </div>
- </el-dialog>
- </div>
- <script>
- var _this, dataObj=[];
- new Vue({
- el: '#app',
- data: function() {
- return {
- tableData: [],
- nowForm:{
- postName:"",
- postCode:"",
- postSort:0,
- status:"0",
- remark:""
- },
- dialogVisible:false,
- inpKey:""
- }
- },
- created() {
- _this = this;
- _this.getList();
- },
- methods: {
- getList() {
- let data1 = {
- pageNum:1,
- pageSize:100
- };
- let _opts = {
- url: "/system/post/list",
- type:"GET"
- };
- tokenAjax(_opts, data1)
- .then(function(res) {
- if (res.code == 200) {
- _this.tableData = res.rows;
- dataObj = res.rows;
- }else{
- _this.$message.error(res.msg);
- }
- })
- },
- _Search(_key){
- let newArr = [],_ovj = dataObj;
- if(_key == ""){
- newArr = dataObj;
- }else{
- for(var i=0;i<_ovj.length;i++){
- if( JSON.stringify(_ovj[i]).indexOf(_key) != -1){
- newArr.push(_ovj[i])
- }
- }
- }
- _this.tableData = newArr;
- },
- newAdd(){
- _this.nowForm = {
- postName:"",
- postCode:"",
- postSort:0,
- status:"0",
- remark:""
- };
- _this.dialogVisible = true;
- },
- Edit(_row){
- let data1 = {};
- let _opts = {
- url: "/system/post/" + _row.postId,
- type:"GET"
- };
- tokenAjax(_opts, data1)
- .then(function(res) {
- if (res.code == 200) {
- _this.nowForm = res.data;
- _this.dialogVisible = true;
- }
- })
- },
- Delete(_row){
- _this.$confirm('是否确认删除编号为"'+_row.postId+'"的数据项?', '温馨提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let data1 = {};
- let _opts = {
- url: "/system/post/"+_row.postId,
- type:"DELETE"
- };
- tokenAjax(_opts, data1)
- .then(function(res) {
- if(res.code == 200){
- _this.$message({
- type: 'success',
- message: '删除成功!'
- });
- _this.getList();
- }else{
- _this.$message.error(res.msg);
- }
- })
- }).catch(() => {
-
- });
- },
- conFirm(){
- if(_this.nowForm.postName == ""){
- _this.$message({
- type: 'warning',
- message: "请输入岗位名称"
- });
- return;
- }
- if(_this.nowForm.postCode == ""){
- _this.$message({
- type: 'warning',
- message: "请输入岗位编码"
- });
- return;
- }
- let data1 = _this.nowForm;
- let _opts = {
- url:"/system/post",
- type: _this.nowForm.postId == undefined?"POST":"PUT"
- };
- tokenPostAjax(_opts,data1)
- .then(function(res){
- if(res.code == 200){
- _this.$message({
- type: 'success',
- message: '操作成功!'
- });
- _this.getList();
- _this.dialogVisible = false;
- }else{
- _this.$message.error(res.msg);
- }
- })
- }
-
- }
- })
- </script>
- </body>
-
- </html>
|