添加页面
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
<!--
|
||||
* @Date: 2024-10-08 14:29:36
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-04 14:29:43
|
||||
* @LastEditTime: 2025-11-04 17:45:50
|
||||
-->
|
||||
<template>
|
||||
|
||||
<view class="input-outer-part">
|
||||
<scroll-view scroll-y="true" :style="{height: edit?'calc(100vh - 200rpx)':'calc(100vh - 194rpx)'}">
|
||||
<scroll-view scroll-y="true" :style="{height: edit?'calc(100vh - 380rpx)':'calc(100vh - 194rpx)'}">
|
||||
<view class="inner">
|
||||
<view class="part-title" style="display: flex;justify-content: space-between;">培训需求信息
|
||||
<view v-if="!edit&&formData.id&&formData.currentStatus!=3" class="btn"
|
||||
@@ -46,15 +46,23 @@
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="期望培训时间" prop="qwpxsj" required>
|
||||
<view class="bordered" style="width: 100%" @click="showTime = true"
|
||||
|
||||
<uni-datetime-picker
|
||||
type="date"
|
||||
:value="formData.qwpxsj"
|
||||
start="2021-3-20"
|
||||
end="2030-6-20"
|
||||
@change="change"
|
||||
/>
|
||||
<!-- <view class="bordered" style="width: 100%" @click="showTime = true"
|
||||
:class="{ noValue: !formData.qwpxsj }">
|
||||
{{ formData.qwpxsj || "请选择" }}</view>
|
||||
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
|
||||
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon> -->
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
<uni-forms labelPosition="left" class="self-form" labelWidth="110">
|
||||
<uni-forms-item label="需求说明" prop="jobDescription">
|
||||
<u-textarea :disabled="!edit" v-model="formData.jobDescription" placeholder="请输入"></u-textarea>
|
||||
<textarea :disabled="!edit" v-model="formData.jobDescription" placeholder="请输入"></textarea>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
@@ -196,6 +204,9 @@
|
||||
this.workTypeRemoteMethod('');
|
||||
},
|
||||
methods: {
|
||||
change(e) {
|
||||
this.formData.qwpxsj = e;
|
||||
},
|
||||
cancelPage() {
|
||||
if (this.formData.id) {
|
||||
this.edit = false;
|
||||
@@ -238,12 +249,12 @@
|
||||
}
|
||||
this.formData.fileUrl = this.$arrayToString(this.formData.fileUrl)
|
||||
},
|
||||
addOne() {
|
||||
addOne(userId) {
|
||||
this.formData = {}
|
||||
this.getPersonInfo()
|
||||
if(this.name){
|
||||
this.formData.personName = this.name
|
||||
this.formData.userId = this.needid
|
||||
this.formData.userId = userId
|
||||
}
|
||||
this.edit = true
|
||||
},
|
||||
@@ -337,58 +348,57 @@
|
||||
},
|
||||
async saveInfo() {
|
||||
uni.showLoading();
|
||||
try {
|
||||
// 手动检查培训意愿工种是否已选择
|
||||
if (!this.formData.qwpxgz || this.formData.qwpxgz.trim() === '') {
|
||||
this.$u.toast('请选择培训意愿工种!');
|
||||
return;
|
||||
}
|
||||
|
||||
// 手动检查期望培训时间是否已选择
|
||||
if (!this.formData.qwpxsj || this.formData.qwpxsj.trim() === '') {
|
||||
this.$u.toast('请选择期望培训时间!');
|
||||
return;
|
||||
}
|
||||
|
||||
// // 手动检查培训意愿工种是否已选择
|
||||
// if (!this.formData.qwpxgz || this.formData.qwpxgz.trim() === '') {
|
||||
// uni.showToast({title: '请选择培训意愿工种!', icon: 'none'});
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
// 验证表单
|
||||
const isValid = await this.$refs.uForm.validate();
|
||||
if (!isValid) {
|
||||
throw new Error('请检查必填项填写');
|
||||
return
|
||||
}
|
||||
let response;
|
||||
let successMessage;
|
||||
// // 手动检查期望培训时间是否已选择
|
||||
// if (!this.formData.qwpxsj || this.formData.qwpxsj.trim() === '') {
|
||||
// uni.showToast({title: '请选择期望培训时间!', icon: 'none'});
|
||||
// return;
|
||||
// }
|
||||
// 验证表单
|
||||
const isValid = await this.$refs.uForm.validate();
|
||||
if (isValid) {
|
||||
this.formData.demandType = 3;
|
||||
if (this.formData.id) {
|
||||
response = await updatePersonDemand(this.formData);
|
||||
successMessage = '修改成功';
|
||||
updatePersonDemand(this.formData).then(response => {
|
||||
uni.showToast({title: '修改成功', icon: 'none'});
|
||||
if (response.code == 200) {
|
||||
// 如果是编辑模式,关闭编辑状态;否则返回上一页
|
||||
if (this.formData.id) {
|
||||
this.edit = false;
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
uni.hideLoading();
|
||||
})
|
||||
} else {
|
||||
response = await addPersonDemand(this.formData);
|
||||
successMessage = '保存成功';
|
||||
addPersonDemand(this.formData).then(response => {
|
||||
uni.showToast({title: '保存成功', icon: 'none'});
|
||||
if (response.code == 200) {
|
||||
// 如果是编辑模式,关闭编辑状态;否则返回上一页
|
||||
if (this.formData.id) {
|
||||
this.edit = false;
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
uni.hideLoading();
|
||||
})
|
||||
}
|
||||
// 检查响应码是否为200
|
||||
if (response.code === 200) {
|
||||
this.$u.toast(successMessage);
|
||||
// 如果是编辑模式,关闭编辑状态;否则返回上一页
|
||||
if (this.formData.id) {
|
||||
this.edit = false;
|
||||
} else {
|
||||
await this.$delay(1000); // 延迟1秒后返回上一页
|
||||
uni.navigateBack();
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if(error.length){
|
||||
this.$u.toast('请填写完整信息!');
|
||||
}else{
|
||||
this.$u.toast('系统错误,请联系管理员!');
|
||||
}
|
||||
} finally {
|
||||
// 确保加载页总是会被隐藏
|
||||
}else{
|
||||
uni.showToast({title: '请填写完整信息!', icon: 'none'});
|
||||
uni.hideLoading();
|
||||
}
|
||||
// 确保加载页总是会被隐藏
|
||||
},
|
||||
// getWorkTypeTree() {
|
||||
// listJobType({
|
||||
|
||||
Reference in New Issue
Block a user