entry.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <template>
  2. <view>
  3. <view style="padding:5rpx 20rpx 45rpx 20rpx;">
  4. <view class="desc">
  5. <view>
  6. 请上传工作照
  7. </view>
  8. <view style="width: 100%;overflow-x: scroll;white-space: nowrap">
  9. <u-upload style="margin: 0;" :fileList="fileList" @afterRead="afterRead" @delete="deletePic"
  10. name="1" multiple :maxCount="1" width="120" height="120" uploadIcon="plus-circle">
  11. </u-upload>
  12. </view>
  13. </view>
  14. <view class="desc">
  15. <uni-row>
  16. <uni-col :span="5">
  17. <view class="desc" style="font-size: 25rpx;">
  18. 姓名
  19. </view>
  20. </uni-col>
  21. <uni-col :span="19">
  22. <view>
  23. <uni-easyinput primaryColor="#37babd" v-model="form.userName">
  24. </uni-easyinput>
  25. </view>
  26. </uni-col>
  27. </uni-row>
  28. </view>
  29. <view class="desc">
  30. <uni-row>
  31. <uni-col :span="5">
  32. <view class="desc" style="font-size: 25rpx;">
  33. 手机号
  34. </view>
  35. </uni-col>
  36. <uni-col :span="19">
  37. <view>
  38. <uni-easyinput primaryColor="#37babd" v-model="form.phone">
  39. </uni-easyinput>
  40. </view>
  41. </uni-col>
  42. </uni-row>
  43. </view>
  44. <view class="desc">
  45. <uni-row>
  46. <uni-col :span="5">
  47. <view class="desc" style="font-size: 25rpx;">
  48. 邮箱
  49. </view>
  50. </uni-col>
  51. <uni-col :span="19">
  52. <view>
  53. <uni-easyinput primaryColor="#37babd" v-model="form.email">
  54. </uni-easyinput>
  55. </view>
  56. </uni-col>
  57. </uni-row>
  58. </view>
  59. <view class="desc">
  60. <uni-row>
  61. <uni-col :span="5">
  62. <view class="desc" style="font-size: 25rpx;">
  63. 座机号
  64. </view>
  65. </uni-col>
  66. <uni-col :span="19">
  67. <view>
  68. <uni-easyinput primaryColor="#37babd" v-model="form.seatNo">
  69. </uni-easyinput>
  70. </view>
  71. </uni-col>
  72. </uni-row>
  73. </view>
  74. <view class="desc">
  75. <uni-row>
  76. <uni-col :span="5">
  77. <view class="desc" style="font-size: 25rpx;">
  78. 工号
  79. </view>
  80. </uni-col>
  81. <uni-col :span="19">
  82. <view>
  83. <uni-easyinput primaryColor="#37babd" v-model="form.jobNo">
  84. </uni-easyinput>
  85. </view>
  86. </uni-col>
  87. </uni-row>
  88. </view>
  89. <view class="desc">
  90. <hs-dict-select label="取得职称" dictKey="job_title" v-model="form.jobTitle" />
  91. </view>
  92. <view class="desc">
  93. <hs-dept-select label="所属部门" v-model="form.department" />
  94. </view>
  95. <view class="desc">
  96. <hs-post-select label="岗位名称" v-model="form.post" />
  97. </view>
  98. <view class="desc">
  99. <uni-row>
  100. <uni-col :span="5">
  101. <view class="desc" style="font-size: 25rpx;">
  102. 入职时间
  103. </view>
  104. </uni-col>
  105. <uni-col :span="19">
  106. <view>
  107. <uni-datetime-picker type="date" :clear-icon="false" v-model="form.hiredate"
  108. @maskClick="maskClick" @change="onchange()" />
  109. </view>
  110. </uni-col>
  111. </uni-row>
  112. </view>
  113. </view>
  114. <u-gap height="70" bgColor="#ffffff"></u-gap>
  115. <view class="bottim_view">
  116. <view>
  117. <u-row>
  118. <u-col span="11">
  119. <u-button :disabled="isDisabled" class="btnDoPay" shape="circle" @click="submit"
  120. color="rgb(55,186,189)" text="提交"></u-button>
  121. </u-col>
  122. </u-row>
  123. </view>
  124. </view>
  125. <!-- 下一步选择人员弹窗 -->
  126. <uni-popup ref="popup" background-color="#fff">
  127. <view style="height: 800rpx;">
  128. <view class="desc">
  129. <uni-row>
  130. <uni-col :span="10">
  131. <view style="font-size: 40rpx;color: rgb(145, 145, 145);">
  132. </view>
  133. </uni-col>
  134. <uni-col :span="11">
  135. <view style="font-size: 40rpx;color: rgb(98, 98, 98);">
  136. 下一步
  137. </view>
  138. </uni-col>
  139. <uni-col :span="3">
  140. <view @click="submitPass" style="font-size: 40rpx;color: rgb(55,186,189);">
  141. 确认
  142. </view>
  143. </uni-col>
  144. </uni-row>
  145. </view>
  146. <view>
  147. <!-- -->
  148. <uni-row>
  149. <uni-col>
  150. <view style="padding: 15rpx 20rpx;">
  151. <uni-data-picker ref="picker" placeholder="请选择" :popup-title="selectTitle"
  152. :localdata="dataTree" v-model="hxForm.candidate" @change="nextApprovalChange">
  153. </uni-data-picker>
  154. </view>
  155. </uni-col>
  156. </uni-row>
  157. </view>
  158. </view>
  159. </uni-popup>
  160. </view>
  161. </template>
  162. <script>
  163. export default {
  164. data() {
  165. return {
  166. bzTypes: ['事业编制', '非事业编制', '第三方'],
  167. isDisabled: false,
  168. selectTitle: '',
  169. hxForm: {},
  170. dataTree: [],
  171. fileList: [],
  172. form: {},
  173. header: {
  174. "Authorization": "Bearer " + uni.getStorageSync('token')
  175. },
  176. index: 0
  177. }
  178. },
  179. onLoad() {},
  180. methods: {
  181. async submit() {
  182. this.isDisabled = true
  183. if (this.fileList.length === 0) {
  184. this.isDisabled = false
  185. uni.showModal({
  186. content: '请上传工作照',
  187. title: '提交失败',
  188. showCancel: false
  189. })
  190. return
  191. }
  192. if (!this.form.userName) {
  193. this.isDisabled = false
  194. uni.showModal({
  195. content: '请输入姓名',
  196. title: '提交失败',
  197. showCancel: false
  198. })
  199. return
  200. }
  201. if (!this.form.phone) {
  202. this.isDisabled = false
  203. uni.showModal({
  204. content: '请输入手机号',
  205. title: '提交失败',
  206. showCancel: false
  207. })
  208. return
  209. }
  210. if (!this.form.email) {
  211. this.isDisabled = false
  212. uni.showModal({
  213. content: '请输入邮箱',
  214. title: '提交失败',
  215. showCancel: false
  216. })
  217. return
  218. }
  219. if (!this.form.jobNo) {
  220. this.isDisabled = false
  221. uni.showModal({
  222. content: '请输入工号',
  223. title: '提交失败',
  224. showCancel: false
  225. })
  226. return
  227. }
  228. if (!this.form.jobTitle) {
  229. this.isDisabled = false
  230. uni.showModal({
  231. content: '请选择职称',
  232. title: '提交失败',
  233. showCancel: false
  234. })
  235. return
  236. }
  237. if (!this.form.department) {
  238. this.isDisabled = false
  239. uni.showModal({
  240. content: '请选择部门',
  241. title: '提交失败',
  242. showCancel: false
  243. })
  244. return
  245. }
  246. if (!this.form.post) {
  247. this.isDisabled = false
  248. uni.showModal({
  249. content: '请选择岗位',
  250. title: '提交失败',
  251. showCancel: false
  252. })
  253. return
  254. }
  255. if (!this.form.hiredate) {
  256. this.isDisabled = false
  257. uni.showModal({
  258. content: '请选择入职时间',
  259. title: '提交失败',
  260. showCancel: false
  261. })
  262. return
  263. }
  264. setTimeout(() => {
  265. this.isDisabled = false
  266. }, 1000)
  267. //统一写入参数
  268. this.form.userCode = uni.getStorageSync('setUserName')
  269. this.form.avatar = this.fileList[0].url
  270. this.form.hireOrDimission = '1'
  271. const {
  272. data: res
  273. } = await this.$httpRequest({
  274. url: '/app/submitApply/personnelHire',
  275. method: 'post',
  276. data: this.form
  277. });
  278. if (res.code === 200) {
  279. this.dataTree = res.data.tree
  280. this.hxForm.taskId = res.data.taskId
  281. this.$refs.popup.open('bottom')
  282. this.selectTitle = "请选择" + this.dataTree[0].text
  283. this.isDisabled = false
  284. } else {
  285. this.$showModal(res.msg)
  286. }
  287. this.isDisabled = false
  288. },
  289. async getPostData() {
  290. const {
  291. data: res
  292. } = await this.$httpRequest({
  293. url: '/app/posts',
  294. method: 'get'
  295. });
  296. if (res.code === 200) {
  297. this.post.data = res.data
  298. } else {
  299. }
  300. },
  301. nextApprovalChange(e) {
  302. // console.log('onchange:', e.detail.value[1].text);
  303. this.hxForm.applyUserName = e.detail.value[1].text
  304. this.hxForm.candidate = e.detail.value[1].value
  305. },
  306. onchange(e) {
  307. setTimeout(() => {
  308. }, 200)
  309. },
  310. maskClick(e) {
  311. // if (this.data) {
  312. // this.form = {
  313. // isLh: this.data.formData.is_lh,
  314. // type: this.data.formData.type,
  315. // title: this.data.formData.title,
  316. // leaveStartTime: this.data.formData.leave_start_time,
  317. // reason: this.data.formData.reason,
  318. // leaveEndTime: this.data.formData.leave_end_time,
  319. // candidate: this.data.formData.candidate,
  320. // totalTime: this.data.formData.total_time,
  321. // tripMode: this.data.formData.trip_mode,
  322. // detailAddr: this.data.formData.detail_addr,
  323. // tripAddress: this.data.formData.trip_address,
  324. // applyUserName: this.data.formData.apply_user_name,
  325. // applyUserId: this.data.formData.apply_user_id
  326. // }
  327. // if (this.data.formData.is_lh === '离沪') {
  328. // this.current = 1
  329. // } else {
  330. // this.current = 0
  331. // }
  332. // }
  333. },
  334. // 删除图片
  335. deletePic(event) {
  336. this.fileList.splice(event.index, 1)
  337. },
  338. async submitPass() {
  339. if (!this.hxForm.candidate) {
  340. uni.showModal({
  341. content: '请选择' + this.dataTree[0].text,
  342. title: '提交失败',
  343. showCancel: false,
  344. })
  345. }
  346. const {
  347. data: res
  348. } = await this.$httpRequest({
  349. url: '/app/task/submit/candidate?taskId=' + this.hxForm.taskId +
  350. '&candidate=' + this.hxForm.candidate + '&applyUserName=' + this.hxForm.applyUserName,
  351. method: 'get',
  352. });
  353. if (res.code === 200) {
  354. uni.showModal({
  355. content: '已提交给审批人员',
  356. title: '提交成功',
  357. showCancel: false,
  358. success() {
  359. uni.navigateBack()
  360. }
  361. })
  362. } else {
  363. uni.showModal({
  364. content: res.msg,
  365. title: '提交失败',
  366. showCancel: false,
  367. success() {
  368. uni.navigateBack()
  369. }
  370. })
  371. }
  372. },
  373. // 新增图片
  374. async afterRead(event) {
  375. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  376. let lists = [].concat(event.file)
  377. let fileListLen
  378. if (this.fileList) {
  379. fileListLen = this.fileList.length
  380. } else {
  381. this.fileList = []
  382. fileListLen = 0
  383. }
  384. lists.map((item) => {
  385. this.fileList.push({
  386. ...item,
  387. status: 'uploading',
  388. message: '上传中'
  389. })
  390. })
  391. console.log(this.fileList)
  392. for (let i = 0; i < lists.length; i++) {
  393. const result = await this.uploadFilePromise(lists[i].url)
  394. let item = this.fileList[fileListLen]
  395. this.fileList.splice(fileListLen, 1, Object.assign(item, {
  396. status: 'success',
  397. message: '',
  398. url: result
  399. }))
  400. fileListLen++
  401. }
  402. // uni.setStorageSync("listImg", this.fileList)
  403. // console.log(this.fileList)
  404. },
  405. uploadFilePromise(url) {
  406. return new Promise((resolve, reject) => {
  407. let a = uni.uploadFile({
  408. url: this.$BASE_URL + '/common/upload', // 仅为示例,非真实的接口地址
  409. filePath: url,
  410. name: 'file',
  411. header: this.header,
  412. success: (res) => {
  413. // console.log(JSON.parse(res.data).url);
  414. setTimeout(() => {
  415. resolve(JSON.parse(res.data).url)
  416. }, 1000)
  417. }
  418. });
  419. })
  420. }
  421. }
  422. }
  423. </script>
  424. <style lang="scss" scoped>
  425. .desc {
  426. padding: 10rpx 5rpx;
  427. color: #818181;
  428. font-size: 20rpx;
  429. }
  430. .pickerView {
  431. // align-items: flex-end;
  432. padding: 10rpx 20rpx;
  433. border: 1rpx #eeeeee solid;
  434. }
  435. .pickerText {
  436. font-size: 26rpx;
  437. color: #b1b1b1;
  438. }
  439. .bottim_view {
  440. padding: 5px 20px 30px;
  441. position: fixed;
  442. left: 0px;
  443. bottom: 0px;
  444. width: 100%;
  445. height: 40px;
  446. background-color: #ffffff;
  447. }
  448. </style>