123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475 |
- <!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-dialog__body p{
- text-indent: inherit;
- }
- .br{
- border: 1px solid rgba(255, 255, 255, 0.2);
- }
- ._Form{
- flex:1;
- flex-direction: column;
- }
- ._Form>div{
- height: 14.3%;
- 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;
- }
- .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-select-dropdown__item{
- color: #fff;
- }
- </style>
- </head>
- <body>
- <div id="app">
- <div>
- <div class="flex align-center margin-bottom-sm">
- <div>
- <el-input placeholder="请输入船舶名称" v-model="queryParams.iboatName">
- <i slot="prefix" class="el-input__icon el-icon-search"></i>
- </el-input>
- </div>
- <div class="tableTool">
- <el-button type="primary" size="small" @click="inpSearch" 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 label="序号" align="center" type="index" width="50"></el-table-column>
- <el-table-column align="center" prop="iboatName" label="船舶名称"> </el-table-column>
- <el-table-column align="center" prop="sn" label="设备sn"> </el-table-column>
- <el-table-column align="center" prop="sheet" label="mmsi"> </el-table-column>
- <el-table-column align="center" prop="state" label="状态">
- <template slot-scope="scope">
- <el-switch
- :value="scope.row.state == 0"
- disabled
- active-color="#13ce66"
- inactive-color="#ff4949">
- </el-switch>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- width="220"
- label="操作">
- <template slot-scope="scope" v-if="!scope.row.admin">
- <el-button type="text" size="small" @click="setUserLi(scope.row)" class="text-sray"><i class="el-icon-user"></i>配置用户</el-button>
- <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>
- <el-pagination v-show="allTotal > 0" :total="allTotal"
- :page-size="queryParams.pageSize" background
- @current-change="handlePageChange"></el-pagination>
- </div>
- <el-dialog title="设备信息" :visible.sync="dialogVisible" width="40%">
- <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.iboatName" placeholder="船舶名称"></el-input></div>
- </div>
- <div class="flex align-center">
- <div><span class="text-red">*</span>设备sn</div>
- <div><el-input v-model="nowForm.sn" placeholder="设备sn"></el-input></div>
- </div>
- <div class="flex align-center">
- <div>mmsi</div>
- <div><el-input v-model="nowForm.sheet" placeholder="mmsi"></el-input></div>
- </div>
- <div class="flex align-center" style="border: none;">
- <div>状态</div>
- <div class="text-left">
- <el-radio v-model="nowForm.state" :label="0">正常</el-radio>
- <el-radio v-model="nowForm.state" :label="1">停用</el-radio>
- </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>
- <el-dialog title="配置用户" :visible.sync="pwdDialog" width="610px">
- <div>
- <el-transfer
- v-model="userSel"
- :props="{
- key: 'userId',
- label: 'nickName'
- }"
- :titles="['用户', '已选']"
- :data="userData"></el-transfer>
- </div>
- <div class="text-center">
- <el-button size="small" @click="pwdDialog = false">取 消</el-button>
- <el-button size="small" type="success" @click="updateConfigUser">确 定</el-button>
- </div>
- </el-dialog>
- </div>
- <script>
- var _this, dataObj=[];
- new Vue({
- el: '#app',
- data: function() {
- return {
- tableData: [],
- allTotal: 0,
- queryParams: {
- pageNum:1,
- pageSize:10
- },
- nowForm:{},
- dialogVisible:false,
- inpKey:"",
- pwdDialog:false,
- pwdInfo:{
- userId:null,
- newPwd:"",
- pwdName:null
- },
- userData: [],
- userSel: [],
- userConf: {}
- }
- },
- created() {
- _this = this;
- _this.reSet();
- _this.getList();
- _this.getUser();
- },
- methods: {
- getList() {
- let data1 = _this.queryParams;
- let _opts = {
- url: "/config/config/list",
- type:"GET"
- };
- tokenAjax(_opts, data1)
- .then(function(res) {
- if (res.code == 200) {
- let _obj = res.rows;
- _this.tableData = _obj;
- _this.allTotal = res.total;
- dataObj = _obj;
- }else{
- _this.$message.error(res.msg);
- }
- })
- },
- getUser() {
- let data1 = {};
- let _opts = {
- url: "/config/config/selectUserAll",
- type:"GET"
- };
- tokenAjax(_opts, data1)
- .then(function(res) {
- if (res.code == 200) {
- _this.userData = res.rows;
- }else{
- _this.$message.error(res.msg);
- }
- })
- },
- getById(row) {
- let _opts = {
- url: "/config/config/list/"+row.id,
- type:"GET"
- };
- tokenAjax(_opts, data1)
- .then(function(res) {
- if (res.code == 200) {
- let _obj = res.rows;
- _this.dialogVisible = true;
- }else{
- _this.$message.error(res.msg);
- }
- })
- },
- handlePageChange(val){
- _this.queryParams.pageNum = val;
- _this.getList();
- },
- inpSearch(_key){
- _this.queryParams.pageNum = 1;
- _this.getList();
- },
- reSet() {
- _this.nowForm = {
- iboatName: "",
- sn: "",
- mmsi: null,
- mdev: "",
- sheet: null,
- taskId: null,
- state: 0,
- remark: ""
- };
- },
- newAdd(){
- _this.reSet();
- _this.dialogVisible = true;
- },
- Edit(_row){
- let data1 = {};
- let _opts = {
- url: "/config/config/" + _row.id,
- type:"GET"
- };
- tokenAjax(_opts, data1)
- .then(function(res) {
- if (res.code == 200) {
- _this.nowForm = res.data;
- _this.dialogVisible = true;
- }
- })
- },
- Delete(_row){
- _this.$confirm('是否确认删除编号为"'+_row.id+'"的数据项?', '温馨提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let data1 = {};
- let _opts = {
- url: "/config/config/"+_row.id,
- 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(() => {
-
- });
- },
- setUserLi(_row){
- let data1 = {};
- let _opts = {
- url: "/config/config/configUserlist?id="+_row.id+"&cnfigId="+_row.id,
- type:"GET"
- };
- tokenAjax(_opts, data1)
- .then(function(res) {
- if (res.code == 200) {
- _this.userConf = _row;
- _this.userSel = res.rows.map(item => item.userId);
- _this.userSel = Array.from(new Set(_this.userSel))
- _this.pwdDialog = true;
- }else{
- _this.$message.error(res.msg);
- }
- })
- },
- updateConfigUser(){
- let data1 = {
- id: _this.userConf.id,
- userIds: _this.userSel.toString(),
- };
- let _opts = {
- url:"/config/config/updateConfigUser",
- type: "GET"
- };
- tokenAjax(_opts,data1)
- .then(function(res){
- if(res.code == 200){
- _this.$message({
- type: 'success',
- message: '操作成功!'
- });
- _this.pwdDialog = false;
- }else{
- _this.$message.error(res.msg);
- }
- })
- },
- conFirm(){
- if(_this.nowForm.iboatName == ""){
- _this.$message({
- type: 'warning',
- message: "请输入船舶名称"
- });
- return;
- }
- if(_this.nowForm.sn == ""){
- _this.$message({
- type: 'warning',
- message: "请输入设备sn"
- });
- return;
- }
- // if(_this.nowForm.mdev == ""){
- // _this.$message({
- // type: 'warning',
- // message: "请输入权限字符"
- // });
- // return;
- // }
- // _this.nowForm.sns = _this.nowForm.mmsi+","+_this.nowForm.mdev+","+_this.nowForm.taskId;
- let data1 = _this.nowForm;
- let _opts = {
- url:"/config/config",
- type: _this.nowForm.id == 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>
|