deviceAdd.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="appWrapper padding-top">
  3. <form action="">
  4. <view class="form-item ">
  5. <view class="title">
  6. <text class="necessary">*</text>
  7. 设备编号:
  8. </view>
  9. <input name="input" v-model="formMess.deviceNo"></input>
  10. </view>
  11. <view class="form-item">
  12. <view class="title"><text class="necessary">*</text>设备名称:</view>
  13. <input name="input" v-model="formMess.deviceName"></input>
  14. </view>
  15. <view class="form-item">
  16. <view class="title"><text class="necessary">*</text>单元地址:</view>
  17. <input name="input" v-model="formMess.place"></input>
  18. </view>
  19. <view class="form-item">
  20. <view class="title"><text class="necessary">*</text>所属楼层:</view>
  21. <select name="" id="">
  22. <option value="">楼层一</option>
  23. <option value="">楼层一</option>
  24. <option value="">楼层一</option>
  25. </select>
  26. </view>
  27. <view class="form-item">
  28. <view class="title">物联网卡号:</view>
  29. <input name="input" v-model="formMess.place"></input>
  30. </view>
  31. <view class="form-item">
  32. <view class="title"><text class="necessary">*</text>所属单位:</view>
  33. <select name="" id="">
  34. <option value="">楼层一</option>
  35. <option value="">楼层一</option>
  36. <option value="">楼层一</option>
  37. </select>
  38. </view>
  39. <view class="form-item">
  40. <view class="title"><text class="necessary">*</text>设备类型:</view>
  41. <select name="" id="">
  42. <option value="">类型一</option>
  43. <option value="">类型一</option>
  44. <option value="">类型一</option>
  45. </select>
  46. </view>
  47. <view class="form-item">
  48. <view class="title"><text class="necessary">*</text>传输方式:</view>
  49. <select name="" id="">
  50. <option value="">方式一</option>
  51. <option value="">方式一</option>
  52. <option value="">方式一</option>
  53. </select>
  54. </view>
  55. <view class="form-item margin-top">
  56. <view class="title">
  57. <text class="necessary">*</text>
  58. 是否顶楼
  59. </view>
  60. <radio-group name="gender">
  61. <label class="margin-right">
  62. <radio value="是"/><text>是</text>
  63. </label>
  64. <label>
  65. <radio value="否" checked /><text>否</text>
  66. </label>
  67. </radio-group>
  68. </view>
  69. <view class="btn-area submitBottomBtn padding-lr-sm">
  70. <button class="bg-blue round margin-top">提 交 </button>
  71. </view>
  72. </form>
  73. </view>
  74. </template>
  75. <script>
  76. // var graceChecker = require("../../common/graceChecker.js");
  77. // import add from '../../common/select.js';
  78. export default {
  79. data() {
  80. return {
  81. index: -1,
  82. picker: ['楼层一', '楼层二', '楼层三'],
  83. type: '0',
  84. formMess: {
  85. "userName": "sss",
  86. "place": "",
  87. "longitude": "",
  88. "dimension": "",
  89. "contactor": "",
  90. "mobile": "",
  91. },
  92. // 站点多选下拉
  93. data2: [
  94. {id: 1, value: '选项1'},
  95. {id: 2, value: '选项2'},
  96. {id: 3, value: '选项3'},
  97. {id: 4, value: '选项4'},
  98. {id: 5, value: '选项5'},
  99. {id: 6, value: '这是6'},
  100. {id: 7, value: '这是7'},
  101. {id: 8, value: '这是8'},
  102. {id: 9, value: '这是9'},
  103. {id: 10, value: '这是10'},
  104. ],
  105. // 站点多选下拉 end
  106. }
  107. },
  108. onLoad: function(option) {
  109. },
  110. methods: {
  111. // 站点多选下拉
  112. getBackVal:function(e){
  113. console.log(e)
  114. },
  115. // 站点多选下拉 end
  116. formSubmit: function(e) {
  117. console.log('form发生了submit事件,携带数据为:' + JSON.stringify(e.detail.value))
  118. //定义表单规则
  119. var rule = [{
  120. name: "userName",
  121. checkType: "string",
  122. checkRule: "1,3",
  123. errorMsg: "姓名应为1-3个字符..."
  124. },
  125. // {name:"gender", checkType : "in", checkRule:"男,女", errorMsg:"请选择性别"},
  126. // {name:"loves", checkType : "notnull", checkRule:"", errorMsg:"请选择爱好"}
  127. ];
  128. //进行表单检查
  129. var formData = e.detail.value;
  130. var checkRes = graceChecker.check(formData, rule);
  131. if (checkRes) {
  132. uni.showToast({
  133. title: "验证通过!",
  134. icon: "none"
  135. });
  136. } else {
  137. uni.showToast({
  138. title: graceChecker.error,
  139. icon: "none"
  140. });
  141. }
  142. },
  143. formReset: function(e) {
  144. console.log('清空数据')
  145. }
  146. }
  147. }
  148. </script>
  149. <style lang="scss">
  150. input,
  151. select,
  152. option {
  153. line-height: 70rpx;
  154. padding: 0 20rpx;
  155. height: 70rpx;
  156. border: 1px solid #EDEDED;
  157. // width:500rpx!important;
  158. background-color: #fff;
  159. box-sizing: border-box;
  160. appearance: none;
  161. -moz-appearance: none;
  162. -webkit-appearance: none;
  163. color: #999;
  164. }
  165. /* 站点多选下拉样式end */
  166. </style>