deviceMan.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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. .br{
  94. border: 1px solid rgba(255, 255, 255, 0.2);
  95. }
  96. ._Form{
  97. flex:1;
  98. flex-direction: column;
  99. border-right: 1px solid rgba(255, 255, 255, 0.2);
  100. }
  101. ._Form>div{
  102. height: 20%;
  103. min-height: 60px;
  104. border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  105. }
  106. ._Form>div>div:first-child{
  107. display: flex;
  108. align-items: center;
  109. justify-content: center;
  110. width: 100px;
  111. height: 100%;
  112. min-height: 60px;
  113. border-right: 1px solid rgba(255, 255, 255, 0.2);
  114. }
  115. ._Form>div>div:last-child{
  116. width: calc(100% - 100px);
  117. padding: 0 10px;
  118. }
  119. .el-input__inner{
  120. height: 34px;
  121. line-height: 34px;
  122. }
  123. .el-input__inner,._Form .el-textarea__inner{
  124. color: #ececec;
  125. border-color: transparent;
  126. background-color: rgba(255, 255, 255, 0.2);
  127. }
  128. .el-input__inner::-webkit-input-placeholder {
  129. color: #b9b9b9;
  130. }
  131. ._Form .el-radio{
  132. color: #fff;
  133. }
  134. .el-radio__input.is-checked .el-radio__inner,
  135. .el-checkbox__input.is-checked .el-checkbox__inner,
  136. .el-checkbox__input.is-indeterminate .el-checkbox__inner,
  137. .el-button--success{
  138. border-color: #39b54a;
  139. background: #39b54a;
  140. }
  141. .el-radio__input.is-checked+.el-radio__label{
  142. color: #39b54a;
  143. }
  144. </style>
  145. </head>
  146. <body>
  147. <div id="app">
  148. <div>
  149. <div class="flex align-center margin-bottom-sm">
  150. <div>
  151. <el-input placeholder="请输入关键词" v-model="inpKey" @input="_Search">
  152. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  153. </el-input>
  154. </div>
  155. <div class="tableTool">
  156. <el-button type="primary" size="small" class="margin-left-sm">查询</el-button>
  157. <el-button type="success" size="small" @click="newAdd">新增</el-button>
  158. </div>
  159. </div>
  160. <el-table class="elTable" :data="tableData" border :header-cell-style="{background:'#082041',color:'#fff'}">
  161. <el-table-column align="center" type="index" label="序号" width="50"> </el-table-column>
  162. <el-table-column align="center" prop="sn" label="设备编号"> </el-table-column>
  163. <el-table-column align="center" prop="prod" label="船舶名称"> </el-table-column>
  164. <el-table-column align="center" prop="mdev" label="船舶mmsi"> </el-table-column>
  165. <el-table-column align="center" prop="devicelist" label="监控ID"> </el-table-column>
  166. <el-table-column align="center" prop="helmId" label="安全帽ID"> </el-table-column>
  167. <el-table-column align="center" prop="chatId" label="易站聊ID"> </el-table-column>
  168. <!-- <el-table-column align="center" prop="status" label="状态">
  169. <template slot-scope="scope">
  170. <el-switch
  171. :value="scope.row.status == 0"
  172. disabled
  173. active-color="#13ce66"
  174. inactive-color="#cecece">
  175. </el-switch>
  176. </template>
  177. </el-table-column>
  178. <el-table-column align="center" prop="createTime" label="创建时间"> </el-table-column> -->
  179. <el-table-column
  180. align="center"
  181. width="140"
  182. label="操作">
  183. <template slot-scope="scope" v-if="!scope.row.admin">
  184. <el-button type="text" size="small" @click="Edit(scope.row)" class="text-green"><i class="el-icon-edit"></i>编辑</el-button>
  185. <el-button type="text" size="small" @click="Delete(scope.row)" class="text-red"><i class="el-icon-delete"></i>删除</el-button>
  186. </template>
  187. </el-table-column>
  188. </el-table>
  189. </div>
  190. <el-dialog title="船舶信息" :visible.sync="dialogVisible" width="800px">
  191. <div class="flex br" style="text-align: center;">
  192. <div class="_Form">
  193. <div class="flex align-center">
  194. <div><span class="text-red">*</span>设备编号</div>
  195. <div><el-input v-model="nowForm.sn" :disabled="nowForm.id" placeholder="设备编号"></el-input></div>
  196. </div>
  197. <div class="flex align-center">
  198. <div><span class="text-red">*</span>船舶mmsi</div>
  199. <div><el-input v-model="nowForm.mdev" placeholder="船舶mmsi"></el-input></div>
  200. </div>
  201. <div class="flex align-center">
  202. <div>安全帽ID</div>
  203. <div><el-input v-model="nowForm.helmId" placeholder="安全帽ID"></el-input></div>
  204. </div>
  205. <div class="flex align-center">
  206. <div><span class="text-red">*</span>船舶mdev(mmsi)</div>
  207. <div><el-input v-model="nowForm.mmsi" placeholder="船舶mmsi"></el-input></div>
  208. </div>
  209. </div>
  210. <div class="_Form" style="border: none;">
  211. <div class="flex align-center">
  212. <div><span class="text-red">*</span>船舶名称</div>
  213. <div><el-input v-model="nowForm.prod" placeholder="船舶名称"></el-input></div>
  214. </div>
  215. <div class="flex align-center">
  216. <div>监控ID</div>
  217. <div><el-input v-model="nowForm.devicelist" placeholder="监控ID"></el-input></div>
  218. </div>
  219. <div class="flex align-center">
  220. <div>易站聊ID</div>
  221. <div><el-input v-model="nowForm.chatId" placeholder="易站聊ID"></el-input></div>
  222. </div>
  223. </div>
  224. </div>
  225. <div class="padding-sm text-center">
  226. <el-button size="small" @click="dialogVisible = false;">取消</el-button>
  227. <el-button size="small" type="success" @click="conFirm">提交</el-button>
  228. </div>
  229. </el-dialog>
  230. </div>
  231. <script>
  232. var _this, dataObj=[];
  233. new Vue({
  234. el: '#app',
  235. data: function() {
  236. return {
  237. tableData: [],
  238. nowForm:{},
  239. dialogVisible:false,
  240. inpKey:""
  241. }
  242. },
  243. created() {
  244. _this = this;
  245. _this.getList();
  246. },
  247. methods: {
  248. getList() {
  249. let data1 = {};
  250. let _opts = {
  251. url: "/iBoat/iBoat/list",
  252. type:"GET"
  253. };
  254. tokenAjax(_opts, data1)
  255. .then(function(res) {
  256. if (res.code == 200) {
  257. _this.tableData = res.rows;
  258. dataObj = res.rows;
  259. sessionStorage.setItem("iBoatList",JSON.stringify(res.rows));
  260. }else{
  261. _this.$message.error(res.msg);
  262. }
  263. })
  264. },
  265. _Search(_key){
  266. let newArr = [],_ovj = dataObj;
  267. if(_key == ""){
  268. newArr = dataObj;
  269. }else{
  270. for(var i=0;i<_ovj.length;i++){
  271. if( JSON.stringify(_ovj[i]).indexOf(_key) != -1){
  272. newArr.push(_ovj[i])
  273. }
  274. }
  275. }
  276. _this.tableData = newArr;
  277. },
  278. newAdd(){
  279. _this.nowForm = {
  280. id: undefined,
  281. sn: null,
  282. prod: "",
  283. mmsi:null,
  284. mdev: null,
  285. devicelist: null,
  286. taskId: null,
  287. helmId: null,
  288. chatId: null
  289. };
  290. _this.dialogVisible = true;
  291. },
  292. Edit(_row){
  293. let data1 = {};
  294. let _opts = {
  295. url: "/iBoat/iBoat/" + _row.id,
  296. type:"GET"
  297. };
  298. tokenAjax(_opts, data1)
  299. .then(function(res) {
  300. if (res.code == 200) {
  301. _this.nowForm = res.data;
  302. _this.dialogVisible = true;
  303. }
  304. })
  305. },
  306. Delete(_row){
  307. _this.$confirm('是否确认删除船舶"'+_row.prod+'"?', '温馨提示', {
  308. confirmButtonText: '确定',
  309. cancelButtonText: '取消',
  310. type: 'warning'
  311. }).then(() => {
  312. let data1 = {};
  313. let _opts = {
  314. url: "/iBoat/iBoat/"+_row.id,
  315. type:"DELETE"
  316. };
  317. tokenAjax(_opts, data1)
  318. .then(function(res) {
  319. if(res.code == 200){
  320. _this.$message({
  321. type: 'success',
  322. message: '删除成功!'
  323. });
  324. _this.getList();
  325. }else{
  326. _this.$message.error(res.msg);
  327. }
  328. })
  329. }).catch(() => {
  330. });
  331. },
  332. conFirm(){
  333. if(_this.nowForm.sn == "" || _this.nowForm.sn == null){
  334. _this.$message({
  335. type: 'warning',
  336. message: "请输入设备编号"
  337. });
  338. return;
  339. }
  340. if(_this.nowForm.prod == "" || _this.nowForm.prod == null){
  341. _this.$message({
  342. type: 'warning',
  343. message: "请输入船舶名称"
  344. });
  345. return;
  346. }
  347. if(_this.nowForm.mdev == "" || _this.nowForm.mdev == null){
  348. _this.$message({
  349. type: 'warning',
  350. message: "请输入船舶mmsi"
  351. });
  352. return;
  353. }
  354. let data1 = _this.nowForm;
  355. let _opts = {
  356. url:"/iBoat/iBoat",
  357. type: _this.nowForm.id == undefined?"POST":"PUT"
  358. };
  359. tokenPostAjax(_opts,data1)
  360. .then(function(res){
  361. if(res.code == 200){
  362. _this.$message({
  363. type: 'success',
  364. message: '操作成功!'
  365. });
  366. _this.getList();
  367. _this.dialogVisible = false;
  368. }else{
  369. _this.$message.error(res.msg);
  370. }
  371. })
  372. }
  373. }
  374. })
  375. </script>
  376. </body>
  377. </html>