提交11月3日

This commit is contained in:
wuzhimiao
2025-11-03 09:32:51 +08:00
parent 228800c214
commit 97922abde8
8 changed files with 1171 additions and 642 deletions

View File

@@ -24,18 +24,45 @@
<div class="form-item required">
<label class="form-label">帮扶方式</label>
<div class="form-value" @click="showPicker('demandType')" :class="{ noValue: !serviceForm.demandType }">
{{ getDemandTypeLabel(serviceForm.demandType) || "请选择" }}
<span class="arrow-down"></span>
<div class="form-select-wrapper" style="position: relative;">
<!-- 显示区域 -->
<div
class="form-value"
:class="{ 'noValue': !serviceForm.demandType }"
@click="showDemandTypePicker = !showDemandTypePicker"
style="width: 100%; height: 40px; padding: 0 10px; border: 1px solid #e6e6e6; border-radius: 8rpx; background-color: #fff; display: flex; align-items: center; justify-content: space-between; cursor: pointer;"
>
{{ getDemandTypeLabel(serviceForm.demandType) || "请选择" }}
<span class="arrow-down"></span>
</div>
<!-- 选项列表 -->
<div
v-if="showDemandTypePicker"
class="options-list"
style="position: absolute; top: 45px; left: 0; right: 0; background-color: #fff; border: 1px solid #e6e6e6; border-radius: 8rpx; z-index: 1000; max-height: 200px; overflow-y: auto;"
>
<div
v-for="option in demandTypeOptions"
:key="option.value"
@click="selectDemandType(option.value)"
style="padding: 10px; border-bottom: 1px solid #f0f0f0; cursor: pointer;"
>
{{ option.label }}
</div>
</div>
</div>
</div>
<div class="form-item required" v-if="serviceForm.demandType == '4' || serviceForm.demandType == '5'">
<label class="form-label">帮扶时间</label>
<div class="form-value" @click="showPicker('practicalSolutionTime')" :class="{ noValue: !serviceForm.practicalSolutionTime }">
{{ serviceForm.practicalSolutionTime || "请选择" }}
<span class="arrow-down"></span>
</div>
<label class="form-label">帮扶时间 <text class="required">*</text></label>
<picker mode="date" :value="serviceForm.practicalSolutionTime" start="1900-01-01" end="2100-12-31" @change="onDateChange">
<view class="date-picker-wrapper" :class="{ noValue: !serviceForm.practicalSolutionTime }">
<view v-if="serviceForm.practicalSolutionTime" class="date-value">{{ serviceForm.practicalSolutionTime }}</view>
<view v-else>请选择</view>
<view class="icon-right"></view>
</view>
</picker>
</div>
<div class="form-item required" v-if="serviceForm.demandType == '4' || serviceForm.demandType == '5'">
@@ -67,9 +94,18 @@
<div class="form-item required" v-if="serviceForm.demandType == '4' || serviceForm.demandType == '5'">
<label class="form-label">帮扶内容</label>
<div class="form-value" @click="showPicker('serviceContent')" :class="{ noValue: !serviceForm.serviceContent }">
{{ getServiceContentLabel(serviceForm.serviceContent) || "请选择" }}
<span class="arrow-down"></span>
<div class="date-picker-wrapper" :class="{ noValue: !serviceForm.serviceContent }">
<picker
@change="onServiceContentChange"
:range="serviceContentOptions.map(item => item.label)"
:value="getServiceContentIndex(serviceForm.serviceContent)"
mode="selector"
>
<view class="date-value">
{{ getServiceContentLabel(serviceForm.serviceContent) || "请选择" }}
<span class="arrow-down"></span>
</view>
</picker>
</div>
</div>
</view>
@@ -83,10 +119,41 @@
placeholder="请输入"
></textarea>
</div>
// </view>
</view>
<view class="inner-part">
<div class="form-item required" v-if="serviceForm.demandType == '4' || serviceForm.demandType == '5'">
<label class="form-label">帮扶情况说明</label>
<div class="file-upload-container">
<button class="upload-btn" @click="chooseImages" :disabled="fileList.length >= 6">
+ 添加图片 ({{ fileList.length }}/6)
</button>
<div class="file-list" v-if="fileList.length > 0">
<div v-for="(file, index) in fileList" :key="index" class="file-item">
<image :src="file.url" mode="aspectFill" class="uploaded-image"></image>
<span class="delete-btn" @click="removeImage(index)">删除</span>
</div>
</div>
</div>
</div>
</view>
<view class="inner-part" v-if="serviceForm.demandType == '4' || serviceForm.demandType == '5'">
<div class="form-item">
<label class="form-label">附件</label>
@@ -147,7 +214,10 @@
</template>
<script>
import ImageUpload from "@/components/ImageUpload";
import {getJbrInfo} from "../../api/personinfo/index"
import { getDicts } from '@/apiRc/system/dict.js';
export default {
data() {
return {
@@ -164,10 +234,30 @@ export default {
personStatus: '', // 人员状态
fileUrl: [] // 附件
},
serviceContentMap: {
'1': '就业政策咨询',
'2': '职业指导',
'3': '技能培训',
'4': '岗位推荐',
'5': '创业指导',
'6': '其他'
},
// 帮扶内容选项picker组件需要的格式
serviceContentOptions: [
{ value: '1', label: '就业政策咨询' },
{ value: '2', label: '职业指导' },
{ value: '3', label: '技能培训' },
{ value: '4', label: '岗位推荐' },
{ value: '5', label: '创业指导' },
{ value: '6', label: '其他' }
],
showDemandTypePicker: false, // 控制帮扶方式选择器显示
jingbrList1:[],
currentPicker: null,
selectedOption: '',
manualDateTime: this.formatDateTime(new Date()),
fileList: [], // 初始化文件列表
// 帮扶方式选项 (4: 上门服务, 5: 电话回访)
demandTypeOptions: [
{ value: '4', label: '上门服务' },
@@ -185,29 +275,34 @@ export default {
{ value: '2', label: '未接通' },
{ value: '3', label: '拒绝沟通' }
],
// 帮扶内容选项
serviceContentOptions: [
{ value: '1', label: '政策宣传' },
{ value: '2', label: '就业指导' },
{ value: '3', label: '技能培训' },
{ value: '4', label: '岗位推荐' },
{ value: '5', label: '其他' }
],
// 人员状态选项
personStatusOptions: [
{ value: '1', label: '已就业' },
{ value: '2', label: '未就业' },
{ value: '3', label: '灵活就业' }
]
// 帮扶内容选项(通过字典获取)
serviceContentOptions: [],
// 人员状态选项(通过字典获取)
personStatusOptions: []
};
},
async created(){
this.getJbrInfo11()
const serviceContentOptions = await this.$getDictSelectOption('qcjy_fwnr');
console.log('帮扶内容选项:', serviceContentOptions);
this.serviceContentOptions = serviceContentOptions;
const serviceContentOptions1 = await this.$getDictSelectOption('qcjy_ryzt');
this.personStatusOptions=serviceContentOptions1
created(){
this.getJbrInfo11();
// 使用getDicts API获取帮扶内容字典数据
getDicts('qcjy_fwnr').then(res => {
if (res.data && Array.isArray(res.data)) {
// 将字典数据转换为picker组件需要的格式
this.serviceContentOptions = res.data.map(item => ({
value: item.dictValue,
label: item.dictLabel
}));
}
});
// 使用getDicts API获取人员状态字典数据
getDicts('qcjy_ryzt').then(res => {
if (res.data && Array.isArray(res.data)) {
this.personStatusOptions = res.data.map(item => ({
value: item.dictValue,
label: item.dictLabel
}));
}
});
},
onLoad(options) {
if (options.name) {
@@ -218,6 +313,46 @@ this.personStatusOptions=serviceContentOptions1
}
},
methods: {
// 选择图片
chooseImages() {
const remainingCount = 6 - this.fileList.length;
if (remainingCount <= 0) {
uni.showToast({ title: '最多只能上传6张图片', icon: 'none' });
return;
}
uni.chooseImage({
count: remainingCount,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
// 添加新选择的图片到列表
res.tempFilePaths.forEach((path, index) => {
this.fileList.push({
url: path,
file: res.tempFiles[index]
});
});
// 更新 serviceForm.fileUrl
this.updateFileUrls();
},
fail: (err) => {
console.error('选择图片失败:', err);
}
});
},
// 移除图片
removeImage(index) {
this.fileList.splice(index, 1);
// 更新 serviceForm.fileUrl
this.updateFileUrls();
},
// 更新文件URL数组
updateFileUrls() {
this.serviceForm.fileUrl = this.fileList.map(file => file.url);
},
async getJbrInfo11(){
const res=await getJbrInfo()
this.jingbrList1=res
@@ -296,6 +431,17 @@ this.personStatusOptions=serviceContentOptions1
this.serviceForm.agentUserName = '';
}
},
// 处理帮扶方式选择变化
handleDemandTypeChange(event) {
this.serviceForm.demandType = event.target.value;
},
// 选择帮扶方式
selectDemandType(value) {
this.serviceForm.demandType = value;
this.showDemandTypePicker = false;
},
// 获取电话沟通结果标签
getDhgtjgLabel(value) {
const option = this.dhgtjgOptions.find(item => item.value === value);
@@ -303,8 +449,22 @@ this.personStatusOptions=serviceContentOptions1
},
// 获取帮扶内容标签
getServiceContentLabel(value) {
const option = this.serviceContentOptions.find(item => item.value === value);
return option ? option.label : '';
return this.serviceContentMap[value] || '';
},
// 处理帮扶内容选择变化
onServiceContentChange(e) {
const index = e.detail.value;
if (this.serviceContentOptions && this.serviceContentOptions[index]) {
this.serviceForm.serviceContent = this.serviceContentOptions[index].value;
}
},
// 获取帮扶内容当前索引
getServiceContentIndex(value) {
if (!value) return 0;
const index = this.serviceContentOptions.findIndex(item => item.value === value);
return index !== -1 ? index : 0;
},
// 格式化日期时间为YYYY-MM-DDTHH:MM格式datetime-local输入框需要
formatDateTime(date) {
@@ -316,6 +476,11 @@ this.personStatusOptions=serviceContentOptions1
return `${year}-${month}-${day}T${hours}:${minutes}`;
},
// 日期选择变化处理
onDateChange(e) {
this.serviceForm.practicalSolutionTime = e.detail.value;
},
// 手动确认日期选择
manualConfirmDate() {
// 将datetime-local格式转换为显示格式
@@ -389,7 +554,13 @@ this.personStatusOptions=serviceContentOptions1
return true;
},
setName(){
this.serviceForm.serviceObjectName = this.name
this.serviceForm.serviceObjectId = this.userId
this.serviceForm.userId = this.userId
this.$forceUpdate();
},
// 提交表单
async submitServiceForm() {
try {
@@ -471,7 +642,37 @@ this.personStatusOptions=serviceContentOptions1
.form-select-wrapper {
flex: 1;
padding: 5px 0;
position: relative;
}
.form-select {
width: 100%;
padding: 20rpx;
border: 1px solid #e6e6e6;
border-radius: 8rpx;
font-size: 28rpx;
color: #333;
background-color: #fff;
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
cursor: pointer;
}
.form-select.noValue {
color: #999;
}
.form-select-wrapper::after {
content: '▼';
position: absolute;
right: 30rpx;
top: 50%;
transform: translateY(-50%);
pointer-events: none;
color: #999;
font-size: 20rpx;
}
.form-item.required .form-label::after {
content: '*';
@@ -570,6 +771,59 @@ this.personStatusOptions=serviceContentOptions1
color: #666;
}
/* 文件上传样式 */
.file-upload-container {
width: 100%;
padding: 10px 0;
}
.upload-btn {
padding: 10px 20px;
background-color: #f0f0f0;
border: 1px dashed #ddd;
border-radius: 4px;
color: #666;
margin-bottom: 10px;
width: 100%;
}
.upload-btn:disabled {
opacity: 0.6;
}
.file-list {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.file-item {
position: relative;
width: 100px;
height: 100px;
}
.uploaded-image {
width: 100%;
height: 100%;
border-radius: 4px;
}
.delete-btn {
position: absolute;
top: -8px;
right: -8px;
background-color: #ff4444;
color: white;
width: 20px;
height: 20px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
}
/* 选择器样式 */
.datetime-picker-overlay {
position: fixed;
@@ -586,39 +840,99 @@ this.personStatusOptions=serviceContentOptions1
.datetime-picker {
background-color: #fff;
border-radius: 8px;
width: 80%;
max-width: 400px;
border-radius: 12px;
width: 85%;
max-width: 420px;
overflow: hidden;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.picker-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
border-bottom: 1px solid #f0f0f0;
padding: 16px 20px;
border-bottom: 1px solid #f5f5f5;
font-size: 17px;
background-color: #fafafa;
}
.picker-header > span:first-child {
color: #666;
font-size: 16px;
}
.picker-header > span:last-child {
color: #1d64cf;
font-size: 16px;
font-weight: 500;
}
.picker-content {
max-height: 300px;
max-height: 280px;
overflow-y: auto;
}
.picker-options {
padding: 10px 0;
padding: 5px 0;
}
.picker-options > div {
padding: 15px 20px;
font-size: 14px;
color: #666;
padding: 16px 20px;
font-size: 16px;
color: #333;
position: relative;
transition: all 0.2s ease;
display: flex;
align-items: center;
}
.picker-options > div:not(:last-child) {
border-bottom: 1px solid #f8f8f8;
}
.picker-options > div:active {
background-color: #f5f5f5;
}
.picker-options > div.selected {
background-color: #f0f8ff;
background-color: #f0f7ff;
color: #1d64cf;
font-weight: 500;
}
/* 添加选中状态的对勾图标 */
.picker-options > div.selected::after {
content: '✓';
position: absolute;
right: 20px;
font-size: 18px;
font-weight: bold;
color: #1d64cf;
}
/* 日期选择器样式 */
.date-picker-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
background-color: #fff;
}
.date-picker-wrapper.noValue {
background-color: #f9f9f9;
}
.date-value {
color: #333;
}
.icon-right {
color: #999;
font-size: 16px;
}
.noValue {

View File

@@ -628,12 +628,36 @@ export default {
},
goAddServices() {
uni.navigateTo({
url:`/packageRc/pages/daiban/addbangfu?id=${this.form.userId}&name=${this.form.name}`
})
console.log("服务按钮点击事件触发");
console.log("form数据:", this.form);
console.log("userId:", this.form?.userId);
console.log("name:", this.form?.name);
try {
const url = `/packageRc/pages/daiban/addbangfu?id=${this.form?.userId || ''}&name=${this.form.name}`;
console.log("导航URL:", url);
uni.navigateTo({
url: url,
success: () => {
console.log("导航成功");
},
fail: (err) => {
console.error("导航失败:", err);
uni.showToast({
title: '导航失败: ' + JSON.stringify(err),
icon: 'none'
});
}
});
} catch (error) {
console.error("执行出错:", error);
uni.showToast({
title: '执行出错: ' + error.message,
icon: 'none'
});
}
},
goRecommend() {
this.$tab.navigateTo(
@@ -1095,6 +1119,7 @@ export default {
}
}
.top_box_bg_service {
display:none;
position: absolute;
top: 20rpx;
left: 40rpx;