perAdd.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <view class="appWrapper">
  3. <form action="">
  4. <view style="height:30rpx"></view>
  5. <view class="form-item">
  6. <view class="title">
  7. <text class="necessary">*</text>
  8. 联系方式:
  9. </view>
  10. <input name="input" v-model="formMess.deviceNo"></input>
  11. </view>
  12. <view class="form-item">
  13. <view class="title">姓名:</view>
  14. <input name="input" v-model="formMess.deviceName"></input>
  15. </view>
  16. <view class="form-item">
  17. <view class="title">所在单位:</view>
  18. <select name="" id="">
  19. <option value="">虹泾总部园</option>
  20. <option value="">单位二</option>
  21. <option value="">单位三</option>
  22. </select>
  23. </view>
  24. <view class="form-item">
  25. <view class="title">角色权限:</view>
  26. <radio-group name="gender">
  27. <label class="margin-right">
  28. <radio value="管理员" checked /><text>管理员</text>
  29. </label>
  30. <label>
  31. <radio value="普通员工" /><text>普通员工</text>
  32. </label>
  33. </radio-group>
  34. </view>
  35. <view class="btn-area submitBottomBtn padding-lr-sm">
  36. <button class="bg-blue round margin-top" @click="submit()">提 交 </button>
  37. </view>
  38. </form>
  39. </view>
  40. </template>
  41. <script>
  42. var graceChecker = require("../../../common/graceChecker.js");
  43. // import add from '../../common/select.js';
  44. export default {
  45. data() {
  46. return {
  47. index: -1,
  48. picker: ['楼层一', '楼层二', '楼层三'],
  49. type: '0',
  50. isShow: false,
  51. formMess: {
  52. "userName": "sss",
  53. "siteName": "",
  54. "place": "",
  55. "longitude": "",
  56. "dimension": "",
  57. "contactor": "",
  58. "mobile": "",
  59. },
  60. // 站点多选下拉
  61. siteItemData: ["站点一", "站点二", "站点三", "站点四", "站点五", "站点六"],
  62. newDataList: ["站点一", "站点二", "站点三", "站点四", "站点五", "站点六"],
  63. selectedData: [],
  64. // 站点多选下拉 end
  65. }
  66. },
  67. onLoad: function(option) {
  68. },
  69. methods: {
  70. submit() {
  71. uni.navigateTo({
  72. url: '/pages/accountManage/success/success',
  73. });
  74. },
  75. add: function(item, index) {
  76. this.selectedData.push(item);
  77. this.newDataList.splice(index, 1);
  78. this.isShow = false;
  79. this.formMess.siteName = ''
  80. },
  81. deleteItem: function(item, index) {
  82. // this.selectedData.remove(item);
  83. this.selectedDaxta.splice(index, 1);
  84. this.newDataList.push(item);
  85. },
  86. // 站点多选下拉
  87. test: function() {
  88. this.isShow = !this.isShow;
  89. },
  90. test2: function() {
  91. this.isShow = false;
  92. },
  93. handleInput() {
  94. // var newlist = this.siteItemData.filter(item => item.indexOf(this.formMess.siteName) > -1)
  95. // this.newDataList = newlist;
  96. // console.log(this.newDataList)
  97. },
  98. // 站点多选下拉 end
  99. formSubmit: function(e) {
  100. console.log('form发生了submit事件,携带数据为:' + JSON.stringify(e.detail.value))
  101. //定义表单规则
  102. var rule = [{
  103. name: "userName",
  104. checkType: "string",
  105. checkRule: "1,3",
  106. errorMsg: "姓名应为1-3个字符..."
  107. },
  108. // {name:"gender", checkType : "in", checkRule:"男,女", errorMsg:"请选择性别"},
  109. // {name:"loves", checkType : "notnull", checkRule:"", errorMsg:"请选择爱好"}
  110. ];
  111. //进行表单检查
  112. var formData = e.detail.value;
  113. var checkRes = graceChecker.check(formData, rule);
  114. if (checkRes) {
  115. uni.showToast({
  116. title: "验证通过!",
  117. icon: "none"
  118. });
  119. } else {
  120. uni.showToast({
  121. title: graceChecker.error,
  122. icon: "none"
  123. });
  124. }
  125. },
  126. formReset: function(e) {
  127. console.log('清空数据')
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang="scss">
  133. .cu-form-group {
  134. border-top: 0;
  135. }
  136. input,
  137. select,
  138. option {
  139. line-height: 70rpx;
  140. padding: 0 20rpx;
  141. height: 70rpx;
  142. border: 1px solid #EDEDED;
  143. // width:500rpx!important;
  144. background-color: #fff;
  145. box-sizing: border-box;
  146. appearance: none;
  147. -moz-appearance: none;
  148. -webkit-appearance: none;
  149. color: #999;
  150. }
  151. select:focus,
  152. select:active,
  153. select:hover {
  154. outline: none;
  155. }
  156. select {
  157. background: url(../../../static/arrow.png) no-repeat scroll 98% center;
  158. background-size: 6%;
  159. }
  160. .form-item label text {
  161. position: relative;
  162. top: 2rpx
  163. }
  164. .form-item {
  165. padding: 0 40rpx;
  166. display: flex;
  167. align-items: top;
  168. margin-bottom: 20rpx;
  169. .title {
  170. width: 170rpx;
  171. position: relative;
  172. .necessary {
  173. color: red;
  174. display: inline-block;
  175. position: absolute;
  176. top: -2rpx;
  177. left: -20rpx;
  178. font-size: 40rpx;
  179. }
  180. }
  181. input,
  182. select {
  183. width: 500rpx;
  184. font-size: 28rpx;
  185. }
  186. }
  187. /* 站点多选下拉样式 start */
  188. .layui-btn {
  189. background-color: #5fb878;
  190. }
  191. a {
  192. text-decoration: none;
  193. }
  194. .label {
  195. padding: 2px 0px;
  196. background: #aaa;
  197. border-radius: 2px;
  198. color: #fff;
  199. display: block;
  200. line-height: 20px;
  201. height: 20px;
  202. margin: 2px 5px 2px 0;
  203. float: left;
  204. }
  205. .label span {
  206. padding: 0 5px;
  207. color: #fff;
  208. }
  209. .close {
  210. padding: 1px 5px !important;
  211. }
  212. .close:hover {
  213. /* background-color: #009E94;
  214. border-radius: 2px;
  215. color: tomato; */
  216. }
  217. .selectId input {
  218. width: 100% !important;
  219. }
  220. .selectId input {
  221. height: 25px;
  222. padding: 1px 5px;
  223. border-radius: 3px;
  224. width: calc(100% - 12px);
  225. outline-color: #5fb878;
  226. border: 1px solid #5fb878;
  227. }
  228. .selectId {
  229. position: relative;
  230. }
  231. .selectId dl {
  232. border: 1px solid #eee;
  233. border-radius: 3px;
  234. margin: 2px 0px;
  235. max-height: 300px;
  236. overflow-x: hidden;
  237. white-space: nowrap;
  238. position: absolute;
  239. width: 100%;
  240. top: 40px;
  241. background: #fff;
  242. z-index: 1000
  243. }
  244. .selectId dl dd {
  245. margin: 0;
  246. padding: 5px 10px;
  247. }
  248. .selectId dl dd:hover {
  249. background-color: #5FB878;
  250. color: white;
  251. }
  252. .AD {
  253. /* width: 210px;
  254. margin-left: 40px; */
  255. overflow-y: auto;
  256. max-height: 200px;
  257. /* border: 2px solid #5fb878;
  258. border-radius: 6px;
  259. padding: 1px 2px; */
  260. }
  261. form .AD span {
  262. width: auto;
  263. }
  264. .siteSelect {
  265. width: 71%;
  266. display: inline-block;
  267. }
  268. /* 站点多选下拉样式end */
  269. </style>