perAdd.vue 5.9 KB

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