提交11月3日
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* @LastEditTime: 2025-05-06 16:56:20
|
||||
-->
|
||||
<template>
|
||||
<view class="container" style="background-color: #f7f7f7;">
|
||||
<view class="container" style="background-color: #eef1f5;">
|
||||
<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;">创业需求信息
|
||||
@@ -210,10 +210,10 @@
|
||||
async created() {
|
||||
this.loading = true;
|
||||
// await this.$delay(600)
|
||||
// this.setDefaultValues()
|
||||
// setTimeout(() => {
|
||||
// this.setName()
|
||||
// }, 0);
|
||||
this.setDefaultValues()
|
||||
setTimeout(() => {
|
||||
this.setName()
|
||||
}, 0);
|
||||
},
|
||||
methods: {
|
||||
cancelPage() {
|
||||
@@ -225,12 +225,14 @@
|
||||
}
|
||||
},
|
||||
setName(){
|
||||
this.formData.personName = this.name
|
||||
this.formData.personId = this.needId
|
||||
this.formData.userId = this.needId
|
||||
// 只有在name有值时才设置人员信息
|
||||
if(this.name) {
|
||||
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();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
-->
|
||||
<template>
|
||||
<view class="container" style="background-color: #f7f7f7;">
|
||||
<scroll-view scroll-y="true" :style="{height: edit?'calc(90vh - 150px)':'calc(100vh - 144px)'}">
|
||||
<scroll-view scroll-y="true" >
|
||||
<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"
|
||||
@@ -156,18 +156,16 @@
|
||||
</u--form>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 使用原生picker组件代替uView的选择器 -->
|
||||
<!-- 工种选择器弹窗 -->
|
||||
|
||||
|
||||
</scroll-view>
|
||||
<view class="button-area" v-if="edit">
|
||||
<view class="btn" @click="cancelPage">取消</view>
|
||||
<view class="btn reset" @click="getDetail(formData.id)">重置</view>
|
||||
<view class="btn save" @click="saveInfo">保存</view>
|
||||
</view>
|
||||
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
@@ -230,6 +228,7 @@
|
||||
jobDescription: '',
|
||||
// fileUrl: []
|
||||
},
|
||||
bfnrzd:[],
|
||||
rules: {
|
||||
personName: [{
|
||||
required: true,
|
||||
@@ -254,11 +253,11 @@
|
||||
message: '请选择最低薪酬',
|
||||
trigger: ['blur', 'change'],
|
||||
}, ],
|
||||
jobDescription: [{
|
||||
required: true,
|
||||
message: '请填写求职说明',
|
||||
trigger: ['blur', 'change'],
|
||||
}, ]
|
||||
jobDescription: [{
|
||||
required: true,
|
||||
message: '请填写求职说明',
|
||||
trigger: ['blur', 'change'],
|
||||
}, ]
|
||||
// employmentType: [{
|
||||
// required: true,
|
||||
// message: '请选择用工形式',
|
||||
@@ -303,6 +302,9 @@
|
||||
},
|
||||
// 移除uView表单验证相关代码
|
||||
created() {
|
||||
getDicts('qcjy_fwnr').then(res => {
|
||||
this.bfnrzd = res.data;
|
||||
});
|
||||
this.setName()
|
||||
this.loading = true;
|
||||
let arr = [{
|
||||
@@ -380,12 +382,15 @@
|
||||
}
|
||||
},
|
||||
setName(){
|
||||
this.formData.personName = this.name
|
||||
this.formData.personId = this.needId
|
||||
this.formData.userId = this.needId
|
||||
// 只有在name有值时才设置人员信息,避免覆盖已有数据
|
||||
if(this.name) {
|
||||
this.formData.personName = this.name
|
||||
this.formData.personId = this.needId
|
||||
this.formData.userId = this.needId
|
||||
}
|
||||
},
|
||||
personNameConfirm(event) {
|
||||
this.formData.personName = event.name
|
||||
// this.formData.personName = event.name
|
||||
this.formData.personId = event.id
|
||||
this.formData.userId = event.userId
|
||||
|
||||
@@ -745,107 +750,163 @@
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
<style lang="scss">
|
||||
|
||||
.page ::v-deep .u-navbar__content {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.page {
|
||||
background-color: #3161c7;
|
||||
height: 100vh;
|
||||
background-image: url('https://rc.jinan.gov.cn/qcwjyH5/static/images/top.png');
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% auto;
|
||||
}
|
||||
|
||||
.inner {
|
||||
padding: 40rpx;
|
||||
background: #eef1f5;
|
||||
border-radius: 16rpx;
|
||||
padding: 32rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
}
|
||||
|
||||
.inner-part {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 为表单元素添加一些间距 */
|
||||
.self-form {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 表单项目样式 */
|
||||
.form-item {
|
||||
display: flex;
|
||||
margin-bottom: 40rpx;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 20rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 24rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 8rpx;
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
width: 140rpx;
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
line-height: 1.5;
|
||||
font-weight: 500;
|
||||
margin-right: 30rpx;
|
||||
text-align: right;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
flex: 1;
|
||||
height: 80rpx;
|
||||
padding: 0 25rpx;
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 8rpx;
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.form-input:focus {
|
||||
border-color: #1989fa;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 0 3rpx rgba(25, 137, 250, 0.1);
|
||||
}
|
||||
|
||||
.form-input-disabled {
|
||||
color: #999;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.form-textarea {
|
||||
flex: 1;
|
||||
min-height: 200rpx;
|
||||
padding: 25rpx;
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 8rpx;
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
background-color: #fafafa;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.form-textarea:focus {
|
||||
border-color: #1989fa;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 0 3rpx rgba(25, 137, 250, 0.1);
|
||||
}
|
||||
|
||||
.form-textarea-disabled {
|
||||
color: #999;
|
||||
background-color: #f5f5f5;
|
||||
width: 200rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
flex-shrink: 0;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
|
||||
.required {
|
||||
color: #FF4D4F;
|
||||
margin-left: 4rpx;
|
||||
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;
|
||||
}
|
||||
|
||||
.picker-view {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 80rpx;
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 8rpx;
|
||||
padding: 0 25rpx;
|
||||
background-color: #fafafa;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border: none;
|
||||
outline: none;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
background: none;
|
||||
height: 48rpx;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
|
||||
.picker-view-text {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.disabledLine {
|
||||
background-color: #f5f5f5;
|
||||
color: #999;
|
||||
}
|
||||
/* 按钮区域样式 */
|
||||
.button-area {
|
||||
padding: 24rpx 32rpx 68rpx;
|
||||
width: calc(100% + 64rpx);
|
||||
margin-left: -32rpx;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
margin-top: 40rpx;
|
||||
border-radius: 16px 16px 0px 0px;
|
||||
|
||||
.noValue {
|
||||
color: #999;
|
||||
}
|
||||
.btn {
|
||||
line-height: 72rpx;
|
||||
width: 176rpx;
|
||||
margin-right: 16rpx;
|
||||
font-size: 28rpx;
|
||||
border: 1px solid #B8C5D4;
|
||||
color: #282828;
|
||||
text-align: center;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.reset {
|
||||
background: #DCE2E9;
|
||||
}
|
||||
|
||||
.save {
|
||||
background: linear-gradient(103deg, #1D64CF 0%, #1590D4 99%);
|
||||
color: #fff;
|
||||
border: 0;
|
||||
flex-grow: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.noValue {
|
||||
color: rgb(192, 196, 204);
|
||||
}
|
||||
|
||||
.disabledLine {
|
||||
background: rgb(245, 247, 250);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.ellipsis_1 {
|
||||
overflow: hidden;
|
||||
@@ -853,45 +914,16 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 按钮区域样式 */
|
||||
.button-area {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 40rpx;
|
||||
gap: 30rpx;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #eee;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
text-align: center;
|
||||
border-radius: 44rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.btn.save {
|
||||
color: #fff;
|
||||
background-color: #1989fa;
|
||||
}
|
||||
|
||||
.btn.reset {
|
||||
color: #666;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
/* 图标样式优化 */
|
||||
.icon-right {
|
||||
margin-left: 20rpx;
|
||||
font-size: 36rpx;
|
||||
color: #1989fa;
|
||||
}
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #A6A6A6;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
@@ -4,75 +4,60 @@
|
||||
* @LastEditTime: 2025-05-07 10:03:20
|
||||
-->
|
||||
<template>
|
||||
|
||||
<view class="input-outer-part">
|
||||
<scroll-view scroll-y="true" :style="{height: edit?'calc(90vh - 330rpx)':'calc(90vh - 200rpx)'}">
|
||||
<view class="container">
|
||||
<scroll-view scroll-y="true" >
|
||||
<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>
|
||||
<view class="icon-right">✏️</view>
|
||||
</view>
|
||||
|
||||
<u-form-item label="需求说明" prop="jobDescription" required>
|
||||
<u-textarea :disabled="!edit" v-model="formData.jobDescription" placeholder="请输入"></u-textarea>
|
||||
</u-form-item>
|
||||
</u--form>
|
||||
<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>
|
||||
|
||||
<!-- 办理完成后 需求说明 -->
|
||||
<req-comp :form="{
|
||||
actualSolveDate: formData.actualSolveDate,
|
||||
actualSolvePeople: formData.actualSolvePeople,
|
||||
solveDesc: formData.solveDesc,
|
||||
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="getDetail(formData.id)">重置</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 {
|
||||
// listJobType
|
||||
// } from "@/api/jobType/index";
|
||||
// import dayjs from "dayjs";
|
||||
import { getPersonBase } from "@/packageRc/api/personinfo/index";
|
||||
import { addPersonDemand, updatePersonDemand, getPersonDemand } from "@/packageRc/api/needs/personDemand";
|
||||
//import reqComp from './req-comp';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
// ChoosePerson,
|
||||
//ImageUpload
|
||||
},
|
||||
// reqComp
|
||||
},
|
||||
props: {
|
||||
needId: {
|
||||
needId: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
@@ -83,65 +68,60 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fileList: [],
|
||||
edit: true,
|
||||
personBase: {},
|
||||
dates: {},
|
||||
formData: {
|
||||
isAcceptAssistance: '',
|
||||
isAcceptApprovalResult: '',
|
||||
qtxqsm: ''
|
||||
},
|
||||
rules: {
|
||||
personName: [{
|
||||
required: true,
|
||||
message: '请填写姓名',
|
||||
trigger: ['blur', 'change'],
|
||||
}, ],
|
||||
qtxqsm: [{
|
||||
required: true,
|
||||
message: '请填写需求说明',
|
||||
trigger: ['blur', 'change'],
|
||||
}, ],
|
||||
},
|
||||
dict: {},
|
||||
show: {},
|
||||
currentCityArr: [],
|
||||
originalDept: [],
|
||||
currentCity: '请选择',
|
||||
bysj: '',
|
||||
loading: false,
|
||||
jobTypeList: [],
|
||||
route: {},
|
||||
canChoosePerson: false,
|
||||
formData: {
|
||||
id: '',
|
||||
personName: '',
|
||||
personId: '',
|
||||
demandType:"9",
|
||||
userId: '',
|
||||
demandTitle: '',
|
||||
jobDescription: '',
|
||||
actualSolveDate: '',
|
||||
actualSolvePeople: '',
|
||||
solveDesc: '',
|
||||
fileUrl: '',
|
||||
currentStatus: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules)
|
||||
// 组件已准备就绪
|
||||
},
|
||||
created() {
|
||||
this.loading = true;
|
||||
// 直接使用传入的参数设置姓名信息
|
||||
if(this.name && this.needId) {
|
||||
this.formData.personName = this.name;
|
||||
this.formData.personId = this.needId;
|
||||
this.formData.userId = this.needId;
|
||||
}
|
||||
// 如果需要获取详情
|
||||
if (this.needId) {
|
||||
this.getDetail(this.needId);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cancelPage() {
|
||||
if (this.formData.id) {
|
||||
this.edit = false;
|
||||
this.getDetail(this.formData.id)
|
||||
if (!this.formData.id) {
|
||||
this.$u.navigateBack();
|
||||
} else {
|
||||
uni.navigateBack()
|
||||
this.edit = false;
|
||||
this.getDetail(this.formData.id);
|
||||
}
|
||||
},
|
||||
workTypeRemoteMethod(key) {
|
||||
listJobType({
|
||||
workTypeName: key,
|
||||
pageNum: 1,
|
||||
pageSize: 50
|
||||
}).then(
|
||||
(res) => {
|
||||
this.jobTypeList = res.rows;
|
||||
}
|
||||
);
|
||||
},
|
||||
// workTypeRemoteMethod(key) {
|
||||
// listJobType({
|
||||
// workTypeName: key,
|
||||
// pageNum: 1,
|
||||
// pageSize: 50
|
||||
// }).then(
|
||||
// (res) => {
|
||||
// this.jobTypeList = res.rows;
|
||||
// }
|
||||
// );
|
||||
// },
|
||||
openPersonChooser() {
|
||||
if (this.edit && this.canChoosePerson) {
|
||||
this.$refs.personChooser.open();
|
||||
@@ -151,214 +131,173 @@
|
||||
this.formData.personName = event.name
|
||||
this.formData.personId = event.id
|
||||
this.formData.userId = event.userId
|
||||
this.formNameChange();
|
||||
this.$forceUpdate();
|
||||
},
|
||||
changeFile(e) {
|
||||
// 清空当前的 fileUrl 数组
|
||||
this.formData.fileUrl = [];
|
||||
// 如果 e 有长度(即用户选择了文件)
|
||||
if (e.length) {
|
||||
// 遍历每个文件对象并获取其 url
|
||||
for (let data of e) {
|
||||
const url = data.data ? data.data.url : data.url;
|
||||
this.formData.fileUrl.push(url);
|
||||
}
|
||||
}
|
||||
this.formData.fileUrl = this.$arrayToString(this.formData.fileUrl)
|
||||
},
|
||||
addOne() {
|
||||
this.formData = {}
|
||||
this.getPersonInfo()
|
||||
if(this.name){
|
||||
this.formData.personName = this.name
|
||||
this.formData.userId = this.needid
|
||||
}
|
||||
this.edit = true
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
getDetail(id) {
|
||||
getPersonDemand(id).then(res => {
|
||||
this.formData = res.data;
|
||||
this.edit = false
|
||||
this.fileList = this.$processFileUrl(this.formData.fileUrl)
|
||||
})
|
||||
},
|
||||
confirmDate(type, e) {
|
||||
this.show[type] = false;
|
||||
let date = new Date(e.value)
|
||||
this.formData[type] =
|
||||
`${date.getFullYear()}-${(date.getMonth()+1)>9?(date.getMonth()+1):('0'+(date.getMonth()+1))}-${date.getDate()>9?date.getDate():('0'+date.getDate())}`
|
||||
this.$forceUpdate();
|
||||
this.$request({
|
||||
url: '/mini/demand/getPersonDemandById',
|
||||
method: 'GET',
|
||||
data: {
|
||||
id: id
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.formData = res.data;
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
},
|
||||
goBack() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
cancelPicker(type) {
|
||||
this.show[type] = false
|
||||
this.$forceUpdate();
|
||||
},
|
||||
getDictLabel(value, list) {
|
||||
if (list) {
|
||||
let arr = list.filter(ele => ele.dictValue == value)
|
||||
if (arr.length) {
|
||||
return arr[0].dictLabel
|
||||
} else {
|
||||
return '请选择'
|
||||
}
|
||||
|
||||
setName() {
|
||||
// 确保personName存在
|
||||
if (!this.formData.personName) {
|
||||
this.formData.personName = '未知用户';
|
||||
}
|
||||
let date = new Date();
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
month = month < 10 ? '0' + month : month;
|
||||
let day = date.getDate();
|
||||
day = day < 10 ? '0' + day : day;
|
||||
this.formData.demandTitle = `${this.formData.personName}_于${year}-${month}-${day}_提出其他需求`;
|
||||
},
|
||||
pickerConfirm(type, event) {
|
||||
this.show[type] = false
|
||||
this.formData[type] = event.value[0].dictValue
|
||||
this.$forceUpdate();
|
||||
},
|
||||
showPicker(type) {
|
||||
if (this.edit) {
|
||||
this.show[type] = true
|
||||
this.$forceUpdate()
|
||||
}
|
||||
},
|
||||
getPersonInfo() {
|
||||
this.loading = true;
|
||||
this.$store.dispatch("GetInfo").then((res) => {
|
||||
if (res.data.roles.indexOf('qunzhong') == -1) {
|
||||
this.canChoosePerson = true;
|
||||
} else {
|
||||
this.canChoosePerson = false;
|
||||
getPersonBase(res.data.user.userId).then(resp => {
|
||||
this.formData.personId = resp.data.id
|
||||
this.formData.userId = resp.data.userId
|
||||
this.formData.personName = resp.data.name
|
||||
this.formNameChange();
|
||||
this.$forceUpdate();
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
formNameChange() {
|
||||
let date = new Date()
|
||||
let day =
|
||||
`${date.getFullYear()}-${(date.getMonth()+1) + 1 > 9 ? (date.getMonth()+1) + 1: '0'+((date.getMonth()+1) + 1)}-${date.getDate() > 9 ? date.getDate(): '0'+date.getDate()}`
|
||||
const dayNew = dayjs(date).format("YYYY-MM-DD");
|
||||
this.formData.demandTitle = `${this.formData.personName}_于${dayNew}_提出其他需求`
|
||||
},
|
||||
async saveInfo() {
|
||||
saveInfo() {
|
||||
console.log("执行")
|
||||
try {
|
||||
// 验证表单
|
||||
const isValid = await this.$refs.uForm.validate();
|
||||
if (!isValid) {
|
||||
throw new Error('请检查必填项填写');
|
||||
// 验证必填项
|
||||
if (!this.formData.personName) {
|
||||
uni.showToast({
|
||||
title: '请选择姓名',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 显示全局加载
|
||||
this.$showLoading();
|
||||
|
||||
// 根据 formData 是否有 id 来决定是更新还是新增
|
||||
let response;
|
||||
let successMessage;
|
||||
this.formData.demandType = 9;
|
||||
// this.formData.userId = this.formData.personId
|
||||
if (this.formData.id) {
|
||||
response = await updatePersonDemand(this.formData);
|
||||
successMessage = '修改成功';
|
||||
} else {
|
||||
response = await addPersonDemand(this.formData);
|
||||
successMessage = '保存成功';
|
||||
if (!this.formData.jobDescription) {
|
||||
uni.showToast({
|
||||
title: '请输入需求说明',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 检查响应码是否为200
|
||||
if (response.code === 200) {
|
||||
this.$u.toast(successMessage);
|
||||
// 如果是编辑模式,关闭编辑状态;否则返回上一页
|
||||
if (this.formData.id) {
|
||||
uni.showLoading({
|
||||
title: '保存中...'
|
||||
});
|
||||
this.setName();
|
||||
let params = {
|
||||
...this.formData,
|
||||
type: '3'
|
||||
};
|
||||
const requestFn = this.formData.id ? updatePersonDemand : addPersonDemand;
|
||||
requestFn(params).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success'
|
||||
});
|
||||
this.edit = false;
|
||||
if (!this.formData.id) {
|
||||
this.formData.id = res.data;
|
||||
}
|
||||
} else {
|
||||
await this.$delay(1000); // 延迟1秒后返回上一页
|
||||
uni.navigateBack();
|
||||
uni.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
throw new Error('服务器响应错误');
|
||||
}
|
||||
}).catch(err => {
|
||||
if (err.message) {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
if(error.length){
|
||||
this.$u.toast('请填写完整信息!');
|
||||
}else{
|
||||
this.$u.toast('系统错误,请联系管理员!');
|
||||
}
|
||||
console.error('保存失败:', error);
|
||||
} finally {
|
||||
// 确保加载页总是会被隐藏
|
||||
this.$hideLoading();
|
||||
uni.hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
// saveInfo() {
|
||||
// this.$refs.uForm.validate().then(res => {
|
||||
// if (this.formData.id) {
|
||||
// updatePersonDemand(this.formData).then(res => {
|
||||
// if (res.code == 200) {
|
||||
// uni.showToast({
|
||||
// title: '修改成功'
|
||||
// })
|
||||
// this.edit = false;
|
||||
// }
|
||||
// })
|
||||
// } else {
|
||||
// addPersonDemand(this.formData).then(res => {
|
||||
// if (res.code == 200) {
|
||||
// uni.showToast({
|
||||
// title: '保存成功'
|
||||
// })
|
||||
// uni.navigateBack();
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// }).catch(() => {
|
||||
// uni.showToast({
|
||||
// title: '请检查必填项填写',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.page ::v-deep .u-navbar__content {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.page {
|
||||
background-color: #EEF1F5 !important;
|
||||
<style lang="scss"> .container {
|
||||
height: 100vh;
|
||||
background-image: url('https://rc.jinan.gov.cn/qcwjyH5/static/images/top.png');
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% auto;
|
||||
overflow: hidden;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
.input-outer-part {
|
||||
padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.inner {
|
||||
background: #eef1f5;
|
||||
border-radius: 16rpx;
|
||||
padding: 32rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
}
|
||||
.inner {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 32rpx;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.inner-part {
|
||||
width: 100%;
|
||||
}
|
||||
.inner-part {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 为表单元素添加一些间距 */
|
||||
.self-form {
|
||||
width: 100%;
|
||||
}
|
||||
.self-form {
|
||||
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-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;
|
||||
}
|
||||
|
||||
/* 调整按钮区域样式 */
|
||||
.button-area {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
.button-area {
|
||||
padding: 24rpx 32rpx 68rpx;
|
||||
width: calc(100% + 64rpx);
|
||||
@@ -392,6 +331,67 @@
|
||||
}
|
||||
}
|
||||
|
||||
.container {
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
|
||||
.inner {
|
||||
background-color: #f7f7f7;
|
||||
padding: 24rpx 32rpx;
|
||||
}
|
||||
|
||||
.self-form {
|
||||
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-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;
|
||||
}
|
||||
|
||||
.noValue {
|
||||
color: rgb(192, 196, 204);
|
||||
}
|
||||
@@ -400,4 +400,4 @@
|
||||
background: rgb(245, 247, 250);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -4,48 +4,30 @@
|
||||
* @LastEditTime: 2025-05-07 09:33:39
|
||||
-->
|
||||
<template>
|
||||
|
||||
<view class="input-outer-part">
|
||||
<scroll-view scroll-y="true" :style="{height: edit?'calc(90vh - 150px)':'calc(100vh - 144px)'}">
|
||||
<view class="container">
|
||||
<scroll-view scroll-y="true" :style="{height: edit?'calc(90vh - 150px)':'calc(100vh - 144px)', backgroundColor: '#eef1f5'}">
|
||||
|
||||
<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="120">
|
||||
<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="demandTitle" required>
|
||||
<u--textarea :disabled="!edit" v-model="formData.demandTitle"
|
||||
placeholder="请输入"></u--textarea>
|
||||
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
|
||||
</u-form-item -->
|
||||
|
||||
<!-- <u-form-item label="有无创业指导需求" prop="isWillingnessReceiveTraining" required>
|
||||
<u-radio-group :disabled="!edit" v-model="formData.isWillingnessReceiveTraining"
|
||||
placement="row">
|
||||
<u-radio :customStyle="{marginRight: '16px'}" label="是" name="是" value="1"></u-radio>
|
||||
<u-radio :customStyle="{marginRight: '16px'}" label="否" name="否" value="0"></u-radio>
|
||||
</u-radio-group>
|
||||
</u-form-item>
|
||||
<u-form-item label="是否接受推荐工作" prop="isAcceptRecommendedJobs" required>
|
||||
<u-radio-group :disabled="!edit" v-model="formData.isAcceptRecommendedJobs" placement="row">
|
||||
<u-radio :customStyle="{marginRight: '16px'}" label="是" name="是" value="1"></u-radio>
|
||||
<u-radio :customStyle="{marginRight: '16px'}" label="否" name="否" value="0"></u-radio>
|
||||
</u-radio-group>
|
||||
</u-form-item> -->
|
||||
|
||||
<u-form-item label="培训意愿工种" prop="qwpxgz" required>
|
||||
<view class="icon-right">✏️</view>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<view class="form-label">培训意愿工种 <text class="required">*</text></view>
|
||||
<picker
|
||||
mode="multiSelector"
|
||||
:range="workTypeColumns"
|
||||
@@ -56,39 +38,33 @@
|
||||
v-if="workTypeColumns[0] && workTypeColumns[0].length"
|
||||
>
|
||||
<view class="picker-view">
|
||||
<text>{{ formData.qwpxgzName || '请选择工种' }}</text>
|
||||
<view class="picker-view-text">{{ formData.qwpxgzName || '请选择工种' }}</view>
|
||||
<view class="icon-right">▼</view>
|
||||
</view>
|
||||
</picker>
|
||||
<view v-else class="picker-view">
|
||||
<text>工种数据加载中...</text>
|
||||
<view class="picker-view-text">工种数据加载中...</view>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item label="期望培训时间" prop="qwpxsj" required>
|
||||
<view class="bordered" style="width: 100%" @click="showTime = true"
|
||||
:class="{ noValue: !formData.qwpxsj }">
|
||||
{{ formData.qwpxsj || "请选择" }}</view>
|
||||
<view class="icon-right">▼</view>
|
||||
</u-form-item>
|
||||
</u--form>
|
||||
<u--form labelPosition="left" class="self-form" labelWidth="110">
|
||||
<u-form-item label="需求说明" prop="jobDescription">
|
||||
<u-textarea :disabled="!edit" v-model="formData.jobDescription" placeholder="请输入"></u-textarea>
|
||||
</u-form-item>
|
||||
</u--form>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<view class="form-label">期望培训时间 <text class="required">*</text></view>
|
||||
<picker mode="date" :value="formData.qwpxsj" start="1900-01-01" end="2100-12-31" @change="onDateChange">
|
||||
<view class="date-picker-wrapper" :class="{ noValue: !formData.qwpxsj }">
|
||||
<view v-if="formData.qwpxsj" class="date-value">{{ formData.qwpxsj }}</view>
|
||||
<view v-else>请选择</view>
|
||||
<view class="icon-right">✏️</view>
|
||||
</view>
|
||||
</picker>
|
||||
</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">
|
||||
<view class="part-title" style="margin-top: 32rpx;">附件信息</view>
|
||||
<view class="inner-part">
|
||||
<u--form labelPosition="left" class="self-form" labelWidth="110">
|
||||
<u-form-item label="附件" prop="fileUrl">
|
||||
<ImageUpload :fileList="fileList" @update="changeFile" :maxCount="6" />
|
||||
</u-form-item>
|
||||
</u--form>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
|
||||
<!-- 办理完成后 需求说明 -->
|
||||
<req-comp :form="{
|
||||
@@ -99,14 +75,6 @@
|
||||
}" />
|
||||
|
||||
</scroll-view>
|
||||
<u-datetime-picker :show="show.qwpxsj" v-model="dates.qwpxsj" mode="date"
|
||||
@confirm="confirmDate('qwpxsj', $event)" @cancel="cancelPicker('qwpxsj')"></u-datetime-picker>
|
||||
<u-picker :show="show.qwpxgz" :columns="[jobTypeList]" keyName="workTypeName"
|
||||
@confirm="jobTypeConfirm('qwpxgz', $event)" @cancel="cancelPicker('qwpxgz')"></u-picker>
|
||||
<choose-person ref="personChooser" @confirm="personNameConfirm" />
|
||||
<u-datetime-picker style="position: relative; z-index: 100" :show="showTime" v-model="hopeSolveDate"
|
||||
mode="datetime" closeOnClickOverlay @confirm="confirmDate" @cancel="showTime = false"
|
||||
@close="showTime = false"></u-datetime-picker>
|
||||
<view class="button-area" v-if="edit">
|
||||
<view class="btn" @click="cancelPage">取消</view>
|
||||
<view class="btn reset" @click="getDetail(formData.id)">重置</view>
|
||||
@@ -116,25 +84,15 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getPersonBase
|
||||
} from "@/packageRc/api/personinfo/index";
|
||||
import {
|
||||
addPersonDemand,
|
||||
updatePersonDemand,
|
||||
getPersonDemand
|
||||
} from "@/packageRc/api/needs/personDemand";
|
||||
import {
|
||||
listJobType
|
||||
} from "@/packageRc/api/jobType/index";
|
||||
import ImageUpload from './ImageUpload'
|
||||
import ChoosePerson from './choosePerson';
|
||||
// import dayjs from "dayjs";
|
||||
import { getPersonBase } from "@/packageRc/api/personinfo/index";
|
||||
import { addPersonDemand, updatePersonDemand, getPersonDemand } from "@/packageRc/api/needs/personDemand";
|
||||
import { listJobType } from "@/packageRc/api/jobType/index";
|
||||
|
||||
import uniDateformat from '@/uni_modules/uni-dateformat/components/uni-dateformat/uni-dateformat.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
// ChoosePerson,
|
||||
// ImageUpload
|
||||
// ChoosePerson
|
||||
},
|
||||
props: {
|
||||
needId: {
|
||||
@@ -148,24 +106,20 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fileList: [],
|
||||
edit: true,
|
||||
showTime: false,
|
||||
personBase: {},
|
||||
hopeSolveDate: Number(new Date()),
|
||||
dates: {},
|
||||
formData: {
|
||||
userId:"",
|
||||
personName:"",
|
||||
demandType: "3",
|
||||
personName: '',
|
||||
personId: "",
|
||||
userId: "",
|
||||
demandTitle: '',
|
||||
isAcceptAssistance: '',
|
||||
isAcceptApprovalResult: '',
|
||||
personName: '',
|
||||
qwpxsj: '',
|
||||
qwpxgz: '',
|
||||
qwpxgzName: ''
|
||||
qwpxgzName: '',
|
||||
jobDescription: ''
|
||||
},
|
||||
rules: {
|
||||
personName: [{
|
||||
@@ -211,11 +165,28 @@
|
||||
this.$refs.uForm.setRules(this.rules)
|
||||
},
|
||||
created() {
|
||||
this.loading = true;
|
||||
this.workTypeRemoteMethod('');
|
||||
},
|
||||
this.setName();
|
||||
this.loading = true;
|
||||
this.workTypeRemoteMethod('');
|
||||
},
|
||||
methods: {
|
||||
cancelPage() {
|
||||
setName() {
|
||||
// 直接设置人员信息
|
||||
this.formData.personName = this.name;
|
||||
this.formData.personId = this.needId;
|
||||
this.formData.userId = this.needId;
|
||||
|
||||
// 设置需求标题
|
||||
if (this.formData.personName) {
|
||||
const today = new Date();
|
||||
const year = today.getFullYear();
|
||||
const month = String(today.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(today.getDate()).padStart(2, '0');
|
||||
const formattedDate = `${year}-${month}-${day}`;
|
||||
this.formData.demandTitle = `${this.formData.personName}_于${formattedDate}_提出培训需求`;
|
||||
}
|
||||
},
|
||||
cancelPage() {
|
||||
if (this.formData.id) {
|
||||
this.edit = false;
|
||||
this.getDetail(this.formData.id)
|
||||
@@ -235,14 +206,9 @@
|
||||
this.formNameChange();
|
||||
this.$forceUpdate();
|
||||
},
|
||||
confirmDate(e) {
|
||||
this.showTime = false;
|
||||
// 获取选中的日期
|
||||
const date = e.value;
|
||||
// 使用 uView 的 uTime 方法格式化日期,包含时分秒
|
||||
const formattedDateTime = uni.$u.timeFormat(date, "yyyy-mm-dd");
|
||||
// 设置表单数据
|
||||
this.formData.qwpxsj = formattedDateTime;
|
||||
// 使用picker组件的日期选择
|
||||
onDateChange(e) {
|
||||
this.formData.qwpxsj = e.detail.value;
|
||||
},
|
||||
changeFile(e) {
|
||||
// 清空当前的 fileUrl 数组
|
||||
@@ -298,7 +264,7 @@
|
||||
this.setWorkTypeIndexes(this.formData.qwpxgz);
|
||||
}
|
||||
this.edit = false;
|
||||
this.fileList = this.$processFileUrl(this.formData.fileUrl)
|
||||
|
||||
}).catch(error => {
|
||||
console.error('Error fetching training detail:', error);
|
||||
});
|
||||
@@ -337,6 +303,7 @@
|
||||
this.$store.dispatch("GetInfo").then((res) => {
|
||||
if (res.data.roles.indexOf('qunzhong') == -1) {
|
||||
this.canChoosePerson = true;
|
||||
this.setName() // 确保非群众角色也能获取姓名
|
||||
} else {
|
||||
this.canChoosePerson = false;
|
||||
getPersonBase(res.data.user.userId).then(resp => {
|
||||
@@ -349,35 +316,46 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
formNameChange() {
|
||||
let date = new Date()
|
||||
const dayNew = dayjs(date).format("YYYY-MM-DD");
|
||||
this.formData.demandTitle = `${this.formData.personName}_于${dayNew}_提出培训需求`
|
||||
},
|
||||
setName() {
|
||||
this.formData.personName = this.name;
|
||||
this.formData.personId = this.needId;
|
||||
this.formData.userId = this.needId;
|
||||
let date = new Date();
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const dayNew = `${year}-${month}-${day}`;
|
||||
this.formData.demandTitle = `${this.formData.personName}_于${dayNew}_提出培训需求`;
|
||||
},
|
||||
async saveInfo() {
|
||||
try {
|
||||
this.setName();
|
||||
// 手动检查培训意愿工种是否已选择
|
||||
if (!this.formData.qwpxgz || this.formData.qwpxgz.trim() === '') {
|
||||
this.$u.toast('请选择培训意愿工种!');
|
||||
try {
|
||||
this.setName();
|
||||
console.log("执行保存,表单数据:", this.formData);
|
||||
console.log("personName:", this.formData.personName);
|
||||
console.log("personId:", this.formData.personId);
|
||||
console.log("userId:", this.formData.userId);
|
||||
// 手动检查培训意愿工种是否已选择
|
||||
if (!this.formData.qwpxgz || (typeof this.formData.qwpxgz === 'string' && this.formData.qwpxgz.trim() === '')) {
|
||||
uni.showToast({
|
||||
title: '请选择培训意愿工种!',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 手动检查期望培训时间是否已选择
|
||||
if (!this.formData.qwpxsj || this.formData.qwpxsj.trim() === '') {
|
||||
this.$u.toast('请选择期望培训时间!');
|
||||
if (!this.formData.qwpxsj || (typeof this.formData.qwpxsj === 'string' && this.formData.qwpxsj.trim() === '')) {
|
||||
uni.showToast({
|
||||
title: '请选择期望培训时间!',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 验证表单
|
||||
const isValid = await this.$refs.uForm.validate();
|
||||
if (!isValid) {
|
||||
throw new Error('请检查必填项填写');
|
||||
return
|
||||
}
|
||||
this.$showLoading();
|
||||
// 表单字段已通过手动检查,无需额外验证
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
});
|
||||
let response;
|
||||
let successMessage;
|
||||
this.formData.demandType = 3;
|
||||
@@ -390,24 +368,42 @@
|
||||
}
|
||||
// 检查响应码是否为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();
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1000);
|
||||
}
|
||||
} else {
|
||||
// 响应码不为200时,显示服务器返回的错误信息或默认错误信息
|
||||
uni.showToast({
|
||||
title: response.msg || '操作失败,请重试!',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
if(error.length){
|
||||
this.$u.toast('请填写完整信息!');
|
||||
}else{
|
||||
this.$u.toast('系统错误,请联系管理员!');
|
||||
console.error('保存失败:', error);
|
||||
// 检查错误是否为字符串类型或有特定消息
|
||||
if(typeof error === 'string' || (error && error.message && error.message.includes('请检查'))){
|
||||
uni.showToast({
|
||||
title: '请填写完整信息!',
|
||||
icon: 'none'
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '系统错误,请联系管理员!',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
// 确保加载页总是会被隐藏
|
||||
this.$hideLoading();
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
// getWorkTypeTree() {
|
||||
@@ -500,20 +496,20 @@
|
||||
const selectedLevel2 = this.workTypeColumns[1][indexes[1]];
|
||||
const selectedLevel3 = this.workTypeColumns[2][indexes[2]];
|
||||
|
||||
// 使用$set确保响应式更新
|
||||
if (selectedLevel3) {
|
||||
// 选择第三级
|
||||
this.$set(this.formData, 'qwpxgz', selectedLevel3.id);
|
||||
this.$set(this.formData, 'qwpxgzName', `${selectedLevel1.workTypeName}/${selectedLevel2.workTypeName}/${selectedLevel3.workTypeName}`);
|
||||
} else if (selectedLevel2) {
|
||||
// 选择第二级
|
||||
this.$set(this.formData, 'qwpxgz', selectedLevel2.id);
|
||||
this.$set(this.formData, 'qwpxgzName', `${selectedLevel1.workTypeName}/${selectedLevel2.workTypeName}`);
|
||||
} else if (selectedLevel1) {
|
||||
// 选择第一级
|
||||
this.$set(this.formData, 'qwpxgz', selectedLevel1.id);
|
||||
this.$set(this.formData, 'qwpxgzName', selectedLevel1.workTypeName);
|
||||
}
|
||||
// 直接赋值确保响应式更新
|
||||
if (selectedLevel3) {
|
||||
// 选择第三级
|
||||
this.formData.qwpxgz = selectedLevel3.id;
|
||||
this.formData.qwpxgzName = `${selectedLevel1.workTypeName}/${selectedLevel2.workTypeName}/${selectedLevel3.workTypeName}`;
|
||||
} else if (selectedLevel2) {
|
||||
// 选择第二级
|
||||
this.formData.qwpxgz = selectedLevel2.id;
|
||||
this.formData.qwpxgzName = `${selectedLevel1.workTypeName}/${selectedLevel2.workTypeName}`;
|
||||
} else if (selectedLevel1) {
|
||||
// 选择第一级
|
||||
this.formData.qwpxgz = selectedLevel1.id;
|
||||
this.formData.qwpxgzName = selectedLevel1.workTypeName;
|
||||
}
|
||||
|
||||
this.workTypeIndexes = indexes;
|
||||
|
||||
@@ -563,29 +559,46 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.date-picker-wrapper {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.date-picker-wrapper.noValue {
|
||||
color: #999;
|
||||
}
|
||||
.date-value {
|
||||
color: #333;
|
||||
}
|
||||
.page ::v-deep .u-navbar__content {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.container {
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
|
||||
.page {
|
||||
background-color: #EEF1F5 !important;
|
||||
background-color: #3161c7;
|
||||
height: 100vh;
|
||||
background-image: url('https://rc.jinan.gov.cn/qcwjyH5/static/images/top.png');
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% auto;
|
||||
}
|
||||
.input-outer-part {
|
||||
padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.inner {
|
||||
background: #eef1f5;
|
||||
border-radius: 16rpx;
|
||||
padding: 32rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
}
|
||||
|
||||
.inner-part {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -595,10 +608,129 @@
|
||||
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;
|
||||
}
|
||||
.picker-cover {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.button-area {
|
||||
padding: 24rpx 32rpx 68rpx;
|
||||
width: calc(100% + 64rpx);
|
||||
@@ -640,7 +772,7 @@
|
||||
background: rgb(245, 247, 250);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
|
||||
.bordered {
|
||||
border: 1rpx solid #dadbde;
|
||||
padding: 9px;
|
||||
@@ -652,28 +784,12 @@
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
padding: 28rpx 36rpx;
|
||||
background: #ffffff;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
border-radius: 12rpx;
|
||||
min-height: 88rpx;
|
||||
box-sizing: border-box;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.picker-view:active {
|
||||
background: #f8f9fa;
|
||||
border-color: #007aff;
|
||||
}
|
||||
|
||||
.picker-view text {
|
||||
.picker-view-text {
|
||||
color: #333333;
|
||||
font-size: 28rpx;
|
||||
flex: 1;
|
||||
text-align: left; font-size: 28rpx;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.picker-view .u-icon {
|
||||
margin-left: 16rpx;
|
||||
color: #999999;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user