snMa.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta name="renderer" content="webkit">
  5. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  6. <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
  7. <meta http-equiv="pragma" content="no-cache">
  8. <meta http-equiv="Cache" content="no-cache">
  9. <meta http-equiv="cache-control" content="no-cache, must-revalidate">
  10. <meta http-equiv="expires" content="0">
  11. <meta name="viewport"
  12. content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  13. <title>用户管理</title>
  14. <link rel="stylesheet" href="../css/index.css">
  15. <link rel="stylesheet" href="../css/style.css">
  16. <script src="../js/vue.min.js"></script>
  17. <script src="../js/jquery.min.js"></script>
  18. <script src="../js/index.js"></script>
  19. <script src="../js/yz/init.js"></script>
  20. <script>
  21. checkLogin();
  22. </script>
  23. <style type="text/css">
  24. *{
  25. padding: 0;
  26. margin: 0;
  27. box-sizing: border-box;
  28. }
  29. body{
  30. padding: 10px;
  31. background-color: #040d32;
  32. }
  33. .search_ input {
  34. position: relative;
  35. width: 100%;
  36. height: 32px;
  37. line-height: 32px;
  38. border-radius: 4px;
  39. font-size: 14px;
  40. padding: 0 5px 0 25px;
  41. color: #dcdcdc;
  42. background-color: rgba(255, 255, 255, 0.2);
  43. border: 1px solid rgba(232, 232, 232, 0.3);
  44. }
  45. .search_ input::-webkit-input-placeholder {
  46. color: #dcdcdc;
  47. }
  48. .search_ .el-icon-search {
  49. position: absolute;
  50. left: 12px;
  51. top: 16px;
  52. color: #dcdcdc;
  53. }
  54. .elTable{
  55. width: 100%;
  56. border: 1px solid rgba(255, 255, 255, 0.2);
  57. }
  58. .el-table::before{
  59. height: 0;
  60. }
  61. .el-table::after{
  62. width: 0;
  63. }
  64. .el-table,.el-table__expanded-cell {
  65. color: #ddd;
  66. background-color: transparent !important;
  67. }
  68. .el-table tr,
  69. .el-table td {
  70. font-size: 14px;
  71. background-color: transparent !important;
  72. }
  73. .el-table td.el-table__cell,.el-table th.el-table__cell.is-leaf{
  74. border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  75. }
  76. .el-table--border .el-table__cell{
  77. border-right: 1px solid rgba(255, 255, 255, 0.2);
  78. }
  79. .el-dialog__header{
  80. padding: 10px;
  81. }
  82. .el-dialog__title{
  83. font-size: 15px;
  84. }
  85. .el-dialog__headerbtn{
  86. top: 14px;
  87. }
  88. .el-dialog__body{
  89. padding: 10px;
  90. color: #fff;
  91. background-color: #082041;
  92. }
  93. .el-dialog__body p{
  94. text-indent: inherit;
  95. }
  96. .br{
  97. border: 1px solid rgba(255, 255, 255, 0.2);
  98. }
  99. ._Form{
  100. flex:1;
  101. flex-direction: column;
  102. }
  103. ._Form>div{
  104. height: 14.3%;
  105. min-height: 60px;
  106. border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  107. }
  108. ._Form>div>div:first-child{
  109. display: flex;
  110. align-items: center;
  111. justify-content: center;
  112. width: 100px;
  113. height: 100%;
  114. min-height: 60px;
  115. border-right: 1px solid rgba(255, 255, 255, 0.2);
  116. }
  117. ._Form>div>div:last-child{
  118. width: calc(100% - 100px);
  119. padding: 0 10px;
  120. }
  121. .el-input__inner{
  122. height: 34px;
  123. line-height: 34px;
  124. }
  125. .el-input__inner,._Form .el-textarea__inner{
  126. color: #ececec;
  127. border-color: transparent;
  128. background-color: rgba(255, 255, 255, 0.2);
  129. }
  130. .el-input__inner::-webkit-input-placeholder {
  131. color: #b9b9b9;
  132. }
  133. ._Form .el-radio{
  134. color: #fff;
  135. }
  136. .el-radio__input.is-checked .el-radio__inner,
  137. .el-checkbox__input.is-checked .el-checkbox__inner,
  138. .el-checkbox__input.is-indeterminate .el-checkbox__inner,
  139. .el-button--success{
  140. border-color: #39b54a;
  141. background: #39b54a;
  142. }
  143. .el-radio__input.is-checked+.el-radio__label{
  144. color: #39b54a;
  145. }
  146. .el-select-dropdown__item{
  147. color: #fff;
  148. }
  149. </style>
  150. </head>
  151. <body>
  152. <div id="app">
  153. <div>
  154. <div class="flex align-center margin-bottom-sm">
  155. <div>
  156. <el-input placeholder="请输入船舶名称" v-model="queryParams.iboatName">
  157. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  158. </el-input>
  159. </div>
  160. <div class="tableTool">
  161. <el-button type="primary" size="small" @click="inpSearch" class="margin-left-sm">查询</el-button>
  162. <el-button type="success" size="small" @click="newAdd">新增</el-button>
  163. </div>
  164. </div>
  165. <el-table class="elTable" :data="tableData" border :header-cell-style="{background:'#082041',color:'#fff'}">
  166. <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
  167. <el-table-column align="center" prop="iboatName" label="船舶名称"> </el-table-column>
  168. <el-table-column align="center" prop="sn" label="设备sn"> </el-table-column>
  169. <el-table-column align="center" prop="sheet" label="mmsi"> </el-table-column>
  170. <el-table-column align="center" prop="state" label="状态">
  171. <template slot-scope="scope">
  172. <el-switch
  173. :value="scope.row.state == 0"
  174. disabled
  175. active-color="#13ce66"
  176. inactive-color="#ff4949">
  177. </el-switch>
  178. </template>
  179. </el-table-column>
  180. <el-table-column
  181. align="center"
  182. width="220"
  183. label="操作">
  184. <template slot-scope="scope" v-if="!scope.row.admin">
  185. <el-button type="text" size="small" @click="setUserLi(scope.row)" class="text-sray"><i class="el-icon-user"></i>配置用户</el-button>
  186. <el-button type="text" size="small" @click="Edit(scope.row)" class="text-green"><i class="el-icon-edit"></i>编辑</el-button>
  187. <el-button type="text" size="small" @click="Delete(scope.row)" class="text-red"><i class="el-icon-delete"></i>删除</el-button>
  188. </template>
  189. </el-table-column>
  190. </el-table>
  191. <el-pagination v-show="allTotal > 0" :total="allTotal"
  192. :page-size="queryParams.pageSize" background
  193. @current-change="handlePageChange"></el-pagination>
  194. </div>
  195. <el-dialog title="设备信息" :visible.sync="dialogVisible" width="40%">
  196. <div class="flex br" style="text-align: center;">
  197. <div class="_Form">
  198. <div class="flex align-center">
  199. <div><span class="text-red">*</span>船舶名称</div>
  200. <div><el-input v-model="nowForm.iboatName" placeholder="船舶名称"></el-input></div>
  201. </div>
  202. <div class="flex align-center">
  203. <div><span class="text-red">*</span>设备sn</div>
  204. <div><el-input v-model="nowForm.sn" placeholder="设备sn"></el-input></div>
  205. </div>
  206. <div class="flex align-center">
  207. <div>mmsi</div>
  208. <div><el-input v-model="nowForm.sheet" placeholder="mmsi"></el-input></div>
  209. </div>
  210. <div class="flex align-center" style="border: none;">
  211. <div>状态</div>
  212. <div class="text-left">
  213. <el-radio v-model="nowForm.state" :label="0">正常</el-radio>
  214. <el-radio v-model="nowForm.state" :label="1">停用</el-radio>
  215. </div>
  216. </div>
  217. </div>
  218. </div>
  219. <div class="padding-sm text-center">
  220. <el-button size="small" @click="dialogVisible = false;">取消</el-button>
  221. <el-button size="small" type="success" @click="conFirm">提交</el-button>
  222. </div>
  223. </el-dialog>
  224. <el-dialog title="配置用户" :visible.sync="pwdDialog" width="610px">
  225. <div>
  226. <el-transfer
  227. v-model="userSel"
  228. :props="{
  229. key: 'userId',
  230. label: 'nickName'
  231. }"
  232. :titles="['用户', '已选']"
  233. :data="userData"></el-transfer>
  234. </div>
  235. <div class="text-center">
  236. <el-button size="small" @click="pwdDialog = false">取 消</el-button>
  237. <el-button size="small" type="success" @click="updateConfigUser">确 定</el-button>
  238. </div>
  239. </el-dialog>
  240. </div>
  241. <script>
  242. var _this, dataObj=[];
  243. new Vue({
  244. el: '#app',
  245. data: function() {
  246. return {
  247. tableData: [],
  248. allTotal: 0,
  249. queryParams: {
  250. pageNum:1,
  251. pageSize:10
  252. },
  253. nowForm:{},
  254. dialogVisible:false,
  255. inpKey:"",
  256. pwdDialog:false,
  257. pwdInfo:{
  258. userId:null,
  259. newPwd:"",
  260. pwdName:null
  261. },
  262. userData: [],
  263. userSel: [],
  264. userConf: {}
  265. }
  266. },
  267. created() {
  268. _this = this;
  269. _this.reSet();
  270. _this.getList();
  271. _this.getUser();
  272. },
  273. methods: {
  274. getList() {
  275. let data1 = _this.queryParams;
  276. let _opts = {
  277. url: "/config/config/list",
  278. type:"GET"
  279. };
  280. tokenAjax(_opts, data1)
  281. .then(function(res) {
  282. if (res.code == 200) {
  283. let _obj = res.rows;
  284. _this.tableData = _obj;
  285. _this.allTotal = res.total;
  286. dataObj = _obj;
  287. }else{
  288. _this.$message.error(res.msg);
  289. }
  290. })
  291. },
  292. getUser() {
  293. let data1 = {};
  294. let _opts = {
  295. url: "/config/config/selectUserAll",
  296. type:"GET"
  297. };
  298. tokenAjax(_opts, data1)
  299. .then(function(res) {
  300. if (res.code == 200) {
  301. _this.userData = res.rows;
  302. }else{
  303. _this.$message.error(res.msg);
  304. }
  305. })
  306. },
  307. getById(row) {
  308. let _opts = {
  309. url: "/config/config/list/"+row.id,
  310. type:"GET"
  311. };
  312. tokenAjax(_opts, data1)
  313. .then(function(res) {
  314. if (res.code == 200) {
  315. let _obj = res.rows;
  316. _this.dialogVisible = true;
  317. }else{
  318. _this.$message.error(res.msg);
  319. }
  320. })
  321. },
  322. handlePageChange(val){
  323. _this.queryParams.pageNum = val;
  324. _this.getList();
  325. },
  326. inpSearch(_key){
  327. _this.queryParams.pageNum = 1;
  328. _this.getList();
  329. },
  330. reSet() {
  331. _this.nowForm = {
  332. iboatName: "",
  333. sn: "",
  334. mmsi: null,
  335. mdev: "",
  336. sheet: null,
  337. taskId: null,
  338. state: 0,
  339. remark: ""
  340. };
  341. },
  342. newAdd(){
  343. _this.reSet();
  344. _this.dialogVisible = true;
  345. },
  346. Edit(_row){
  347. let data1 = {};
  348. let _opts = {
  349. url: "/config/config/" + _row.id,
  350. type:"GET"
  351. };
  352. tokenAjax(_opts, data1)
  353. .then(function(res) {
  354. if (res.code == 200) {
  355. _this.nowForm = res.data;
  356. _this.dialogVisible = true;
  357. }
  358. })
  359. },
  360. Delete(_row){
  361. _this.$confirm('是否确认删除编号为"'+_row.id+'"的数据项?', '温馨提示', {
  362. confirmButtonText: '确定',
  363. cancelButtonText: '取消',
  364. type: 'warning'
  365. }).then(() => {
  366. let data1 = {};
  367. let _opts = {
  368. url: "/config/config/"+_row.id,
  369. type:"DELETE"
  370. };
  371. tokenAjax(_opts, data1)
  372. .then(function(res) {
  373. if(res.code == 200){
  374. _this.$message({
  375. type: 'success',
  376. message: '删除成功!'
  377. });
  378. _this.getList();
  379. }else{
  380. _this.$message.error(res.msg);
  381. }
  382. })
  383. }).catch(() => {
  384. });
  385. },
  386. setUserLi(_row){
  387. let data1 = {};
  388. let _opts = {
  389. url: "/config/config/configUserlist?id="+_row.id+"&cnfigId="+_row.id,
  390. type:"GET"
  391. };
  392. tokenAjax(_opts, data1)
  393. .then(function(res) {
  394. if (res.code == 200) {
  395. _this.userConf = _row;
  396. _this.userSel = res.rows.map(item => item.userId);
  397. _this.userSel = Array.from(new Set(_this.userSel))
  398. _this.pwdDialog = true;
  399. }else{
  400. _this.$message.error(res.msg);
  401. }
  402. })
  403. },
  404. updateConfigUser(){
  405. let data1 = {
  406. id: _this.userConf.id,
  407. userIds: _this.userSel.toString(),
  408. };
  409. let _opts = {
  410. url:"/config/config/updateConfigUser",
  411. type: "GET"
  412. };
  413. tokenAjax(_opts,data1)
  414. .then(function(res){
  415. if(res.code == 200){
  416. _this.$message({
  417. type: 'success',
  418. message: '操作成功!'
  419. });
  420. _this.pwdDialog = false;
  421. }else{
  422. _this.$message.error(res.msg);
  423. }
  424. })
  425. },
  426. conFirm(){
  427. if(_this.nowForm.iboatName == ""){
  428. _this.$message({
  429. type: 'warning',
  430. message: "请输入船舶名称"
  431. });
  432. return;
  433. }
  434. if(_this.nowForm.sn == ""){
  435. _this.$message({
  436. type: 'warning',
  437. message: "请输入设备sn"
  438. });
  439. return;
  440. }
  441. // if(_this.nowForm.mdev == ""){
  442. // _this.$message({
  443. // type: 'warning',
  444. // message: "请输入权限字符"
  445. // });
  446. // return;
  447. // }
  448. // _this.nowForm.sns = _this.nowForm.mmsi+","+_this.nowForm.mdev+","+_this.nowForm.taskId;
  449. let data1 = _this.nowForm;
  450. let _opts = {
  451. url:"/config/config",
  452. type: _this.nowForm.id == undefined?"POST":"PUT"
  453. };
  454. tokenPostAjax(_opts,data1)
  455. .then(function(res){
  456. if(res.code == 200){
  457. _this.$message({
  458. type: 'success',
  459. message: '操作成功!'
  460. });
  461. _this.getList();
  462. _this.dialogVisible = false;
  463. }else{
  464. _this.$message.error(res.msg);
  465. }
  466. })
  467. }
  468. }
  469. })
  470. </script>
  471. </body>
  472. </html>