提交10.31

This commit is contained in:
wuzhimiao
2025-10-31 18:43:06 +08:00
parent 5859560694
commit a8742d4521
48 changed files with 945 additions and 1928 deletions

View File

@@ -4,60 +4,83 @@
* @LastEditTime: 2025-05-06 16:56:20
-->
<template>
<view class="input-outer-part">
<view class="container" style="background-color: #f7f7f7;">
<scroll-view scroll-y="true" :style="{height: edit?'calc(90vh - 150px)':'calc(100vh - 144px)'}">
<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"
style="font-weight: normal;display: flex;" @click="edit=true">编辑<u-icon name="edit-pen"
color="#A6A6A6"></u-icon></view>
style="font-weight: normal;display: flex;" @click="edit=true">编辑<view class="icon-right"></view></view>
</view>
<view class="inner-part">
<u--form labelPosition="left" :model="formData" :rules="rules" ref="uForm" class="self-form"
labelWidth="100">
<u-form-item label="姓名" prop="personName" required
v-if="$store.getters.roles.includes('shequn'|| $store.getters.roles.includes('gly'))"
>
<view style="width: 100%;" @click="openPersonChooser"
<view class="self-form">
<view class="form-item">
<view class="form-label">姓名 <text class="required">*</text></view>
<view v-if="name" style="width: 100%;"
class="disabledLine">
{{ formData.personName || '请选择' }}
</view>
<view v-else 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>
<!--
<u-form-item label="服务需求标题" prop="serviceRequirementTitle" required>
<u--textarea :disabled="!edit" v-model="formData.serviceRequirementTitle"
placeholder="请输入"></u--textarea>
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</u-form-item> -->
<u-form-item label="有无场地需求" prop="ywcdxq" required>
<u-radio-group :disabled="!edit" v-model="formData.ywcdxq" placement="row">
<u-radio :customStyle="{marginRight: '16px'}" label="是" name="是"></u-radio>
<u-radio :customStyle="{marginRight: '16px'}" label="否" name="否"></u-radio>
</u-radio-group>
</u-form-item>
<u-form-item label="场地面积" prop="cdmj">
<u--input :disabled="!edit" v-model="formData.cdmj" border="none"
placeholder="请输入"></u--input>
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="办公人数" prop="bgrs">
<u--input :disabled="!edit" v-model="formData.bgrs" border="none"
placeholder="请输入"></u--input>
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="办公位置" prop="bgdd">
<u--input :disabled="!edit" v-model="formData.bgdd" border="none"
placeholder="请输入"></u--input>
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="有无创业培训需求" prop="ywcypxxq" required>
<u-radio-group :disabled="!edit" v-model="formData.ywcypxxq"
placement="row">
<u-radio :customStyle="{marginRight: '16px'}" label="是" name="是"></u-radio>
<u-radio :customStyle="{marginRight: '16px'}" label="否" name="否"></u-radio>
</u-radio-group>
</u-form-item>
<view class="icon-right"></view>
</view>
<view class="form-item">
<view class="form-label">有无场地需求 <text class="required">*</text></view>
<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>
</view>
<view class="form-item">
<view class="form-label">场地面积</view>
<input type="number" :disabled="!edit" v-model="formData.requiredOfficeSpace" placeholder="请输入" :class="['form-input', { 'form-input-disabled': !edit }]"/>
<view class="icon-right"></view>
</view>
<view class="form-item">
<view class="form-label">办公人数</view>
<input type="number" :disabled="!edit" v-model="formData.bgrs" placeholder="请输入" :class="['form-input', { 'form-input-disabled': !edit }]"/>
<view class="icon-right"></view>
</view>
<view class="form-item">
<view class="form-label">办公位置</view>
<input type="text" :disabled="!edit" v-model="formData.bgdd" placeholder="请输入" :class="['form-input', { 'form-input-disabled': !edit }]"/>
<view class="icon-right"></view>
</view>
<view class="form-item">
<view class="form-label">有无创业培训需求 <text class="required">*</text></view>
<view class="radio-group">
<view
:class="['radio-item', { 'radio-disabled': !edit }]"
@click="formData.ywcypxxq = '是'"
v-if="edit">
<view :class="['radio', { 'radio-checked': formData.ywcypxxq === '是' }]"></view>
<text></text>
</view>
<view
:class="['radio-item', { 'radio-disabled': !edit }]"
@click="formData.ywcypxxq = '否'"
v-if="edit">
<view :class="['radio', { 'radio-checked': formData.ywcypxxq === '否' }]"></view>
<text></text>
</view>
<view v-else>{{ formData.ywcypxxq }}</view>
</view>
</view>
<!-- <u-form-item label="是否意向接受创业培训" prop="isInterestedEntrepreneurshipGuidance" required>-->
<!-- <u-radio-group :disabled="!edit" v-model="formData.isInterestedEntrepreneurshipGuidance"-->
<!-- placement="row">-->
@@ -65,23 +88,31 @@
<!-- <u-radio :customStyle="{marginRight: '16px'}" label="否" name="否"></u-radio>-->
<!-- </u-radio-group>-->
<!-- </u-form-item>-->
<u-form-item label="有无资金需求" prop="ywzjxq" required>
<u-radio-group :disabled="!edit" v-model="formData.ywzjxq" placement="row">
<u-radio :customStyle="{marginRight: '16px'}" label="是" name="是"></u-radio>
<u-radio :customStyle="{marginRight: '16px'}" label="否" name="否"></u-radio>
</u-radio-group>
</u-form-item>
<u-form-item label="需求说明" prop="jobDescription" required>
<u-textarea :disabled="!edit" v-model="formData.jobDescription" placeholder="请输入"></u-textarea>
</u-form-item>
<!-- <u-form-item label="希望解决日期" prop="hopeSolveDate" required>
<view style="width: 100%;" @click="showPicker('hopeSolveDate')"
:class="{disabledLine: !edit, noValue: !formData.hopeSolveDate}">
{{ formData.hopeSolveDate||'请选择' }}
<view class="form-item">
<view class="form-label">有无资金需求 <text class="required">*</text></view>
<view class="radio-group">
<view
:class="['radio-item', { 'radio-disabled': !edit }]"
@click="formData.ywzjxq = '是'"
v-if="edit">
<view :class="['radio', { 'radio-checked': formData.ywzjxq === '是' }]"></view>
<text>是</text>
</view>
<view
:class="['radio-item', { 'radio-disabled': !edit }]"
@click="formData.ywzjxq = '否'"
v-if="edit">
<view :class="['radio', { 'radio-checked': formData.ywzjxq === '否' }]"></view>
<text>否</text>
</view>
<view v-else>{{ formData.ywzjxq }}</view>
</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item> -->
</u--form>
</view>
<view class="form-item">
<view class="form-label">需求说明 <text class="required">*</text></view>
<textarea :disabled="!edit" v-model="formData.jobDescription" placeholder="请输入" :class="['form-textarea', { 'form-textarea-disabled': !edit }]"></textarea>
</view>
</view>
</view>
</view>
<!-- <view class="inner" style="margin-top: 32rpx;">-->
@@ -112,29 +143,27 @@
fileUrl: formData.fileUrl
}" />
</scroll-view>
<u-datetime-picker :show="show.hopeSolveDate" v-model="dates.hopeSolveDate" mode="date"
@confirm="confirmDate('hopeSolveDate', $event)" @cancel="cancelPicker('hopeSolveDate')"></u-datetime-picker>
<choose-person ref="personChooser" @confirm="personNameConfirm" />
<view class="button-area" v-if="edit">
<view class="btn" @click="cancelPage">取消</view>
<view class="btn reset" @click="getPersonInfo()">重置</view>
<view class="btn reset" @click="formData.id ? getDetail(formData.id) : setDefaultValues()">重置</view>
<view class="btn save" @click="saveInfo">保存</view>
</view>
</view>
</template>
<script>
// import {
// getPersonBase
// } from "@/api/person";
// import {
// addPersonDemand,
// updatePersonDemand,
// getPersonDemand
// } from "@/api/needs/personDemand";
// import ImageUpload from '@/components/ImageUpload'
// import ChoosePerson from '@/pages/needs/components/choosePerson';
// import dayjs from "dayjs";
import {
getPersonBase
} from "@/packageRc/api/personinfo/index";
import {
addPersonDemand,
updatePersonDemand,
getPersonDemand
} from "@/packageRc/api/needs/personDemand";
import ImageUpload from './ImageUpload'
import ChoosePerson from './choosePerson';
import PlacePicker from "@/components/placePicker";
import dayjs from "dayjs";
export default {
components: {
// ChoosePerson,
@@ -152,55 +181,27 @@
},
data() {
return {
fileList: [],
edit: true,
personBase: {},
dates: {},
formData: {
jobDescription:"",
demandType:"2",
personName: '',
personId:"",
userId:"",
serviceRequirementTitle: '',
isAcceptAssistance: '',
isAcceptApprovalResult: '',
},
rules: {
ywcdxq: [{
required: true,
message: '请选择有无场地需求',
trigger: ['blur', 'change'],
}, ],
ywcypxxq: [{
required: true,
message: '请选择有无创业培训需求',
trigger: ['blur', 'change'],
}, ],
isInterestedEntrepreneurshipGuidance: [{
required: true,
message: '请选择是否意向接受创业培训',
trigger: ['blur', 'change'],
}, ],
ywzjxq: [{
required: true,
message: '请选择有无资金需求',
trigger: ['blur', 'change'],
}, ],
},
dict: {},
show: {},
currentCityArr: [],
originalDept: [],
currentCity: '请选择',
bysj: '',
loading: false,
jobTypeList: [],
route: {},
canChoosePerson: false,
formData: {
id: '',
personId: '',
userId: '',
personName: '',
ywcdxq: '',
requiredOfficeSpace: '',
bgrs: '',
bgdd: '',
ywcypxxq: '',
ywzjxq: '',
jobDescription: '',
actualSolveDate: '',
solveDesc: '',
actualSolvePeople: '',
fileUrl: '',
currentStatus: ''
}
}
},
onReady() {
@@ -223,13 +224,13 @@
uni.navigateBack()
}
},
// setName(){
// this.formData.personName = this.name
// this.formData.personId = this.needid
// this.formData.userId = this.needid
// this.$forceUpdate();
// },
setName(){
this.formData.personName = this.name
this.formData.personId = this.needId
this.formData.userId = this.needId
console.log("this",this)
},
openPersonChooser() {
if (this.edit && this.canChoosePerson) {
this.$refs.personChooser.open();
@@ -261,7 +262,8 @@
this.getPersonInfo()
if(this.name){
this.formData.personName = this.name
this.formData.userId = this.needid
this.formData.personId = this.needId
this.formData.userId = this.needId
}
this.edit = true
},
@@ -332,18 +334,32 @@
this.formData.serviceRequirementTitle = `${this.formData.personName}_于${dayNew}_提出创业需求`
},
async saveInfo() {
this.setName()
try {
if (!this.formData.jobDescription || this.formData.jobDescription.trim() === '') {
this.$u.toast('请填写需求说明!');
// 验证必填项
if (!this.formData.personName || this.formData.personName.trim() === '') {
uni.showToast({ title: '请选择姓名!', icon: 'none' });
return;
}
// 验证表单
const isValid = await this.$refs.uForm.validate();
if (!isValid) {
throw new Error('请检查必填项填写');
if (!this.formData.ywcdxq) {
uni.showToast({ title: '请选择有无场地需求!', icon: 'none' });
return;
}
if (!this.formData.ywcypxxq) {
uni.showToast({ title: '请选择有无创业培训需求!', icon: 'none' });
return;
}
if (!this.formData.ywzjxq) {
uni.showToast({ title: '请选择有无资金需求!', icon: 'none' });
return;
}
if (!this.formData.jobDescription || this.formData.jobDescription.trim() === '') {
uni.showToast({ title: '请填写需求说明!', icon: 'none' });
return;
}
// 显示全局加载
this.$showLoading();
uni.showLoading({ title: '保存中...' });
// 根据 formData 是否有 id 来决定是更新还是新增
let response;
this.formData.demandType = 2;
@@ -358,24 +374,23 @@
// 检查响应码是否为200
if (response.code === 200) {
this.$u.toast(successMessage);
uni.showToast({ title: successMessage, icon: 'success' });
// 如果是编辑模式,关闭编辑状态;否则返回上一页
if (this.formData.id) {
this.edit = false;
} else {
await this.$delay(1000); // 延迟1秒后返回上一页
uni.navigateBack();
// 延迟1秒后返回上一页
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
}
} catch (error) {
if(error.length){
this.$u.toast('请填写完整信息!');
}else{
this.$u.toast('系统错误,请联系管理员!');
}
console.error('保存失败:', error);
uni.showToast({ title: '系统错误,请联系管理员!', icon: 'none' });
} finally {
// 确保加载页总是会被隐藏
this.$hideLoading();
uni.hideLoading();
}
},
@@ -385,6 +400,21 @@
this.$set(this.formData, 'ywcypxxq', '是')
this.$set(this.formData, 'isInterestedEntrepreneurshipGuidance', '是')
this.$set(this.formData, 'ywzjxq', '是')
},
// 获取详情数据
async getDetail(id) {
try {
this.loading = true;
const response = await getPersonDemand(id);
if (response.code === 200) {
this.formData = { ...response.data };
}
} catch (error) {
console.error('获取详情失败:', error);
uni.showToast({ title: '获取详情失败', icon: 'none' });
} finally {
this.loading = false;
}
}
// saveInfo() {
// this.$refs.uForm.validate().then(res => {
@@ -431,10 +461,7 @@
background-repeat: no-repeat;
background-size: 100% auto;
}
.input-outer-part {
padding: 0 32rpx;
box-sizing: border-box;
}
.inner {
background: #eef1f5;
border-radius: 16rpx;
@@ -452,6 +479,115 @@
width: 100%;
}
/* 表单项目样式 */
.form-item {
display: flex;
align-items: flex-start;
margin-bottom: 24rpx;
background-color: #fff;
border-radius: 8rpx;
padding: 24rpx;
}
.form-label {
width: 200rpx;
font-size: 28rpx;
color: #333;
flex-shrink: 0;
line-height: 48rpx;
}
.required {
color: #f56c6c;
margin-left: 4rpx;
}
.form-input {
flex: 1;
border: none;
outline: none;
font-size: 28rpx;
color: #333;
background: none;
height: 48rpx;
line-height: 48rpx;
}
.form-input-disabled {
color: #909399;
background-color: #f5f7fa;
}
.form-textarea {
flex: 1;
border: none;
outline: none;
font-size: 28rpx;
color: #333;
background: none;
min-height: 120rpx;
line-height: 40rpx;
}
.form-textarea-disabled {
color: #909399;
background-color: #f5f7fa;
}
.icon-right {
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
color: #A6A6A6;
margin-left: 16rpx;
}
/* 单选框样式 */
.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;
}
/* 调整按钮区域样式 */
.button-area {
margin-top: 24rpx;