123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684 |
- <!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 type="text/javascript">
- document.write('<script src="../js/yz/init.js?id='+(new Date().getTime())+'" type="text/javascript" charset="utf-8"><\/script>');
- document.write('<script src="../js/yz/shipLi.js?id='+(new Date().getTime())+'" type="text/javascript" charset="utf-8"><\/script>');
- </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;
- }
- .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;
- }
- .el-select-dropdown__item{
- height: auto;
- }
- .el-tree{
- color: #fff;
- background-color: transparent;
- }
- .el-select-dropdown__item.hover, .el-select-dropdown__item:hover,
- .el-tree-node__content:hover,.el-tree-node:focus>.el-tree-node__content{
- background-color: transparent;
- }
- .el-popper[x-placement^=bottom] .popper__arrow::after{
- border-bottom-color: #707070;
- }
- .el-select-dropdown{
- background-color: #707070;
- }
- .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="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="userId" label="编号" width="60"> </el-table-column>
- <el-table-column align="center" prop="userName" label="用户账号"> </el-table-column>
- <el-table-column align="center" prop="nickName" label="用户昵称"> </el-table-column>
- <el-table-column align="center" prop="dept.deptName" label="部门"></el-table-column>
- <el-table-column align="center" prop="phonenumber" label="手机号码"> </el-table-column>
- <el-table-column align="center" prop="status" label="状态" width="80">
- <template slot-scope="scope">
- <el-switch
- :value="scope.row.status == 0"
- disabled
- active-color="#13ce66"
- inactive-color="#ff4949">
- </el-switch>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="createTime" label="创建时间"> </el-table-column>
- <el-table-column
- align="center"
- width="240"
- label="操作">
- <template slot-scope="scope" v-if="!scope.row.admin">
- <el-button type="text" size="small" @click="setSnLi(scope.row)" class="text-sray"><i class="el-icon-set-up"></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>
- <el-button type="text" size="small" @click="RePwd(scope.row)" class="text-sray"><i class="el-icon-key"></i>密码</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <el-dialog title="用户信息" :visible.sync="dialogVisible" width="60%">
- <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.nickName" placeholder="用户昵称"></el-input></div>
- </div>
- <div class="flex align-center">
- <div>手机号码</div>
- <div><el-input v-model="nowForm.phonenumber" placeholder="手机号码"></el-input></div>
- </div>
- <div class="flex align-center" v-if="nowForm.userId == undefined">
- <div><span class="text-red">*</span>用户账号</div>
- <div><el-input v-model="nowForm.userName" placeholder="用户账号" :readonly="readonlyInput" @focus="cancelReadOnly()"></el-input></div>
- </div>
- <div class="flex align-center">
- <div>用户性别</div>
- <div>
- <el-select v-model="nowForm.sex" placeholder="请选择" style="width: 100%;">
- <el-option
- v-for="item in sexOptions"
- :key="item.dictValue"
- :label="item.dictLabel"
- :value="item.dictValue">
- </el-option>
- </el-select>
- </div>
- </div>
- <div class="flex align-center" style="border: none;">
- <div>岗位</div>
- <div>
- <el-select v-model="nowForm.postIds[0]"
- clearable @clear="clearSel('postIds')"
- placeholder="请选择" style="width: 100%;">
- <el-option
- v-for="item in postOptions"
- :key="item.postId"
- :label="item.postName"
- :value="item.postId">
- </el-option>
- </el-select>
- </div>
- </div>
- </div>
- <div class="_Form" style="border: none;">
- <div class="flex align-center">
- <div>归属部门</div>
- <div>
- <el-select v-model="parentName.deptName"
- ref="conSelect" style="width: 100%;">
- <el-option>
- <el-tree
- ref="tree"
- node-key="id"
- :data="deptOptions"
- :props="defaultProps"
- @node-click="nodeClick"
- />
- </el-option>
- </el-select>
- </div>
- </div>
- <div class="flex align-center">
- <div>邮箱</div>
- <div><el-input type="text" v-model="nowForm.email" placeholder="邮箱" :readonly="readonlyInput" @focus="cancelReadOnly()"></el-input></div>
- </div>
- <div class="flex align-center" v-if="nowForm.userId == undefined">
- <div><span class="text-red">*</span>用户密码</div>
- <div><el-input type="password" v-model="nowForm.password" placeholder="用户密码" :readonly="readonlyInput" @focus="cancelReadOnly()"></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-select v-model="nowForm.roleIds[0]"
- clearable @clear="clearSel('roleIds')"
- placeholder="请选择" style="width: 100%;">
- <el-option
- v-for="item in roleOptions"
- :key="item.roleId"
- :label="item.roleName"
- :value="item.roleId">
- </el-option>
- </el-select>
- </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="40%">
- <div>
- <div>请输入"{{ pwdInfo.pwdName }}"的新密码</div>
- <div class="margin-tb-sm"><el-input type="text" v-model="pwdInfo.newPwd" placeholder="用户新密码" :readonly="readonlyInput" @focus="cancelReadOnly()"></el-input></div>
- </div>
- <div class="text-right">
- <el-button size="small" @click="pwdDialog = false">取 消</el-button>
- <el-button size="small" type="success" @click="conPwd">确 定</el-button>
- </div>
- </el-dialog>
- <el-dialog title="配置设备" :visible.sync="snDialog" width="610px">
- <div>
- <el-transfer
- v-model="snSel"
- :props="{
- key: 'id',
- label: 'prod'
- }"
- :titles="['设备', '已选']"
- :data="snData"></el-transfer>
- </div>
- <div class="text-center">
- <el-button size="small" @click="snDialog = false">取 消</el-button>
- <el-button size="small" type="success" @click="upDateSn"> 确 定</el-button>
- </div>
- </el-dialog>
- </div>
- <script>
- var _this, dataObj=[];
- new Vue({
- el: '#app',
- data: function() {
- return {
- parentName: {
- deptName: "请选择",
- deptId: null
- },
- defaultProps: {
- children: 'children',
- label: 'label'
- },
- tableData: [],
- nowForm:{
- postIds: [],
- roleIds: []
- },
- dialogVisible:false,
- inpKey:"",
- sexOptions:[],
- postOptions:[],
- deptOptions :[],
- roleOptions:[],
- readonlyInput: true,
- pwdDialog:false,
- pwdInfo:{
- userId:null,
- newPwd:"",
- pwdName:null
- },
- snDialog: false,
- snSel: [],
- snData: [],
- snConf: {}
- }
- },
- created() {
- _this = this;
- _this.snData = ShipData();
- _this.reSet();
- _this.getList();
- _this.getSex();
- _this.getTree();
- },
- methods: {
- cancelReadOnly() {
- _this.readonlyInput= false;
- },
- getList() {
- let data1 = {
- pageNum:1,
- pageSize:100
- };
- let _opts = {
- url: "/system/user/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);
- }
- })
- },
- getSex(){
- let data1 = {};
- let _opts = {
- url: "/system/dict/data/type/sys_user_sex",
- type:"GET"
- };
- tokenAjax(_opts, data1)
- .then(function(res) {
- if (res.code == 200) {
- _this.sexOptions = res.data;
- }
- })
- },
- getTree(){
- let data1 = {};
- let _opts = {
- url: "/system/dept/treeselect",
- type:"GET"
- };
- tokenAjax(_opts, data1)
- .then(function(res) {
- if (res.code == 200) {
- _this.deptOptions = res.data;
- }
- })
- },
- _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;
- },
- reSet() {
- _this.nowForm = {
- deptId: 0,
- userName: "",
- nickName: "",
- password: "",
- phonenumber: "",
- email: "",
- sex: "2",
- status: "0",
- remark: "",
- postIds: [],
- roleIds: []
- };
- },
- newAdd(){
- let data1 = {};
- let _opts = {
- url: "/system/user/",
- type:"GET"
- };
- tokenAjax(_opts, data1)
- .then(function(res) {
- if (res.code == 200) {
- _this.postOptions = res.posts;
- _this.roleOptions = res.roles;
- _this.parentName = {
- deptName: _this.deptOptions[0].label,
- deptId: _this.deptOptions[0].id
- };
- _this.reSet();
- _this.dialogVisible = true;
- }
- })
- },
- Edit(_row){
- let data1 = {};
- let _opts = {
- url: "/system/user/" + _row.userId,
- type:"GET"
- };
- tokenAjax(_opts, data1)
- .then(function(res) {
- if (res.code == 200) {
- _this.nowForm = res.data;
- if(res.data.deptId == null){
- _this.parentName = {
- deptName: _this.deptOptions[0].label,
- deptId: _this.deptOptions[0].id
- };
- }else{
- _this.parentName = res.data.dept;
- }
- _this.postOptions = res.posts;
- _this.roleOptions = res.roles;
- _this.nowForm.postIds = res.postIds;
- _this.nowForm.roleIds = res.roleIds;
- _this.dialogVisible = true;
- }
- })
- },
- Delete(_row){
- _this.$confirm('是否确认删除编号为"'+_row.userId+'"的数据项?', '温馨提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let data1 = {};
- let _opts = {
- url: "/system/user/"+_row.userId,
- 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(() => {
-
- });
- },
- RePwd(_row){
- if(_row.userId != null&&_row.userId != undefined){
- _this.pwdInfo.pwdName = _row.nickName;
- _this.pwdInfo.userId = _row.userId;
- _this.pwdDialog = true;
- }
- },
- conPwd(){
- if(_this.pwdInfo.newPwd == ""){
- _this.$message({
- type: 'warning',
- message: "请输入新密码"
- });
- return;
- }
- let data1 = {
- password: _this.pwdInfo.newPwd,
- userId: _this.pwdInfo.userId
- };
- let _opts = {
- url:"/system/user/resetPwd",
- type: "PUT"
- };
- tokenPostAjax(_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.nickName == ""){
- _this.$message({
- type: 'warning',
- message: "请输入用户昵称"
- });
- return;
- }
- if(_this.nowForm.userName == ""&&_this.nowForm.userId == undefined){
- _this.$message({
- type: 'warning',
- message: "请输入用户账号"
- });
- return;
- }
- if(_this.nowForm.password == ""&&_this.nowForm.userId == undefined){
- _this.$message({
- type: 'warning',
- message: "请输入权限字符"
- });
- return;
- }
- if(_this.nowForm.phonenumber != ""&&_this.nowForm.phonenumber != null&&(!(/^1[3456789]\d{9}$/.test(_this.nowForm.phonenumber)))){
- _this.$message({
- type: 'warning',
- message: '请输入正确的手机号码',
- })
- return;
- }
- if(_this.nowForm.email != ""&&_this.nowForm.email != null&&(!(/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test(_this.nowForm.email)))){
- _this.$message({
- type: 'warning',
- message: '请输入正确的邮箱格式',
- })
- return;
- }
- _this.nowForm.deptId = _this.parentName.deptId;
- let data1 = _this.nowForm;
- let _opts = {
- url:"/system/user",
- type: _this.nowForm.userId == 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);
- }
- })
- },
- nodeClick(_e){
- _this.parentName = {
- deptName: _e.label,
- deptId: _e.id
- };
- this.$refs.conSelect.blur();
- },
- clearSel(_row){
- _this.nowForm[_row] = [];
- },
- setSnLi(_row){
- let data1 = {};
- let _opts = {
- url: "/system/user/" + _row.userId,
- type:"GET"
- };
- tokenAjax(_opts, data1)
- .then(function(res) {
- if (res.code == 200) {
- _this.snConf = res.data;
- _this.snSel = _row.remark == null?[]:_row.remark.split(",");
- _this.snSel = _this.snSel.map(item => parseFloat(item))
- _this.snConf.postIds = res.postIds;
- _this.snConf.roleIds = res.roleIds;
- _this.snDialog = true;
- }
- })
- },
- upDateSn(){
- if(_this.snConf.userId != undefined){
- _this.snConf.remark = _this.snSel.toString();
- let data1 = _this.snConf;
- let _opts = {
- url:"/system/user",
- type: "PUT"
- };
- tokenPostAjax(_opts,data1)
- .then(function(res){
- if(res.code == 200){
- _this.$message({
- type: 'success',
- message: '操作成功!'
- });
- _this.getList();
- _this.snDialog = false;
- }else{
- _this.$message.error(res.msg);
- }
- })
- }
- }
- }
- })
- </script>
- </body>
-
- </html>
|