tb-terminal-add.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>设备管理-添加/修改</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  8. <!-- 所有的 css js 资源 -->
  9. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  10. <link rel="stylesheet" href="../../static/sa.css">
  11. <script src="../../static/kj/vue.min.js"></script>
  12. <script src="../../static/kj/element-ui/index.js"></script>
  13. <script src="../../static/kj/httpVueLoader.js"></script>
  14. <script src="../../static/kj/jquery.min.js"></script>
  15. <script src="../../static/kj/layer/layer.js"></script>
  16. <script src="../../static/sa.js"></script>
  17. <style type="text/css">
  18. .c-panel .el-form .c-label {
  19. width: 7em !important;
  20. }
  21. .c-panel .el-form .el-input,
  22. .c-panel .el-form .el-textarea__inner {
  23. width: 250px;
  24. }
  25. </style>
  26. </head>
  27. <body>
  28. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  29. <!-- ------- 内容部分 ------- -->
  30. <div class="s-body">
  31. <div class="c-panel">
  32. <div class="c-title" v-if="id == 0">数据添加</div>
  33. <div class="c-title" v-else>数据修改</div>
  34. <el-form v-if="m">
  35. <sa-item type="text" name="名称" v-model="m.name" br need></sa-item>
  36. <div class="c-item">
  37. <label class="c-label"><span style="color: red;">*</span>入场通道:</label>
  38. <el-select v-model="m.channelId" placeholder="请选择">
  39. <el-option-group v-for="(area,index) in areaList" :key="index" :label="area.name">
  40. <el-option v-for="item in area.children" :key="item.id" :label="item.name"
  41. :value="item.id">
  42. </el-option>
  43. </el-option-group>
  44. </el-select>
  45. </div>
  46. <sa-item type="enum" name="方向" v-model="m.direction" :jv="{1: '入场', 2: '离场'}" jtype="3" br></sa-item>
  47. <sa-item type="textarea" name="备注" v-model="m.remark" br></sa-item>
  48. <sa-item name="" class="s-ok" br>
  49. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  50. </sa-item>
  51. </el-form>
  52. </div>
  53. </div>
  54. <!-- ------- 底部按钮 ------- -->
  55. <div class="s-foot">
  56. <el-button type="primary" @click="ok()">确定</el-button>
  57. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  58. </div>
  59. </div>
  60. <script>
  61. var app = new Vue({
  62. components: {
  63. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  64. },
  65. el: '.vue-box',
  66. data: {
  67. areaList: [],
  68. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  69. m: {
  70. id: '', //
  71. deptId: '', // 单位ID
  72. name: '', // 名称
  73. ipAddress: '', // IP地址
  74. state: '', // 状态(0=离线,1=正常 no-add no-s)
  75. sn: '', // 序列号
  76. venuesId: '', // 场所ID
  77. direction:1,
  78. venuesName: '', // 场所名称
  79. channelId: '', // 通道ID
  80. channelName: '', // 通道名称
  81. remark: '', // 备注
  82. }, // 实体对象
  83. },
  84. methods: {
  85. getVenuesList() {
  86. sa.ajax('/TbVenues/getTree', function(res) {
  87. this.areaList = res.data; // 数据
  88. }.bind(this));
  89. },
  90. // 提交数据
  91. ok: function() {
  92. // 表单校验
  93. let m = this.m;
  94. sa.checkNull(m.name, '请输入 [名称]');
  95. sa.checkNull(m.channelId, '请选择 [通道]');
  96. // 开始增加或修改
  97. m = sa.removeNull(m);
  98. sa.ajax('/TbTerminal/update', m, function(res) {
  99. sa.alert('修改成功', this.clean);
  100. }.bind(this));
  101. },
  102. // 添加/修改 完成后的动作
  103. clean: function() {
  104. parent.app.f5(); // 刷新父页面列表
  105. sa.closeCurrIframe(); // 关闭本页
  106. }
  107. },
  108. mounted: function() {
  109. this.getVenuesList();
  110. // 初始化数据
  111. sa.ajax('/TbTerminal/getById?id=' + this.id, function(res) {
  112. this.m = res.data;
  113. if (res.data == null) {
  114. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  115. }
  116. }.bind(this))
  117. }
  118. })
  119. </script>
  120. </body>
  121. </html>