添加页面

This commit is contained in:
2025-11-05 17:07:17 +08:00
parent 328721e6e9
commit 886b27218c
29 changed files with 1691 additions and 829 deletions

View File

@@ -1,11 +1,11 @@
<!--
* @Date: 2024-10-08 14:29:36
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-04 14:29:24
* @LastEditTime: 2025-11-04 17:33:17
-->
<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"
@@ -31,10 +31,27 @@
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</uni-forms-item> -->
<uni-forms-item label="有无场地需求" name="ywcdxq" required>
<radio-group :disabled="!edit" :value="formData.ywcdxq" placement="row">
<!-- <radio-group :disabled="!edit" :value="formData.ywcdxq" placement="row">
<radio :customStyle="{marginRight: '16px'}" label="是" value="是"></radio>
<radio :customStyle="{marginRight: '16px'}" label="否" value="否"></radio>
</radio-group>
</radio-group> -->
<view class="radio-group">
<view
:class="['radio-item', { 'radio-disabled': !edit }]"
@click="formData.ywcdxq = '是'"
v-if="edit">
<view :class="['radio', { 'radio-checked': formData.ywcdxq === '是' }]"></view>
<text></text>
</view>
<view
:class="['radio-item', { 'radio-disabled': !edit }]"
@click="formData.ywcdxq = '否'"
v-if="edit">
<view :class="['radio', { 'radio-checked': formData.ywcdxq === '否' }]"></view>
<text></text>
</view>
<view v-else>{{ formData.ywcdxq }}</view>
</view>
</uni-forms-item>
<uni-forms-item label="场地面积" name="cdmj">
<input :disabled="!edit" v-model="formData.cdmj" border="none"
@@ -225,8 +242,8 @@
},
// setName(){
// this.formData.personName = this.name
// this.formData.personId = this.needid
// this.formData.userId = this.needid
// this.formData.personId = this.needId
// this.formData.userId = this.needId
// this.$forceUpdate();
// },
@@ -255,13 +272,13 @@
}
this.formData.fileUrl = this.$arrayToString(this.formData.fileUrl)
},
addOne() {
addOne(userId) {
this.formData = {}
this.setDefaultValues()
this.getPersonInfo()
if(this.name){
this.formData.personName = this.name
this.formData.userId = this.needid
this.formData.userId = userId
}
this.edit = true
},
@@ -349,23 +366,33 @@
this.formData.demandType = 2;
let successMessage;
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);
}
}
})
} else {
response = await addPersonDemand(this.formData);
successMessage = '保存成功';
}
// 检查响应码是否为200
if (response.code === 200) {
uni.showToast({title: successMessage, icon: 'none'});
// 如果是编辑模式,关闭编辑状态;否则返回上一页
if (this.formData.id) {
this.edit = false;
} else {
await this.$delay(1000); // 延迟1秒后返回上一页
uni.navigateBack();
}
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);
}
}
})
}
} catch (error) {
if(error.length){
@@ -423,6 +450,49 @@
.noValue {
color: rgb(192, 196, 204);
}
/* 单选框样式 */
.radio-group {
flex: 1;
display: flex;
align-items: center;
}
.radio-item {
display: flex;
align-items: center;
margin-right: 32rpx;
cursor: pointer;
}
.radio-item.radio-disabled {
cursor: not-allowed;
}
.radio {
width: 28rpx;
height: 28rpx;
border-radius: 50%;
border: 2rpx solid #dcdfe6;
margin-right: 12rpx;
position: relative;
}
.radio.radio-checked {
border-color: #409eff;
background-color: #409eff;
}
.radio.radio-checked::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 12rpx;
height: 12rpx;
border-radius: 50%;
background-color: #fff;
}
.disabledLine {
background: rgb(245, 247, 250);

View File

@@ -1,12 +1,12 @@
<!--
* @Date: 2024-10-08 14:29:36
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-04 14:00:51
* @LastEditTime: 2025-11-04 17:32:32
-->
<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"
@@ -335,12 +335,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
},
@@ -422,7 +422,7 @@
if (this.edit) {
if(type === 'workTypeTree') {
if (!this.workTypeTreeColumns[0] || !this.workTypeTreeColumns[0].length) {
uni.showToast({title: '工种数据未加载,请稍后重试'});
uni.showToast({title: '工种数据未加载,请稍后重试', icon: 'none'});
return;
}
// 弹窗打开时初始化临时columns和index
@@ -452,7 +452,7 @@
try {
// 先检查求职说明是否为空,如果为空直接提示
if (!this.formData.jobDescription || this.formData.jobDescription.trim() === '') {
uni.showToast({title: '请填写求职说明!'});
uni.showToast({title: '请填写求职说明!', icon: 'none'});
return;
}
@@ -466,34 +466,43 @@
this.formData.demandType = 1;
// this.formData.userId = this.formData.personId
// 根据 formData 是否有 id 来决定是更新还是新增
let response;
let successMessage;
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);
}
}
})
} else {
response = await addPersonDemand(this.formData);
successMessage = '保存成功';
}
// 检查响应码是否为200
if (response.code === 200) {
uni.showToast({title: successMessage});
// 如果是编辑模式,关闭编辑状态;否则返回上一页
if (this.formData.id) {
this.edit = false;
} else {
setTimeout(() => {
uni.navigateBack();
}, 2000);
}
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);
}
}
})
}
} catch (error) {
if(error.length){
uni.showToast({title: '请填写完整信息!'});
uni.showToast({title: '请填写完整信息!', icon: 'none'});
}else{
uni.showToast({title: '系统错误,请联系管理员!'});
uni.showToast({title: '系统错误,请联系管理员!', icon: 'none'});
}
// uni.showToast({title: '请检查必填项填写'});
// uni.showToast({title: '请检查必填项填写', icon: 'none'});
} finally {
// 确保加载页总是会被隐藏

View File

@@ -1,12 +1,12 @@
<!--
* @Date: 2024-10-08 14:29:36
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-04 14:16:26
* @LastEditTime: 2025-11-05 08:57:34
-->
<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"
@@ -16,18 +16,18 @@
<view class="inner-part">
<uni-forms labelPosition="left" :model="formData" :rules="rules" ref="uForm" class="self-form"
labelWidth="100">
<u-form-item label="姓名" prop="personName" required
<uni-forms-item label="姓名" prop="personName" required
v-if="$store.getters.roles.includes('shequn')|| $store.getters.roles.includes('gly')">
<view style="width: 100%;" @click="openPersonChooser"
:class="{disabledLine: !edit||!canChoosePerson, noValue: !formData.personName}">
{{ formData.personName || '请选择' }}
</view>
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</u-form-item>
</uni-forms-item>
<u-form-item label="需求说明" prop="jobDescription" required>
<u-textarea :disabled="!edit" v-model="formData.jobDescription" placeholder="请输入"></u-textarea>
</u-form-item>
<uni-forms-item label="需求说明" prop="jobDescription" required>
<textarea :disabled="!edit" v-model="formData.jobDescription" placeholder="请输入"></textarea>
</uni-forms-item>
</uni-forms>
</view>
</view>
@@ -167,12 +167,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
@@ -181,7 +181,6 @@
getPersonDemand(id).then(res => {
this.formData = res.data;
this.edit = false
this.fileList = this.$processFileUrl(this.formData.fileUrl)
})
},
confirmDate(type, e) {
@@ -259,24 +258,35 @@
this.formData.demandType = 9;
// this.formData.userId = this.formData.personId
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 = '保存成功';
}
// 检查响应码是否为200
if (response.code === 200) {
this.$u.toast(successMessage);
// 如果是编辑模式,关闭编辑状态;否则返回上一页
if (this.formData.id) {
this.edit = false;
} else {
await this.$delay(1000); // 延迟1秒后返回上一页
uni.navigateBack();
}
} else {
throw new Error('服务器响应错误');
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();
})
}
} catch (error) {
if(error.length){

View File

@@ -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({