deviceEdit.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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.card"></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. "deviceNo":'dsds',
  86. "deviceName":'sds',
  87. "userName": "sss",
  88. "place": "sss",
  89. "card":'dd',
  90. "longitude": "",
  91. "dimension": "",
  92. "contactor": "",
  93. "mobile": "",
  94. },
  95. // 站点多选下拉
  96. data2: [
  97. {id: 1, value: '选项1'},
  98. {id: 2, value: '选项2'},
  99. {id: 3, value: '选项3'},
  100. {id: 4, value: '选项4'},
  101. {id: 5, value: '选项5'},
  102. {id: 6, value: '这是6'},
  103. {id: 7, value: '这是7'},
  104. {id: 8, value: '这是8'},
  105. {id: 9, value: '这是9'},
  106. {id: 10, value: '这是10'},
  107. ],
  108. // 站点多选下拉 end
  109. }
  110. },
  111. onLoad: function(option) {
  112. },
  113. methods: {
  114. // 站点多选下拉
  115. getBackVal:function(e){
  116. console.log(e)
  117. },
  118. // 站点多选下拉 end
  119. formSubmit: function(e) {
  120. console.log('form发生了submit事件,携带数据为:' + JSON.stringify(e.detail.value))
  121. //定义表单规则
  122. var rule = [{
  123. name: "userName",
  124. checkType: "string",
  125. checkRule: "1,3",
  126. errorMsg: "姓名应为1-3个字符..."
  127. },
  128. // {name:"gender", checkType : "in", checkRule:"男,女", errorMsg:"请选择性别"},
  129. // {name:"loves", checkType : "notnull", checkRule:"", errorMsg:"请选择爱好"}
  130. ];
  131. //进行表单检查
  132. var formData = e.detail.value;
  133. var checkRes = graceChecker.check(formData, rule);
  134. if (checkRes) {
  135. uni.showToast({
  136. title: "验证通过!",
  137. icon: "none"
  138. });
  139. } else {
  140. uni.showToast({
  141. title: graceChecker.error,
  142. icon: "none"
  143. });
  144. }
  145. },
  146. formReset: function(e) {
  147. console.log('清空数据')
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss">
  153. input,
  154. select,
  155. option {
  156. line-height: 70rpx;
  157. padding: 0 20rpx;
  158. height: 70rpx;
  159. border: 1px solid #EDEDED;
  160. // width:500rpx!important;
  161. background-color: #fff;
  162. box-sizing: border-box;
  163. appearance: none;
  164. -moz-appearance: none;
  165. -webkit-appearance: none;
  166. color: #999;
  167. }
  168. /* 站点多选下拉样式end */
  169. </style>