|
|
@ -90,7 +90,7 @@ |
|
|
<view class="se-px-20 se-pb-80 se-fs-20 se-flex"> |
|
|
<view class="se-px-20 se-pb-80 se-fs-20 se-flex"> |
|
|
<view @click="submit" |
|
|
<view @click="submit" |
|
|
class="se-mx-10 se-flex-1 se-br-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-28 se-c-white se-bgc-orange"> |
|
|
class="se-mx-10 se-flex-1 se-br-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-28 se-c-white se-bgc-orange"> |
|
|
<text>发布订单</text> |
|
|
|
|
|
|
|
|
<text>{{ editId ? '更新招聘信息' : '发布订单' }}</text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
@ -130,9 +130,15 @@ |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import QQMapWX from "@/util/qqmap-wx-jssdk.min.js" |
|
|
import QQMapWX from "@/util/qqmap-wx-jssdk.min.js" |
|
|
import { addTask,industryList,industryById, updateJob } from "@/common/api.js" |
|
|
|
|
|
|
|
|
import { addTask,industryList,industryById, updateJob, getTaskById } from "@/common/api.js" |
|
|
import citySelect from '@/components/cityselect/index.vue' |
|
|
import citySelect from '@/components/cityselect/index.vue' |
|
|
export default { |
|
|
export default { |
|
|
|
|
|
props: { |
|
|
|
|
|
editId: { |
|
|
|
|
|
type: String, |
|
|
|
|
|
default: null |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
components:{ |
|
|
components:{ |
|
|
citySelect |
|
|
citySelect |
|
|
}, |
|
|
}, |
|
|
@ -220,9 +226,8 @@ |
|
|
], |
|
|
], |
|
|
dayMoney:[ |
|
|
dayMoney:[ |
|
|
{ |
|
|
{ |
|
|
type: 'string', |
|
|
|
|
|
required: true, |
|
|
required: true, |
|
|
message: '试工日薪', |
|
|
|
|
|
|
|
|
message: '请输入试工日薪', |
|
|
trigger: ['blur', 'change'] |
|
|
trigger: ['blur', 'change'] |
|
|
} |
|
|
} |
|
|
], |
|
|
], |
|
|
@ -406,6 +411,15 @@ |
|
|
industryById({pid:that.form.industryId}).then(response=>{ |
|
|
industryById({pid:that.form.industryId}).then(response=>{ |
|
|
console.info("response",response); |
|
|
console.info("response",response); |
|
|
that.typeList = response.result |
|
|
that.typeList = response.result |
|
|
|
|
|
|
|
|
|
|
|
// 如果是编辑模式且已有工种ID,需要在工种列表加载后验证工种字段 |
|
|
|
|
|
if (that.editId && that.form.typeId) { |
|
|
|
|
|
that.$nextTick(() => { |
|
|
|
|
|
if (that.$refs.uForm) { |
|
|
|
|
|
that.$refs.uForm.validateField('typeId') |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
}).catch(error=>{ |
|
|
}).catch(error=>{ |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
@ -448,6 +462,10 @@ |
|
|
"image": that.form.fileList.map(item => item.url).join(','),//照片 |
|
|
"image": that.form.fileList.map(item => item.url).join(','),//照片 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 如果是编辑模式,添加ID参数 |
|
|
|
|
|
if (this.editId) { |
|
|
|
|
|
params.id = this.editId |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(this.$dayjs(params.startTime).isAfter(this.$dayjs(params.endTime))){ |
|
|
if(this.$dayjs(params.startTime).isAfter(this.$dayjs(params.endTime))){ |
|
|
return uni.$u.toast('开始时间不能大于结束时间') |
|
|
return uni.$u.toast('开始时间不能大于结束时间') |
|
|
@ -457,10 +475,13 @@ |
|
|
return uni.$u.toast('开始时间不能小于当前时间') |
|
|
return uni.$u.toast('开始时间不能小于当前时间') |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// let p={"bossPhone":"13189698115","dayMoney":"500","endTime":"2016-01-01 00:00:00","industryId":"1865299999310622721","industryName":"木工","latitude":28.23529,"longitude":112.93134,"moneymax":"15000","moneymin":"12000","payType":"1","startTime":"2015-01-01 00:00:00","title":"木工师傅","workAddress":"湖南省长沙市岳麓区金星北路一段517号","workDetail":"阿萨法大多数发斯蒂芬撒旦法撒旦法阿斯蒂芬撒旦法撒旦法撒旦法三大法师打","workPic":"https://tennis-oss.xzaiyp.top/2025-02-19/341d669a-ef66-4abb-8b98-ac71c08814c9.jpg"} |
|
|
|
|
|
addTask(params).then(response=>{ |
|
|
|
|
|
|
|
|
// 根据是否为编辑模式选择不同的API |
|
|
|
|
|
const apiMethod = this.editId ? updateJob : addTask |
|
|
|
|
|
const successMessage = this.editId ? '更新成功!' : '提交成功!' |
|
|
|
|
|
|
|
|
|
|
|
apiMethod(params).then(response=>{ |
|
|
console.info("response",response) |
|
|
console.info("response",response) |
|
|
uni.$u.toast("提交成功!") |
|
|
|
|
|
|
|
|
uni.$u.toast(successMessage) |
|
|
setTimeout(()=>{ |
|
|
setTimeout(()=>{ |
|
|
uni.navigateBack({ |
|
|
uni.navigateBack({ |
|
|
delta:1 |
|
|
delta:1 |
|
|
@ -491,10 +512,76 @@ |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 获取招聘详情数据用于编辑 |
|
|
|
|
|
getJobDetail() { |
|
|
|
|
|
getTaskById({ |
|
|
|
|
|
id: this.editId, |
|
|
|
|
|
edit : '1' |
|
|
|
|
|
}).then(response => { |
|
|
|
|
|
const data = response.result |
|
|
|
|
|
// 回填表单数据 |
|
|
|
|
|
this.form.title = data.title || '' |
|
|
|
|
|
this.form.area = data.address || '' |
|
|
|
|
|
this.form.industryId = data.categoryOne || '' |
|
|
|
|
|
this.form.industryName = data.categoryOneName || '' |
|
|
|
|
|
this.form.typeId = data.categoryTwo || '' |
|
|
|
|
|
this.form.typeName = data.categoryTwoName || '' |
|
|
|
|
|
this.form.salaryMin = data.salaryMin || '' |
|
|
|
|
|
this.form.salaryMax = data.salaryMax || '' |
|
|
|
|
|
this.form.dayMoney = String(data.salaryDay || '') |
|
|
|
|
|
this.form.settlement = data.payType || '' |
|
|
|
|
|
this.form.dateMin = data.startTime || '' |
|
|
|
|
|
this.form.dateMax = data.endTime || '' |
|
|
|
|
|
this.form.mobile = data.phone || '' |
|
|
|
|
|
this.form.introduce = data.details || '' |
|
|
|
|
|
this.form.latitude = data.latitude || '' |
|
|
|
|
|
this.form.longitude = data.longitude || '' |
|
|
|
|
|
|
|
|
|
|
|
// 处理图片列表 |
|
|
|
|
|
if (data.image) { |
|
|
|
|
|
const imageUrls = data.image.split(',') |
|
|
|
|
|
this.form.fileList = imageUrls.map(url => ({ url: url.trim() })) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 如果有行业ID,获取对应的工种列表 |
|
|
|
|
|
if (this.form.industryId) { |
|
|
|
|
|
this.onIndustryById() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 数据回填后,清除表单验证错误状态 |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
if (this.$refs.uForm) { |
|
|
|
|
|
// 清除所有字段的验证错误 |
|
|
|
|
|
this.$refs.uForm.clearValidate() |
|
|
|
|
|
// 或者单独验证已填充的字段 |
|
|
|
|
|
if (this.form.industryName) { |
|
|
|
|
|
this.$refs.uForm.validateField('industryName') |
|
|
|
|
|
} |
|
|
|
|
|
if (this.form.typeId) { |
|
|
|
|
|
this.$refs.uForm.validateField('typeId') |
|
|
|
|
|
} |
|
|
|
|
|
if (this.form.dayMoney) { |
|
|
|
|
|
this.$refs.uForm.validateField('dayMoney') |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
console.error('获取招聘详情失败:', error) |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '获取数据失败', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
onReady() { |
|
|
onReady() { |
|
|
this.$refs.uForm.setRules(this.rules) |
|
|
this.$refs.uForm.setRules(this.rules) |
|
|
this.onIndustryList() |
|
|
this.onIndustryList() |
|
|
|
|
|
// 如果是编辑模式,获取招聘详情数据 |
|
|
|
|
|
if (this.editId) { |
|
|
|
|
|
this.getJobDetail() |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|