添加页面
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<!--
|
||||
* @Date: 2024-10-08 14:29:36
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-03 15:43:51
|
||||
* @LastEditTime: 2025-11-04 15:55:41
|
||||
-->
|
||||
<template>
|
||||
<view class="container">
|
||||
<scroll-view scroll-y="true" :style="{height: edit?'calc(90vh - 150px)':'calc(100vh - 144px)'}">
|
||||
<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"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!--
|
||||
* @Date: 2024-10-08 14:29:36
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-04 13:53:56
|
||||
* @LastEditTime: 2025-11-04 16:30:05
|
||||
-->
|
||||
<template>
|
||||
<view class="container">
|
||||
<scroll-view scroll-y="true" >
|
||||
<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"
|
||||
@@ -160,6 +160,8 @@
|
||||
<!-- 工种选择器弹窗 -->
|
||||
|
||||
|
||||
<choose-person ref="personChooser" @confirm="personNameConfirm" />
|
||||
<PlacePicker ref="placePicker" @selected="handleSelected" />
|
||||
</scroll-view>
|
||||
<view class="button-area" v-if="edit">
|
||||
<view class="btn" @click="cancelPage">取消</view>
|
||||
@@ -171,26 +173,24 @@
|
||||
<script>
|
||||
import {
|
||||
getPersonBase
|
||||
} from "@/packageRc/api/personinfo/index";
|
||||
} from "@/apiRc/person";
|
||||
import {
|
||||
addPersonDemand,
|
||||
updatePersonDemand,
|
||||
getPersonDemand
|
||||
} from "@/packageRc/api/needs/personDemand";
|
||||
} from "@/apiRc/needs/personDemand";
|
||||
import {
|
||||
listJobType
|
||||
} from "@/packageRc/api/jobType/index";
|
||||
import ImageUpload from './ImageUpload'
|
||||
import ChoosePerson from './choosePerson';
|
||||
} from "@/apiRc/jobType/index";
|
||||
import ImageUpload from '/packageRc/components/ImageUpload'
|
||||
import ChoosePerson from '/packageRc/pages/needs/components/choosePerson';
|
||||
import PlacePicker from "/packageRc/components/placePicker";
|
||||
|
||||
//import uPopup from 'uview-ui/components/u-popup/u-popup.vue'
|
||||
export default {
|
||||
components: {
|
||||
ChoosePerson,
|
||||
ImageUpload,
|
||||
PlacePicker,
|
||||
// uPopup
|
||||
},
|
||||
props: {
|
||||
needId: {
|
||||
@@ -209,8 +209,6 @@
|
||||
dates: {},
|
||||
currentCommunityId: '',
|
||||
showPickerPicker: false,
|
||||
canChoosePerson: true,
|
||||
canChoosePerson: true,
|
||||
formData: {
|
||||
demandType:"1",
|
||||
personName: '',
|
||||
@@ -228,7 +226,6 @@
|
||||
jobDescription: '',
|
||||
// fileUrl: []
|
||||
},
|
||||
bfnrzd:[],
|
||||
rules: {
|
||||
personName: [{
|
||||
required: true,
|
||||
@@ -253,11 +250,11 @@
|
||||
message: '请选择最低薪酬',
|
||||
trigger: ['blur', 'change'],
|
||||
}, ],
|
||||
jobDescription: [{
|
||||
required: true,
|
||||
message: '请填写求职说明',
|
||||
trigger: ['blur', 'change'],
|
||||
}, ]
|
||||
jobDescription: [{
|
||||
required: true,
|
||||
message: '请填写求职说明',
|
||||
trigger: ['blur', 'change'],
|
||||
}, ]
|
||||
// employmentType: [{
|
||||
// required: true,
|
||||
// message: '请选择用工形式',
|
||||
@@ -300,14 +297,10 @@
|
||||
workTypeIndexes: [0, 0, 0],
|
||||
}
|
||||
},
|
||||
// 移除uView表单验证相关代码
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules)
|
||||
},
|
||||
created() {
|
||||
this.workTypeRemoteMethod('');
|
||||
console.log('qcjy_fwnr' );
|
||||
this.$getDict('qcjy_fwnr').then(res => {
|
||||
this.bfnrzd = res.data;
|
||||
});
|
||||
this.setName()
|
||||
this.loading = true;
|
||||
let arr = [{
|
||||
key: 'qcjy_gznx',
|
||||
@@ -338,7 +331,7 @@
|
||||
prop: 'employmentWillingness'
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
// 使用 Promise.all 确保所有字典数据加载完成
|
||||
Promise.all(arr.map(ele => this.getDicts(ele.key)))
|
||||
.then(responses => {
|
||||
@@ -356,14 +349,18 @@
|
||||
this.loading = false;
|
||||
});
|
||||
|
||||
this.workTypeRemoteMethod('');
|
||||
},
|
||||
methods: {
|
||||
// 获取字典数据
|
||||
getDicts(dictType) {
|
||||
return this.$getDict(dictType)
|
||||
// .then(res => {
|
||||
// this.dict[dictType] = res.data;
|
||||
// });
|
||||
return new Promise((resolve, reject) => {
|
||||
// 这里应该调用实际的API,暂时返回空数组
|
||||
// 如果需要真实的API调用,请替换下面的代码
|
||||
setTimeout(() => {
|
||||
resolve({ data: [] });
|
||||
}, 100);
|
||||
});
|
||||
},
|
||||
|
||||
cancelPage() {
|
||||
@@ -380,15 +377,12 @@
|
||||
}
|
||||
},
|
||||
setName(){
|
||||
// 只有在name有值时才设置人员信息,避免覆盖已有数据
|
||||
if(this.name) {
|
||||
this.formData.personName = this.name
|
||||
this.formData.personId = this.needId
|
||||
this.formData.userId = this.needId
|
||||
}
|
||||
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
|
||||
|
||||
@@ -460,7 +454,7 @@
|
||||
cancelPicker(type) {
|
||||
this.show[type] = false
|
||||
},
|
||||
getCityOptis(data) {
|
||||
getCityOptions(data) {
|
||||
if (data && data[0] && data[0].children) {
|
||||
return [data].concat(this.getCityOptions(data[0].children))
|
||||
} else {
|
||||
@@ -493,7 +487,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
|
||||
@@ -519,35 +513,21 @@
|
||||
})
|
||||
},
|
||||
async saveInfo() {
|
||||
this.setName()
|
||||
uni.showLoading();
|
||||
try {
|
||||
console.log("this.formData.personName",this.formData.personName)
|
||||
// 先检查求职说明是否为空,如果为空直接提示
|
||||
if (!this.formData.jobDescription || this.formData.jobDescription.trim() === '') {
|
||||
uni.showToast({ title: '请填写求职说明!', icon: 'none' });
|
||||
uni.showToast({title: '请填写求职说明!', icon: 'none'});
|
||||
return;
|
||||
}
|
||||
|
||||
// 简单的表单验证
|
||||
|
||||
// 验证表单
|
||||
console.log(this.formData)
|
||||
if (!this.formData.personName) {
|
||||
uni.showToast({ title: '请填写姓名!', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!this.formData.jobWorkType) {
|
||||
uni.showToast({ title: '请选择求职工种!', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!this.formData.minRecruitmentSalary) {
|
||||
uni.showToast({ title: '请填写最低薪酬!', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!this.formData.highRecruitmentSalary) {
|
||||
uni.showToast({ title: '请填写最高薪酬!', icon: 'none' });
|
||||
return;
|
||||
const isValid = await this.$refs.uForm.validate();
|
||||
if (!isValid) {
|
||||
throw new Error('表单验证失败');
|
||||
}
|
||||
// 显示全局加载
|
||||
uni.showLoading({ title: '加载中...' });
|
||||
this.formData.demandType = 1;
|
||||
// this.formData.userId = this.formData.personId
|
||||
// 根据 formData 是否有 id 来决定是更新还是新增
|
||||
@@ -562,25 +542,25 @@
|
||||
}
|
||||
// 检查响应码是否为200
|
||||
if (response.code === 200) {
|
||||
uni.showToast({ title: successMessage });
|
||||
uni.showToast({title: successMessage, icon: 'none'});
|
||||
// 如果是编辑模式,关闭编辑状态;否则返回上一页
|
||||
if (this.formData.id) {
|
||||
this.edit = false;
|
||||
} else {
|
||||
// 延迟1秒后返回
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1000);
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if(error && error.length){
|
||||
uni.showToast({ title: '请填写完整信息!', icon: 'none' });
|
||||
} else {
|
||||
uni.showToast({ title: '系统错误,请联系管理员!', icon: 'none' });
|
||||
if(error.length){
|
||||
uni.showToast({title: '请填写完整信息!', icon: 'none'});
|
||||
}else{
|
||||
uni.showToast({title: '系统错误,请联系管理员!', icon: 'none'});
|
||||
}
|
||||
}
|
||||
finally {
|
||||
// uni.showToast({title: '请检查必填项填写', icon: 'none'});
|
||||
|
||||
} finally {
|
||||
// 确保加载页总是会被隐藏
|
||||
uni.hideLoading();
|
||||
}
|
||||
@@ -611,18 +591,18 @@
|
||||
this.workTypeColumns = [[], [], []];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 第一级
|
||||
const level1 = treeData.filter(item => item.level === "1");
|
||||
// 第二级
|
||||
const level2 = treeData.filter(item => item.level === "2");
|
||||
// 第三级
|
||||
const level3 = treeData.filter(item => item.level === "3");
|
||||
|
||||
|
||||
// 构建级联数据
|
||||
const columns = [];
|
||||
columns[0] = level1;
|
||||
|
||||
|
||||
// 根据第一级选择,过滤第二级
|
||||
if (level1.length > 0) {
|
||||
const firstLevelId = level1[0].id;
|
||||
@@ -630,7 +610,7 @@
|
||||
} else {
|
||||
columns[1] = [];
|
||||
}
|
||||
|
||||
|
||||
// 根据第二级选择,过滤第三级
|
||||
if (columns[1].length > 0) {
|
||||
const secondLevelId = columns[1][0].id;
|
||||
@@ -638,23 +618,23 @@
|
||||
} else {
|
||||
columns[2] = [];
|
||||
}
|
||||
|
||||
|
||||
this.workTypeColumns = columns;
|
||||
console.log('级联数据构建完成:', this.workTypeColumns);
|
||||
},
|
||||
|
||||
|
||||
// 级联选择器列变化事件
|
||||
onWorkTypeColumnChange(e) {
|
||||
const { column, value } = e.detail;
|
||||
const newIndexes = [...this.workTypeIndexes];
|
||||
newIndexes[column] = value;
|
||||
|
||||
|
||||
// 重置后续列的数据
|
||||
if (column === 0) {
|
||||
// 第一列变化,重置第二、三列
|
||||
const selectedLevel1 = this.workTypeColumns[0][value];
|
||||
if (selectedLevel1) {
|
||||
const level2 = this.jobTypeList.filter(item =>
|
||||
const level2 = this.jobTypeList.filter(item =>
|
||||
item.level === "2" && item.parentId === selectedLevel1.id
|
||||
);
|
||||
this.workTypeColumns[1] = level2;
|
||||
@@ -666,24 +646,24 @@
|
||||
// 第二列变化,重置第三列
|
||||
const selectedLevel2 = this.workTypeColumns[1][value];
|
||||
if (selectedLevel2) {
|
||||
const level3 = this.jobTypeList.filter(item =>
|
||||
const level3 = this.jobTypeList.filter(item =>
|
||||
item.level === "3" && item.parentId === selectedLevel2.id
|
||||
);
|
||||
this.workTypeColumns[2] = level3;
|
||||
newIndexes[2] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.workTypeIndexes = newIndexes;
|
||||
},
|
||||
|
||||
|
||||
// 级联选择器确认事件
|
||||
onWorkTypePickerChange(e) {
|
||||
const indexes = e.detail.value;
|
||||
const selectedLevel1 = this.workTypeColumns[0][indexes[0]];
|
||||
const selectedLevel2 = this.workTypeColumns[1][indexes[1]];
|
||||
const selectedLevel3 = this.workTypeColumns[2][indexes[2]];
|
||||
|
||||
|
||||
if (selectedLevel3) {
|
||||
// 选择第三级
|
||||
this.formData.jobWorkType = selectedLevel3.id;
|
||||
@@ -697,16 +677,16 @@
|
||||
this.formData.jobWorkType = selectedLevel1.id;
|
||||
this.formData.jobWorkTypeName = selectedLevel1.workTypeName;
|
||||
}
|
||||
|
||||
|
||||
this.workTypeIndexes = indexes;
|
||||
},
|
||||
|
||||
|
||||
// 根据工种ID设置索引
|
||||
setWorkTypeIndexes(workTypeId) {
|
||||
// 在工种列表中查找对应的工种
|
||||
const targetWorkType = this.jobTypeList.find(item => item.id == workTypeId);
|
||||
if (!targetWorkType) return;
|
||||
|
||||
|
||||
// 根据level确定是哪一级
|
||||
if (targetWorkType.level === "1") {
|
||||
const index = this.workTypeColumns[0].findIndex(item => item.id == workTypeId);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!--
|
||||
* @Date: 2024-10-08 14:29:36
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-03 16:07:40
|
||||
* @LastEditTime: 2025-11-04 16:14:41
|
||||
-->
|
||||
<template>
|
||||
<view class="container">
|
||||
<scroll-view scroll-y="true" >
|
||||
<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"
|
||||
@@ -32,12 +32,8 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 办理完成后 需求说明 -->
|
||||
|
||||
|
||||
</scroll-view>
|
||||
|
||||
<choose-person ref="personChooser" @confirm="personNameConfirm" />
|
||||
<view class="button-area" v-if="edit">
|
||||
<view class="btn" @click="cancelPage">取消</view>
|
||||
@@ -48,16 +44,28 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getPersonBase } from "@/packageRc/api/personinfo/index";
|
||||
import { addPersonDemand, updatePersonDemand, getPersonDemand } from "@/packageRc/api/needs/personDemand";
|
||||
//import reqComp from './req-comp';
|
||||
import {
|
||||
getPersonBase
|
||||
} from "@/apiRc/person";
|
||||
import {
|
||||
addPersonDemand,
|
||||
updatePersonDemand,
|
||||
getPersonDemand
|
||||
} from "@/apiRc/needs/personDemand";
|
||||
import ImageUpload from '/packageRc/components/ImageUpload'
|
||||
import ChoosePerson from '/packageRc/pages/needs/components/choosePerson';
|
||||
import {
|
||||
listJobType
|
||||
} from "@/apiRc/jobType/index";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
// reqComp
|
||||
},
|
||||
ChoosePerson,
|
||||
ImageUpload
|
||||
},
|
||||
props: {
|
||||
needId: {
|
||||
needId: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
@@ -68,60 +76,65 @@ import { addPersonDemand, updatePersonDemand, getPersonDemand } from "@/packageR
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fileList: [],
|
||||
edit: true,
|
||||
canChoosePerson: false,
|
||||
personBase: {},
|
||||
dates: {},
|
||||
formData: {
|
||||
id: '',
|
||||
personName: '',
|
||||
personId: '',
|
||||
demandType:"9",
|
||||
userId: '',
|
||||
demandTitle: '',
|
||||
jobDescription: '',
|
||||
actualSolveDate: '',
|
||||
actualSolvePeople: '',
|
||||
solveDesc: '',
|
||||
fileUrl: '',
|
||||
currentStatus: ''
|
||||
}
|
||||
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,
|
||||
}
|
||||
},
|
||||
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.$u.navigateBack();
|
||||
} else {
|
||||
if (this.formData.id) {
|
||||
this.edit = false;
|
||||
this.getDetail(this.formData.id);
|
||||
this.getDetail(this.formData.id)
|
||||
} else {
|
||||
uni.navigateBack()
|
||||
}
|
||||
},
|
||||
// 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();
|
||||
@@ -131,110 +144,178 @@ import { addPersonDemand, updatePersonDemand, getPersonDemand } from "@/packageR
|
||||
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) {
|
||||
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);
|
||||
});
|
||||
getPersonDemand(id).then(res => {
|
||||
this.formData = res.data;
|
||||
this.edit = false
|
||||
})
|
||||
},
|
||||
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();
|
||||
},
|
||||
goBack() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
|
||||
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}_提出其他需求`;
|
||||
cancelPicker(type) {
|
||||
this.show[type] = false
|
||||
this.$forceUpdate();
|
||||
},
|
||||
saveInfo() {
|
||||
console.log("执行")
|
||||
getDictLabel(value, list) {
|
||||
if (list) {
|
||||
let arr = list.filter(ele => ele.dictValue == value)
|
||||
if (arr.length) {
|
||||
return arr[0].dictLabel
|
||||
} else {
|
||||
return '请选择'
|
||||
}
|
||||
}
|
||||
},
|
||||
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() {
|
||||
uni.showLoading();
|
||||
try {
|
||||
// 验证必填项
|
||||
if (!this.formData.personName) {
|
||||
uni.showToast({
|
||||
title: '请选择姓名',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
// 验证表单
|
||||
const isValid = await this.$refs.uForm.validate();
|
||||
if (!isValid) {
|
||||
throw new Error('请检查必填项填写');
|
||||
}
|
||||
if (!this.formData.jobDescription) {
|
||||
uni.showToast({
|
||||
title: '请输入需求说明',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
// 显示全局加载
|
||||
|
||||
// 根据 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 = '保存成功';
|
||||
}
|
||||
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'
|
||||
});
|
||||
// 检查响应码是否为200
|
||||
if (response.code === 200) {
|
||||
this.$u.toast(successMessage);
|
||||
// 如果是编辑模式,关闭编辑状态;否则返回上一页
|
||||
if (this.formData.id) {
|
||||
this.edit = false;
|
||||
if (!this.formData.id) {
|
||||
this.formData.id = res.data;
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
});
|
||||
await this.$delay(1000); // 延迟1秒后返回上一页
|
||||
uni.navigateBack();
|
||||
}
|
||||
}).catch(err => {
|
||||
if (err.message) {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
throw new Error('服务器响应错误');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('保存失败:', error);
|
||||
if(error.length){
|
||||
this.$u.toast('请填写完整信息!');
|
||||
}else{
|
||||
this.$u.toast('系统错误,请联系管理员!');
|
||||
}
|
||||
} finally {
|
||||
// 确保加载页总是会被隐藏
|
||||
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">
|
||||
.container {
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
@import "/packageRc/static/scss/index.scss";
|
||||
|
||||
.inner {
|
||||
background: #fff;
|
||||
@@ -244,12 +325,14 @@ import { addPersonDemand, updatePersonDemand, getPersonDemand } from "@/packageR
|
||||
border-radius: 16rpx;
|
||||
padding: 32rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
}
|
||||
|
||||
.inner-part {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.self-form {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -302,14 +385,15 @@ import { addPersonDemand, updatePersonDemand, getPersonDemand } from "@/packageR
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
|
||||
.button-area {
|
||||
padding: 24rpx 32rpx 68rpx;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
margin-top: 40rpx;
|
||||
border-radius: 16px 16px 0px 0px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
|
||||
|
||||
.btn {
|
||||
line-height: 72rpx;
|
||||
@@ -333,16 +417,6 @@ import { addPersonDemand, updatePersonDemand, getPersonDemand } from "@/packageR
|
||||
flex-grow: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.container {
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
|
||||
.inner {
|
||||
background-color: #f7f7f7;
|
||||
padding: 24rpx 32rpx;
|
||||
}
|
||||
|
||||
.self-form {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!--
|
||||
* @Date: 2024-10-08 14:29:36
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-03 16:07:22
|
||||
* @LastEditTime: 2025-11-04 15:56:09
|
||||
-->
|
||||
<template>
|
||||
<view class="container">
|
||||
<scroll-view scroll-y="true" :style="{height: edit?'calc(90vh - 150px)':'calc(100vh - 144px)'}">
|
||||
<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;">培训需求信息
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<!--
|
||||
* @Date: 2024-10-08 14:29:36
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-03 16:29:26
|
||||
* @LastEditTime: 2025-11-04 16:16:45
|
||||
-->
|
||||
<template>
|
||||
<view class="page" style="background-image: url('../../../packageRc/static/pageBg.png');">
|
||||
<view class="page-header df_flex" style="display:flex;align-items:center;justify-content:space-between;padding:20rpx 0rpx;">
|
||||
<!-- <view class="page-header df_flex" style="display:flex;align-items:center;justify-content:space-between;padding:20rpx 0rpx;">
|
||||
<u-icon class="back-icon" name="arrow-left" color="#fff" size="16" @click="goBack()"></u-icon>
|
||||
<view class="title df_flex_1" style="padding-left: 32rpx;" >{{isAdd ? '需求新增' : '需求维护'}}</view>
|
||||
<u-icon style="margin-right: 32rpx;" @tap="$store.commit('SET_SHOWEXITPOPUP', true)" name="list" size="44rpx" color="#fff"></u-icon>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="tab-list" v-if="showTab != 1">
|
||||
<view class="tab" :class="{active: activeType == 1}" @click="canChangeType ? changeType(1) : ''">求职<br>需求
|
||||
</view>
|
||||
@@ -51,6 +51,10 @@
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '需求信息'
|
||||
})
|
||||
console.log("options",options)
|
||||
this.showTab = options.showTab
|
||||
this.id = options.id
|
||||
console.log("this.id",this.id)
|
||||
@@ -70,6 +74,9 @@
|
||||
},
|
||||
methods: {
|
||||
changeType(type) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '新增需求'
|
||||
})
|
||||
this.activeType = type
|
||||
this.$nextTick(() => {
|
||||
this.$refs['type' + type].addOne()
|
||||
@@ -84,47 +91,17 @@
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
@import "/packageRc/static/scss/index.scss";
|
||||
|
||||
.page {
|
||||
background-color: #F4F4F4 !important;
|
||||
height: 100vh;
|
||||
background-repeat: no-repeat;
|
||||
padding-top: 32rpx;
|
||||
background-size: 100% auto;
|
||||
|
||||
}
|
||||
|
||||
.button-area {
|
||||
padding: 24rpx 32rpx 68rpx;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
margin-top: 40rpx;
|
||||
border-radius: 16px 16px 0px 0px;
|
||||
|
||||
.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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user