servicepersonadd.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <!--
  2. * @Title:
  3. * @Description: 维修任务填报提交页
  4. * @Author: swp
  5. * @Date: 2022-08-24 10:49:21
  6. * @LastEditors:
  7. * @LastEditTime: 2022-08-24 10:49:21
  8. -->
  9. <template>
  10. <view class="container">
  11. <uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
  12. @clickLeft="toBack">
  13. <view style="width: 100%;display: flex;flex-direction: row;justify-content: center;align-items: center;">
  14. <text style="color: white;font-size: 1rem;">{{title}}</text>
  15. </view>
  16. </uni-nav-bar>
  17. <uni-forms ref="baseForm" :model="formData" :rules="rules">
  18. <uni-group>
  19. <uni-forms-item name="postCode" label="岗位" label-width="130px" required>
  20. <uni-data-checkbox v-model="formData.postCode" :localdata="postCodeOption.items">
  21. </uni-data-checkbox>
  22. </uni-forms-item>
  23. <uni-forms-item name='userAccount' label="用户帐号" label-width="130px" required>
  24. <uni-easyinput :styles="styles" v-model="formData.userAccount" placeholder="请录入用户帐号" />
  25. </uni-forms-item>
  26. <uni-forms-item name='personName' label="姓名" label-width="130px" required>
  27. <uni-easyinput :styles="styles" v-model="formData.personName" placeholder="请录入姓名" />
  28. </uni-forms-item>
  29. <uni-forms-item name='contactPhone' label="联系电话" label-width="130px">
  30. <uni-easyinput :styles="styles" v-model="formData.contactPhone" placeholder="请录入联系电话" />
  31. </uni-forms-item>
  32. <uni-forms-item name='mail' label="邮箱" label-width="130px">
  33. <uni-easyinput :styles="styles" v-model="formData.mail" placeholder="请录入邮箱" />
  34. </uni-forms-item>
  35. <view>
  36. <text style="color: gray;font-size: 0.6rem;">备注:默认密码为用户帐号+@8282</text>
  37. </view>
  38. </uni-group>
  39. </uni-forms>
  40. <view class="footer">
  41. <view class="control">
  42. <view class="view-flex-rc">
  43. <view class="block"
  44. style="width: 120px;height:28px;margin-left: 10px;margin-right: 10px;border-radius:7px;background-color:lightpink"
  45. @click="toSubmit()">
  46. <view class="view-flex-cc">
  47. <uni-icons class="input-uni-icon" type="checkmarkempty" size="18" color="#999" />
  48. </view>
  49. <view class="view-flex-cc" style="padding-left:5px;">
  50. <text style="color:black;font-size:0.7rem">立即提交</text>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import http from '@/http/api.js';
  60. import {
  61. oss,
  62. devUrl,
  63. prodUrl
  64. } from '@/common/setting';
  65. export default {
  66. components: {},
  67. data() {
  68. return {
  69. title: '人员添加',
  70. desc: '',
  71. styles: {
  72. color: '#333',
  73. borderColor: '#e5e5e5',
  74. disableColor: '#FFFFFF'
  75. },
  76. formData: {
  77. userAccount: '',
  78. personName: '',
  79. contactPhone: '',
  80. mail: '',
  81. postCode: '',
  82. },
  83. rules: {
  84. // 手机网络信号选择
  85. postCode: {
  86. rules: [{
  87. required: true,
  88. errorMessage: '必填项',
  89. }]
  90. },
  91. userAccount: {
  92. rules: [{
  93. required: true,
  94. errorMessage: '必填项',
  95. }, ]
  96. },
  97. personName: {
  98. rules: [{
  99. required: true,
  100. errorMessage: '必填项',
  101. }, ]
  102. },
  103. },
  104. baseURL: '',
  105. baseOSS: '',
  106. postCodeOption: {
  107. items: [{
  108. 'value': 1,
  109. 'text': '工程师'
  110. }, {
  111. 'value': 2,
  112. 'text': '服务员'
  113. }],
  114. current: 0,
  115. },
  116. }
  117. },
  118. computed: {
  119. },
  120. onLoad(options) {
  121. this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
  122. this.baseOSS = oss;
  123. },
  124. onReady() {
  125. console.log("onReady++++++++++++++")
  126. // 需要在onReady中设置规则
  127. this.$refs.baseForm.setRules(this.rules)
  128. },
  129. onShow() {},
  130. methods: {
  131. toOss(path) {
  132. return this.baseOSS + path;
  133. },
  134. toBack() {
  135. uni.navigateBack({
  136. delta: 1
  137. })
  138. },
  139. toSubmit() {
  140. console.log('表单提交');
  141. let that = this;
  142. this.$refs.baseForm.validate().then(res => {
  143. that.submitData();
  144. }).catch(err => {
  145. console.log('表单错误信息:', err);
  146. uni.showModal({
  147. content: "内容填报错误,请根据提示信息检查录入内容!",
  148. showCancel: false,
  149. success(res) {
  150. if (res.confirm) {
  151. //that.$refs.baseForm.clearValidate();
  152. }
  153. }
  154. });
  155. })
  156. },
  157. submitData() {
  158. let formdata = this.formData;
  159. let that = this;
  160. http.request({
  161. url: '/galaxy-business/serviceperson/org/user/save',
  162. method: 'POST',
  163. data: formdata
  164. }).then(res => {
  165. if (res.success) {
  166. uni.showModal({
  167. content: '已成功提交',
  168. showCancel: false,
  169. success(res) {
  170. that.toBack();
  171. }
  172. });
  173. } else {
  174. uni.showModal({
  175. content: '' + res.msg,
  176. showCancel: false
  177. });
  178. }
  179. }).catch(err => {
  180. console.log(err)
  181. })
  182. },
  183. }
  184. }
  185. </script>
  186. <style>
  187. /* page {
  188. background-color: rgb(240, 242, 244);
  189. } */
  190. </style>
  191. <style lang="scss" scoped>
  192. .cell-hover-class {
  193. background-color: rgb(235, 237, 238);
  194. }
  195. .view-flex-rs {
  196. display: flex;
  197. flex-direction: row;
  198. justify-content: flex-start;
  199. align-items: center;
  200. }
  201. .view-flex-rc {
  202. display: flex;
  203. flex-direction: row;
  204. justify-content: center;
  205. align-items: center;
  206. }
  207. .view-flex-re {
  208. display: flex;
  209. flex-direction: row;
  210. justify-content: flex-end;
  211. align-items: center;
  212. }
  213. .view-flex-cs {
  214. display: flex;
  215. flex-direction: column;
  216. justify-content: flex-start;
  217. }
  218. .view-flex-cc {
  219. display: flex;
  220. flex-direction: column;
  221. justify-content: center;
  222. }
  223. .view-flex-ce {
  224. display: flex;
  225. flex-direction: column;
  226. justify-content: flex-end;
  227. }
  228. .line-body {
  229. padding-left: 10px;
  230. padding-right: 10px;
  231. }
  232. .required-star {
  233. color: #FF0000;
  234. font-size: 15px;
  235. width: 20px;
  236. text-align: center;
  237. padding-left: 0px;
  238. padding-right: 2px;
  239. }
  240. .item-title {
  241. color: #909399;
  242. font-size: 15px;
  243. }
  244. .mline-text {
  245. padding-left: 2px;
  246. width: 100%;
  247. /* background-color:#909399; */
  248. height: 70px;
  249. border: 1px solid #FF5A5F;
  250. border-radius: 5px;
  251. }
  252. .footer {
  253. position: fixed;
  254. bottom: 0;
  255. left: 0;
  256. right: 0;
  257. z-index: 1;
  258. height: 100rpx;
  259. padding: 20rpx;
  260. box-sizing: border-box;
  261. display: flex;
  262. align-items: center;
  263. justify-content: flex-end;
  264. background-color: whitesmoke;
  265. .ipt {
  266. width: 380rpx;
  267. height: 77rpx;
  268. background: #f7f7f7;
  269. border-radius: 38px;
  270. padding: 0 37rpx;
  271. box-sizing: border-box;
  272. margin-right: 20rpx;
  273. }
  274. .control {
  275. flex: 1;
  276. display: flex;
  277. align-items: center;
  278. justify-content: flex-end;
  279. .block {
  280. display: flex;
  281. align-items: center;
  282. justify-content: center;
  283. flex: 1;
  284. }
  285. .icon {
  286. height: auto;
  287. }
  288. .c {
  289. width: 41rpx;
  290. margin-right: 10rpx;
  291. }
  292. .s {
  293. width: 36rpx;
  294. }
  295. .t {
  296. width: 31rpx;
  297. }
  298. }
  299. }
  300. .container {
  301. padding: 0 0 100rpx;
  302. }
  303. .img-container {
  304. margin-bottom: 0px;
  305. width: 80px;
  306. height: 80px;
  307. .note-image-box {
  308. margin-top: 5px;
  309. display: flex;
  310. flex-wrap: wrap;
  311. padding: 0px;
  312. .note-image-item {
  313. position: relative;
  314. width: 100%;
  315. height: 0;
  316. padding-top: 100%;
  317. box-sizing: border-box;
  318. // background-color: #18B566;
  319. .close-icon {
  320. display: flex;
  321. justify-content: center;
  322. align-items: center;
  323. position: absolute;
  324. right: 0px;
  325. top: 0px;
  326. width: 22px;
  327. height: 22px;
  328. border-radius: 50%;
  329. background-color: #d5d5d5;
  330. z-index: 2;
  331. }
  332. .image-box {
  333. display: flex;
  334. justify-content: center;
  335. align-items: center;
  336. position: absolute;
  337. top: 0px;
  338. right: 0px;
  339. border: 0px;
  340. left: 0px;
  341. border: 1px #eee solid;
  342. border-radius: 5px;
  343. overflow: hidden;
  344. width: 98%;
  345. height: 98%;
  346. }
  347. }
  348. }
  349. }
  350. .input-body {
  351. background-color: #fff;
  352. padding: 10px;
  353. }
  354. .mb-10 {
  355. margin-top: 0px;
  356. margin-bottom: 0px;
  357. }
  358. .decoration {
  359. width: 6px;
  360. height: 6px;
  361. margin-right: 4px;
  362. border-radius: 50%;
  363. background-color: cadetblue;
  364. }
  365. </style>