添加页面

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,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){