123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456 |
- <template>
- <view>
- <view style="padding:5rpx 20rpx 45rpx 20rpx;">
- <view class="desc">
- <view>
- 请上传工作照
- </view>
- <view style="width: 100%;overflow-x: scroll;white-space: nowrap">
- <u-upload style="margin: 0;" :fileList="fileList" @afterRead="afterRead" @delete="deletePic"
- name="1" multiple :maxCount="1" width="120" height="120" uploadIcon="plus-circle">
- </u-upload>
- </view>
- </view>
- <view class="desc">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 姓名
- </view>
- </uni-col>
- <uni-col :span="19">
- <view>
- <uni-easyinput primaryColor="#37babd" v-model="form.userName">
- </uni-easyinput>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 手机号
- </view>
- </uni-col>
- <uni-col :span="19">
- <view>
- <uni-easyinput primaryColor="#37babd" v-model="form.phone">
- </uni-easyinput>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 邮箱
- </view>
- </uni-col>
- <uni-col :span="19">
- <view>
- <uni-easyinput primaryColor="#37babd" v-model="form.email">
- </uni-easyinput>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 座机号
- </view>
- </uni-col>
- <uni-col :span="19">
- <view>
- <uni-easyinput primaryColor="#37babd" v-model="form.seatNo">
- </uni-easyinput>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 工号
- </view>
- </uni-col>
- <uni-col :span="19">
- <view>
- <uni-easyinput primaryColor="#37babd" v-model="form.jobNo">
- </uni-easyinput>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc">
- <hs-dict-select label="取得职称" dictKey="job_title" v-model="form.jobTitle" />
- </view>
- <view class="desc">
- <hs-dept-select label="所属部门" v-model="form.department" />
- </view>
- <view class="desc">
- <hs-post-select label="岗位名称" v-model="form.post" />
- </view>
- <view class="desc">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 入职时间
- </view>
- </uni-col>
- <uni-col :span="19">
- <view>
- <uni-datetime-picker type="date" :clear-icon="false" v-model="form.hiredate"
- @maskClick="maskClick" @change="onchange()" />
- </view>
- </uni-col>
- </uni-row>
- </view>
- </view>
- <u-gap height="70" bgColor="#ffffff"></u-gap>
- <view class="bottim_view">
- <view>
- <u-row>
- <u-col span="11">
- <u-button :disabled="isDisabled" class="btnDoPay" shape="circle" @click="submit"
- color="rgb(55,186,189)" text="提交"></u-button>
- </u-col>
- </u-row>
- </view>
- </view>
- <!-- 下一步选择人员弹窗 -->
- <uni-popup ref="popup" background-color="#fff">
- <view style="height: 800rpx;">
- <view class="desc">
- <uni-row>
- <uni-col :span="10">
- <view style="font-size: 40rpx;color: rgb(145, 145, 145);">
- </view>
- </uni-col>
- <uni-col :span="11">
- <view style="font-size: 40rpx;color: rgb(98, 98, 98);">
- 下一步
- </view>
- </uni-col>
- <uni-col :span="3">
- <view @click="submitPass" style="font-size: 40rpx;color: rgb(55,186,189);">
- 确认
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view>
- <!-- -->
- <uni-row>
- <uni-col>
- <view style="padding: 15rpx 20rpx;">
- <uni-data-picker ref="picker" placeholder="请选择" :popup-title="selectTitle"
- :localdata="dataTree" v-model="hxForm.candidate" @change="nextApprovalChange">
- </uni-data-picker>
- </view>
- </uni-col>
- </uni-row>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- bzTypes: ['事业编制', '非事业编制', '第三方'],
- isDisabled: false,
- selectTitle: '',
- hxForm: {},
- dataTree: [],
- fileList: [],
- form: {},
- header: {
- "Authorization": "Bearer " + uni.getStorageSync('token')
- },
- index: 0
- }
- },
- onLoad() {},
- methods: {
- async submit() {
- this.isDisabled = true
- if (this.fileList.length === 0) {
- this.isDisabled = false
- uni.showModal({
- content: '请上传工作照',
- title: '提交失败',
- showCancel: false
- })
- return
- }
- if (!this.form.userName) {
- this.isDisabled = false
- uni.showModal({
- content: '请输入姓名',
- title: '提交失败',
- showCancel: false
- })
- return
- }
- if (!this.form.phone) {
- this.isDisabled = false
- uni.showModal({
- content: '请输入手机号',
- title: '提交失败',
- showCancel: false
- })
- return
- }
- if (!this.form.email) {
- this.isDisabled = false
- uni.showModal({
- content: '请输入邮箱',
- title: '提交失败',
- showCancel: false
- })
- return
- }
- if (!this.form.jobNo) {
- this.isDisabled = false
- uni.showModal({
- content: '请输入工号',
- title: '提交失败',
- showCancel: false
- })
- return
- }
- if (!this.form.jobTitle) {
- this.isDisabled = false
- uni.showModal({
- content: '请选择职称',
- title: '提交失败',
- showCancel: false
- })
- return
- }
- if (!this.form.department) {
- this.isDisabled = false
- uni.showModal({
- content: '请选择部门',
- title: '提交失败',
- showCancel: false
- })
- return
- }
- if (!this.form.post) {
- this.isDisabled = false
- uni.showModal({
- content: '请选择岗位',
- title: '提交失败',
- showCancel: false
- })
- return
- }
- if (!this.form.hiredate) {
- this.isDisabled = false
- uni.showModal({
- content: '请选择入职时间',
- title: '提交失败',
- showCancel: false
- })
- return
- }
- setTimeout(() => {
- this.isDisabled = false
- }, 1000)
- //统一写入参数
- this.form.userCode = uni.getStorageSync('setUserName')
- this.form.avatar = this.fileList[0].url
- this.form.hireOrDimission = '1'
- const {
- data: res
- } = await this.$httpRequest({
- url: '/app/submitApply/personnelHire',
- method: 'post',
- data: this.form
- });
- if (res.code === 200) {
- this.dataTree = res.data.tree
- this.hxForm.taskId = res.data.taskId
- this.$refs.popup.open('bottom')
- this.selectTitle = "请选择" + this.dataTree[0].text
- this.isDisabled = false
- } else {
- this.$showModal(res.msg)
- }
- this.isDisabled = false
- },
- async getPostData() {
- const {
- data: res
- } = await this.$httpRequest({
- url: '/app/posts',
- method: 'get'
- });
- if (res.code === 200) {
- this.post.data = res.data
- } else {
- }
- },
- nextApprovalChange(e) {
- // console.log('onchange:', e.detail.value[1].text);
- this.hxForm.applyUserName = e.detail.value[1].text
- this.hxForm.candidate = e.detail.value[1].value
- },
- onchange(e) {
- setTimeout(() => {
- }, 200)
- },
- maskClick(e) {
- // if (this.data) {
- // this.form = {
- // isLh: this.data.formData.is_lh,
- // type: this.data.formData.type,
- // title: this.data.formData.title,
- // leaveStartTime: this.data.formData.leave_start_time,
- // reason: this.data.formData.reason,
- // leaveEndTime: this.data.formData.leave_end_time,
- // candidate: this.data.formData.candidate,
- // totalTime: this.data.formData.total_time,
- // tripMode: this.data.formData.trip_mode,
- // detailAddr: this.data.formData.detail_addr,
- // tripAddress: this.data.formData.trip_address,
- // applyUserName: this.data.formData.apply_user_name,
- // applyUserId: this.data.formData.apply_user_id
- // }
- // if (this.data.formData.is_lh === '离沪') {
- // this.current = 1
- // } else {
- // this.current = 0
- // }
- // }
- },
- // 删除图片
- deletePic(event) {
- this.fileList.splice(event.index, 1)
- },
- async submitPass() {
- if (!this.hxForm.candidate) {
- uni.showModal({
- content: '请选择' + this.dataTree[0].text,
- title: '提交失败',
- showCancel: false,
- })
- }
- const {
- data: res
- } = await this.$httpRequest({
- url: '/app/task/submit/candidate?taskId=' + this.hxForm.taskId +
- '&candidate=' + this.hxForm.candidate + '&applyUserName=' + this.hxForm.applyUserName,
- method: 'get',
- });
- if (res.code === 200) {
- uni.showModal({
- content: '已提交给审批人员',
- title: '提交成功',
- showCancel: false,
- success() {
- uni.navigateBack()
- }
- })
- } else {
- uni.showModal({
- content: res.msg,
- title: '提交失败',
- showCancel: false,
- success() {
- uni.navigateBack()
- }
- })
- }
- },
- // 新增图片
- async afterRead(event) {
- // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
- let lists = [].concat(event.file)
- let fileListLen
- if (this.fileList) {
- fileListLen = this.fileList.length
- } else {
- this.fileList = []
- fileListLen = 0
- }
- lists.map((item) => {
- this.fileList.push({
- ...item,
- status: 'uploading',
- message: '上传中'
- })
- })
- console.log(this.fileList)
- for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise(lists[i].url)
- let item = this.fileList[fileListLen]
- this.fileList.splice(fileListLen, 1, Object.assign(item, {
- status: 'success',
- message: '',
- url: result
- }))
- fileListLen++
- }
- // uni.setStorageSync("listImg", this.fileList)
- // console.log(this.fileList)
- },
- uploadFilePromise(url) {
- return new Promise((resolve, reject) => {
- let a = uni.uploadFile({
- url: this.$BASE_URL + '/common/upload', // 仅为示例,非真实的接口地址
- filePath: url,
- name: 'file',
- header: this.header,
- success: (res) => {
- // console.log(JSON.parse(res.data).url);
- setTimeout(() => {
- resolve(JSON.parse(res.data).url)
- }, 1000)
- }
- });
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .desc {
- padding: 10rpx 5rpx;
- color: #818181;
- font-size: 20rpx;
- }
- .pickerView {
- // align-items: flex-end;
- padding: 10rpx 20rpx;
- border: 1rpx #eeeeee solid;
- }
- .pickerText {
- font-size: 26rpx;
- color: #b1b1b1;
- }
- .bottim_view {
- padding: 5px 20px 30px;
- position: fixed;
- left: 0px;
- bottom: 0px;
- width: 100%;
- height: 40px;
- background-color: #ffffff;
- }
- </style>
|