servicepersonedit.vue 8.5 KB

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