This commit is contained in:
2025-11-04 15:16:22 +08:00
parent 262f398772
commit 8f5d92c80d
36 changed files with 8846 additions and 167 deletions

View File

@@ -0,0 +1,134 @@
<template>
<uni-popup ref="showPersonChooser" type="bottom" round background-color="#fff">
<view style="width: 100%;position: relative;z-index: 100;box-sizing: border-box;background: #fff;padding-top: 10px;">
<input class="search" @change="searchChange" placeholder="搜索选择人员" v-model="searchPerson"/>
<scroll-view style="height: 500rpx;padding: 0 32rpx;box-sizing: border-box;" :scroll-y="true">
<view v-for="(item, index) in personList" :key="index" @click="bindPerson(item)"
class="person-list" :class="{active: activePerson.id == item.id}">
<template v-if="choiceType==3">
<view>{{ item.personName }}</view>
<view style="color: #8492a6;margin-top: 7rpx;">期望工种{{item.jobWorkTypeName}}</view>
</template>
<template v-else-if="choiceType==4">
<view>{{ item.personName }}</view>
<view style="color: #8492a6;margin-top: 7rpx;">意愿培训工种{{item.trainingIntentionWorkTypeName}}</view>
</template>
<template v-else>
<view style="display: flex;justify-content: space-between;font-size: 32rpx;font-weight: bold;">{{ item.name }}
<view style="color: #8492a6; font-size: 13px;width: 50%;text-align: right;">{{ item.phone }}</view>
</view>
<view style="color: #8492a6;margin-top: 7rpx;">现居住地{{item.currentResidentialAddress}}</view>
</template>
</view>
</scroll-view>
<view class="button-area" style="position: relative;">
<view class="btn" @click="closeshowPersonChooser">取消</view>
<view class="btn reset" @click="resetData">重置</view>
<view class="btn save" @click="saveInfo">确定</view>
</view>
</view>
</uni-popup>
</template>
<script>
import {getPersonList} from '@/apiRc/needs/person'
import { listJobService } from "@/apiRc/needs/jobService";
import { listTrainService } from "@/apiRc/needs/trainService";
export default {
props: {
choiceType: {
default: 1
}
},
mounted() {
this.doSearch()
},
data() {
return {
showPersonChooser: false,
activePerson: {},
searchPerson: '',
personList: [],
searcher: '',
}
},
methods: {
open() {
this.$refs.showPersonChooser.open();
this.activePerson = {}
},
closeshowPersonChooser() {
this.$refs.showPersonChooser.close()
},
saveInfo() {
this.$emit('confirm', this.activePerson)
this.$refs.showPersonChooser.close()
},
searchChange(){
console.log('搜索内容:' + this.searchPerson);
if(this.searcher){
clearTimeout(this.searcher)
this.doSearch()
}else{
this.doSearch()
}
},
doSearch() {
this.searcher = setTimeout(() => {
uni.showLoading('加载中...');
// alert("选择的choiceType" + this.choiceType );
if(this.choiceType == 3) {
listJobService({personName: this.searchPerson, pageSize: 100, pageNum: 1}).then(res => {
uni.hideLoading();
this.personList = res.rows
clearTimeout(this.searcher)
})
}else if(this.choiceType == 4) {
listTrainService({personName: this.searchPerson, pageSize: 100, pageNum: 1}).then(res => {
uni.hideLoading();
this.personList = res.rows
clearTimeout(this.searcher)
})
}else{
getPersonList({name: this.searchPerson, pageSize: 100, pageNum: 1}).then(res => {
uni.hideLoading();
this.personList = res.rows
clearTimeout(this.searcher)
})
}
}, 200)
},
resetData(){
this.searchPerson = '';
this.personList = [];
this.activePerson = {}
},
bindPerson(item) {
this.activePerson = item;
this.$forceUpdate();
},
}
}
</script>
<style lang="scss" scoped>
.person-list{
padding: 24rpx 32rpx;
border-radius: 8rpx;
box-sizing: border-box;
border: 1px solid #e4e4e4;
margin-top: 32rpx;
&.active{
border: 1px solid #1890ff;
}
}
.search{
margin: 0 32rpx;
border: 1px solid #e4e4e4;
border-radius: 50rpx;
height: 64rpx;
padding: 0 20rpx;
}
</style>

View File

@@ -0,0 +1,752 @@
<!--
* @Date: 2024-10-08 14:29:36
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-04 09:06:28
-->
<template>
<view class="input-outer-part">
<scroll-view scroll-y="true" :style="{height: edit?'calc(100vh - 150px)':'calc(100vh - 144px)'}">
<view class="inner">
<view class="part-title" style="display: flex;justify-blqksm: space-between;">服务信息
<view v-if="!edit&&formData.id" class="btn" style="font-weight: normal;display: flex;"
@click="edit=true">编辑<u-icon name="edit-pen" color="#A6A6A6"></u-icon></view>
</view>
<view class="inner-part">
<u--form labelPosition="left" :model="formData" :rules="rules" ref="uForm" class="self-form"
labelWidth="110">
<u-form-item label="类型" v-if="!userId" required>
<view class="status_radio df_flex df_flex_1">
<u-radio-group v-model="formData.type" placement="column">
<u-radio v-for="(item, index) in validType" :key="index" :label="item.label"
:name="item.value">
</u-radio>
</u-radio-group>
</view>
</u-form-item>
<u-form-item label="被服务对象" prop="serviceObjectName" required v-if="formData.type == 0">
<view class="picker-view" :class="{selected: formData.serviceObjectName}" @click="openPersonChooser">
<text :class="formData.serviceObjectName ? 'picker-text' : 'picker-placeholder'">
{{ formData.serviceObjectName || '请选择被服务对象' }}
</text>
</view>
</u-form-item>
<u-form-item label="被服务对象" prop="serviceObjectName" required v-else>
<view class="picker-view" :class="{selected: formData.serviceObjectName}" @click="$refs.enterpriseChooser.open()">
<text :class="formData.serviceObjectName ? 'picker-text' : 'picker-placeholder'">
{{ formData.serviceObjectName || '请选择被服务对象' }}
</text>
</view>
</u-form-item>
<u-form-item label="服务时间" prop="practicalSolutionTime" required>
<view class="picker-view" :class="{selected: formData.practicalSolutionTime}" @click="showPicker('practicalSolutionTime')">
<text :class="formData.practicalSolutionTime ? 'picker-text' : 'picker-placeholder'">
{{ formData.practicalSolutionTime || '请选择服务时间' }}
</text>
</view>
</u-form-item>
<u-form-item label="经办人" prop="agentUserName" required>
<u--input :disabled="!edit" v-model="formData.agentUserName" border="none"
placeholder="请输入"></u--input>
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="服务类型" prop="demandType" required>
<view class="picker-view" :class="{selected: formData.demandType}" @click="showPicker('demandType')">
<text :class="formData.demandType ? 'picker-text' : 'picker-placeholder'">
{{ getDictLabel(formData.demandType, dict.demandType) || '请选择服务类型' }}
</text>
</view>
</u-form-item>
<u-form-item label="服务内容" prop="serviceContent" required>
<view class="picker-view" :class="{selected: formData.serviceContent}" @tap="showServiceContentSelect">
<text :class="formData.serviceContent ? 'picker-text' : 'picker-placeholder'">
{{ getMultiDictLabel(formData.serviceContent, dict.serviceContent) || '请选择服务内容' }}
</text>
</view>
</u-form-item>
<u-form-item label="电话沟通结果" prop="dhgtjg" v-if="formData.demandType == '5'" required>
<view class="picker-view" :class="{selected: formData.dhgtjg}" @click="showPicker('dhgtjg')">
<text :class="formData.dhgtjg ? 'picker-text' : 'picker-placeholder'">
{{ getDictLabel(formData.dhgtjg, dict.dhgtjg) || '请选择电话沟通结果' }}
</text>
</view>
</u-form-item>
<!-- 新增人员状态展示方式与服务类型一致 -->
<u-form-item label="人员状态" prop="personStatus" required >
<view class="picker-view" :class="{selected: formData.personStatus}" @click="showPicker('personStatus')">
<text :class="formData.personStatus ? 'picker-text' : 'picker-placeholder'">
{{ getDictLabel(formData.personStatus, dict.personStatus) || '请选择人员状态' }}
</text>
</view>
</u-form-item>
<u-form-item label="服务情况说明" prop="blqksm" required>
<u-textarea :disabled="!edit" v-model="formData.blqksm" placeholder="请输入"></u-textarea>
</u-form-item>
</u--form>
</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="{
actualSolveDate: formData.actualSolveDate,
actualSolvePeople: formData.actualSolvePeople,
solveDesc: formData.solveDesc,
fileUrl: formData.fileUrl
}" />
</scroll-view>
<u-datetime-picker :show="show.practicalSolutionTime" v-model="hopeSolveDate" mode="date" @confirm="confirmDate('practicalSolutionTime', $event)"
@cancel="cancelPicker('practicalSolutionTime')" @close="cancelPicker('practicalSolutionTime')" closeOnClickOverlay></u-datetime-picker>
<choose-person ref="personChooser" @confirm="personNameConfirm" />
<enterprise-list-pop ref="enterpriseChooser" @confirm="enterpriseConfirm" />
<u-picker :show="show.dhgtjg" :columns="[dict.dhgtjg]" keyName="dictLabel"
@confirm="pickerConfirm('dhgtjg', $event)" @cancel="cancelPicker('dhgtjg')"></u-picker>
<u-picker :show="show.demandType" :columns="[dict.demandType]" keyName="dictLabel"
@confirm="pickerConfirm('demandType', $event)" @cancel="cancelPicker('demandType')"></u-picker>
<u-picker :show="show.personStatus" :columns="[dict.personStatus]" keyName="dictLabel"
@confirm="pickerConfirm('personStatus', $event)" @cancel="cancelPicker('personStatus')"></u-picker>
<u-popup :show="show.serviceContent" mode="bottom" @close="cancelSelect">
<view class="select-content">
<view class="select-header">
<text @tap="cancelSelect">取消</text>
<text class="title">服务内容</text>
<text @tap="confirmSelect">确定</text>
</view>
<scroll-view scroll-y class="checkbox-scroll">
<view class="checkbox-group">
<u-checkbox-group v-model="tempServiceContent" placement="column">
<view
v-for="(item, index) in dict.serviceContent"
:key="index"
class="checkbox-item"
>
<u-checkbox
:name="item.dictValue"
:label="item.dictLabel"
></u-checkbox>
</view>
</u-checkbox-group>
</view>
</scroll-view>
</view>
</u-popup>
<view class="button-area" v-if="edit">
<view class="btn" @click="cancelPage">取消</view>
<view class="btn reset" @click="formData = {}" v-if="!formData.id">重置</view>
<view class="btn save" @click="saveInfo">保存</view>
</view>
</view>
</template>
<script>
import {
addInvestigate,
updateInvestigate,
getInvestigate
} from "@/apiRc/service/investigate";
import ImageUpload from '@/packageRc/components/ImageUpload'
import ChoosePerson from './choosePerson.vue';
export default {
components: {
ChoosePerson,
ImageUpload,
},
props: {
userId: {
type: String,
default: ''
},
name:{
type: String,
default: ''
}
},
data() {
return {
edit: true,
personBase: {},
dates: {},
hopeSolveDate: Number(new Date()),
formData: {
type: 0,
serviceContent: [],
personStatus: '' // 新增字段
},
rules: {
serviceObjectName: [{
required: true,
message: '请选择被服务人员',
trigger: ['blur', 'change'],
}, ],
unitName: [{
required: true,
message: '请选择被服务对象',
trigger: ['blur', 'change'],
}],
practicalSolutionTime: [{
required: true,
message: '请选择服务时间',
trigger: ['blur', 'change'],
}, ],
agentUserName: [{
required: true,
message: '请填写服务人员',
trigger: ['blur', 'change'],
}, ],
demandType: [{
required: true,
message: '请填写服务类型',
trigger: ['blur', 'change'],
}, ],
blqksm:[{
required: true,
message: '请填写服务情况说明',
trigger: ['blur', 'change'],
}],
dhgtjg: [
{
required: false,
validator: (rule, value, callback) => {
if (this.formData.demandType === '5' && (!value || value === '')) {
callback(new Error('请输入电话沟通结果'));
} else {
callback();
}
},
trigger: ['blur', 'change'],
}
],
personStatus: [{
required: true,
message: '请选择人员状态',
trigger: ['blur', 'change'],
}]
},
dict: {
serviceContent: [],
personStatus: [] // 新增
},
show: {
serviceContent: false,
personStatus: false // 新增
},
loading: false,
fileList: [],
validType: [{
label: "个人",
value: "0",
},
{
label: "企业",
value: "1",
},
],
serviceContentList: [],
tempServiceContent: [],
}
},
onReady() {
this.$refs.uForm.setRules(this.rules)
},
created() {
this.serviceontent();
this.loading = true;
let arr = [{
key: 'qyjy_dhgtjg',
prop: 'dhgtjg'
},
{
key: 'qyjy_zdfwlx',
prop: 'demandType'
},
// 新增人员状态字典
{
key: 'qcjy_ryzt', // 如有实际key请替换
prop: 'personStatus'
},
]
arr.forEach(ele => {
this.$getDict(ele.key).then(res => {
this.dict[ele.prop] = res.data
this.$forceUpdate();
})
})
this.$getDict("qcjy_fwnr").then(res => {
console.log("获取到的服务内容数据:", res.data);
this.dict.serviceContent = res.data;
this.$forceUpdate();
});
},
mounted() {
setTimeout(() => {
this.setName()
}, 0)
},
methods: {
serviceontent(){
this.$getDict("qcjy_fwnr").then(res=>{
console.log("服务内容列表",res.data)
})
},
cancelPage() {
if (this.formData.id) {
this.edit = false;
this.getDetail(this.formData.id)
} else {
uni.navigateBack()
}
},
setName(){
this.formData.serviceObjectName = this.name
this.formData.serviceObjectId = this.userId
this.formData.userId = this.userId
this.$forceUpdate();
},
openPersonChooser() {
if (this.edit) {
this.$refs.personChooser.open();
}
},
personNameConfirm(event) {
this.formData.serviceObjectName = event.name
this.formData.serviceObjectId = event.id
this.$forceUpdate();
},
// 选择企业
enterpriseConfirm({
unitName,
id
}) {
this.$set(this.formData, 'serviceObjectName', unitName)
this.$set(this.formData, 'serviceObjectId', id)
},
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 = {
type: "0"
}
this.edit = true
},
getDetail(id) {
getInvestigate(id).then(res => {
const data = res.data;
// 处理服务内容为数组
if (data.serviceContent) {
data.serviceContent = typeof data.serviceContent === 'string'
? data.serviceContent.split(',').filter(Boolean)
: data.serviceContent;
} else {
data.serviceContent = [];
}
this.formData = data;
this.edit = false;
this.fileList = this.$processFileUrl(this.formData.fileUrl);
})
},
confirmDate(type, e) {
this.show[type] = false;
// 获取选中的日期
const date = e.value;
// 使用 uView 的 uTime 方法格式化日期,包含时分秒
const formattedDateTime = uni.$u.timeFormat(date, "yyyy-mm-dd hh:MM:ss");
this.formData[type] = formattedDateTime
this.$forceUpdate();
},
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 '请选择'
}
}
},
pickerConfirm(type, event) {
this.show[type] = false;
if (type === 'serviceContent') {
// 多选处理
this.formData[type] = event.value.map(item => item.dictValue);
} else {
// 其他字段保持原样
this.formData[type] = event.value[0].dictValue;
}
this.$forceUpdate();
},
showPicker(type) {
if (this.edit) {
this.show[type] = true
this.$forceUpdate()
}
},
async saveInfo() {
try {
const isValid = await this.$refs.uForm.validate();
if (!isValid) {
throw new Error('请检查必填项填写');
}
let demandType = this.formData.demandType;
// 确保 serviceContent 是数组并且有值
if (!Array.isArray(this.formData.serviceContent) || this.formData.serviceContent.length === 0) {
this.$u.toast("请选择服务内容!");
return;
}
// 处理服务内容数组
this.formData.fwnr = this.formData.serviceContent.join(',');
// 显示全局加载
this.$showLoading();
// 根据 formData 是否有 id 来决定是更新还是新增
let response;
let successMessage;
if (this.formData.id) {
response = await updateInvestigate(this.formData);
successMessage = '修改成功';
} else {
console.log("h5表单",this.formData)
delete this.formData.type
response = await addInvestigate(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();
}
}
} catch (error) {
this.$u.toast("请填写完整内容");
} finally {
// 确保加载页总是会被隐藏
this.$hideLoading();
}
},
getMultiDictLabel(values, list) {
if (!values || !list) return '';
const valueArray = typeof values === 'string' ? values.split(',') : values;
if (!Array.isArray(valueArray)) return '';
return valueArray.map(value => {
const item = list.find(ele => ele.dictValue == value);
return item ? item.dictLabel : '';
}).filter(Boolean).join('、');
},
checkboxGroupChange(values) {
this.formData.serviceContent = values;
this.$forceUpdate();
},
processServiceContentList() {
this.serviceContentList = this.dict.serviceContent.map(item => ({
label: item.dictLabel,
value: item.dictValue
}));
},
showServiceContentSelect() {
console.log("点击了服务内容");
if (this.edit) {
this.tempServiceContent = Array.isArray(this.formData.serviceContent)
? [...this.formData.serviceContent]
: [];
this.show.serviceContent = true;
this.$forceUpdate();
}
},
cancelSelect() {
console.log("取消选择");
this.show.serviceContent = false;
this.$forceUpdate();
},
confirmSelect() {
console.log("确认选择", this.tempServiceContent);
this.formData.serviceContent = [...this.tempServiceContent];
this.show.serviceContent = false;
this.$forceUpdate();
},
}
}
</script>
<style lang="scss">
.page ::v-deep .u-navbar__content {
background-color: transparent !important;
}
.input-outer-part {
.status_radio {
.u-radio-group {
display: flex;
flex-direction: row;
}
.u-radio {
margin-right: 50rpx;
}
}
}
.page {
background-color: #EEF1F5 !important;
height: 100vh;
background-image: url('https://rc.jinan.gov.cn/qcwjyH5/static/images/top.png');
background-repeat: no-repeat;
background-size: 100% auto;
}
.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;
.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;
}
// 改进选择器样式
.picker-view {
display: flex;
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;
position: relative;
&:active {
background: #f8f9fa;
border-color: #007aff;
transform: scale(0.98);
}
&::after {
content: '';
position: absolute;
right: 36rpx;
top: 50%;
transform: translateY(-50%);
width: 0;
height: 0;
border-left: 12rpx solid transparent;
border-right: 12rpx solid transparent;
border-top: 12rpx solid #999999;
}
.picker-text {
color: #333333;
font-size: 28rpx;
flex: 1;
}
.picker-placeholder {
color: #999999;
font-size: 28rpx;
}
}
// 选中状态的样式
.picker-view.selected {
border-color: #1D64CF;
background: #f0f8ff;
&::after {
border-top-color: #1D64CF;
}
}
.checkbox-container {
padding: 10rpx 0;
.u-checkbox-group {
display: flex;
flex-wrap: wrap;
gap: 20rpx;
}
.u-checkbox {
margin-right: 30rpx;
margin-bottom: 20rpx;
}
}
.select-content {
background-color: #fff;
border-radius: 24rpx 24rpx 0 0;
.select-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1px solid #EBEEF5;
text {
font-size: 28rpx;
&:first-child {
color: #909399;
padding: 10rpx 20rpx;
}
&:last-child {
color: #1D64CF;
font-weight: 500;
padding: 10rpx 20rpx;
}
&.title {
font-size: 32rpx;
color: #303133;
font-weight: 500;
}
}
}
.checkbox-scroll {
max-height: 700rpx;
padding: 20rpx 0;
}
.checkbox-group {
padding: 0 30rpx;
}
.checkbox-item {
padding: 24rpx 0;
border-bottom: 1px solid #F2F6FC;
display: flex;
align-items: center;
&:last-child {
border-bottom: none;
}
// 修改 checkbox 样式
::v-deep .u-checkbox {
width: 100%;
margin: 0;
display: flex;
align-items: center;
&__label {
font-size: 28rpx;
color: #303133;
margin-left: 16rpx;
}
&__icon-wrap {
width: 36rpx;
height: 36rpx;
border-radius: 6rpx;
border: 2rpx solid #DCDFE6;
display: flex;
align-items: center;
justify-content: center;
&--checked {
background-color: #1D64CF;
border-color: #1D64CF;
}
}
}
}
}
// 增加选中态的样式
::v-deep .u-checkbox__icon-wrap--checked {
.u-checkbox__icon {
color: #fff;
transform: scale(0.8);
}
}
</style>

View File

@@ -0,0 +1,629 @@
<!--
* @Date: 2024-10-08 14:29:36
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-04 13:56:42
-->
<template>
<view>
<view class="input-outer-part">
<scroll-view scroll-y="true" :style="{height: edit?'calc(100vh - 200rpx)':'calc(100vh - 194rpx)'}">
<view class="inner">
<view class="part-title" style="display: flex;justify-content: space-between;">服务信息
<view v-if="!edit&&formData.id" class="btn" style="font-weight: normal;display: flex;"
@click="edit=true">编辑<u-icon name="edit-pen" color="#A6A6A6"></u-icon></view>
</view>
<view class="inner-part">
<view class="self-form">
<view class="form-item">
<view class="form-label ">人员姓名<text class="required">*</text></view>
<view style="width: calc(100% - 120rpx);word-break: break-all;" @click="openPersonChooser"
:class="{disabledLine: !edit, noValue: !formData.personName}">
{{ formData.personName || '请选择' }}
</view>
<view class="icon-right" style="width: 40rpx; height: 40rpx;"></view>
</view>
<view class="form-item">
<view class="form-label ">标题<text class="required">*</text></view>
<textarea :disabled="!edit" v-model="formData.recommendTopic"
:class="['form-textarea', { 'form-textarea-disabled': !edit }]"
placeholder="请输入"></textarea>
<view class="icon-right" style="width: 40rpx; height: 40rpx;"></view>
</view>
<view class="form-item">
<view class="form-label ">备注</view>
<textarea :disabled="!edit" v-model="formData.remark"
:class="['form-textarea', { 'form-textarea-disabled': !edit }]"
placeholder="请输入"></textarea>
<view class="icon-right" style="width: 40rpx; height: 40rpx;"></view>
</view>
<view class="form-item">
<view class="form-label ">附件</view>
<ImageUpload :fileList="fileList" @update="changeFile" :maxCount="6" />
</view>
</view>
</view>
</view>
<view class="inner" v-if="showInfo != '1'">
<view class="part-title" style="margin-top: 32rpx;">求职需求信息</view>
<view class="inner-part">
<view class="self-form">
<view class="form-item">
<view class="form-label ">求职工种</view>
<view style="width: calc(100% - 120rpx);word-break: break-all;"
class="disabledLine">
{{ getJobWorkTypeName(activePersonInfo.jobWorkType) }}
</view>
</view>
<view class="form-item">
<view class="form-label ">最低薪酬</view>
<view style="width: calc(100% - 120rpx);word-break: break-all;"
class="disabledLine">
{{ activePersonInfo.minRecruitmentSalary || '--' }}
</view>
</view>
<view class="form-item">
<view class="form-label ">最高薪酬</view>
<view style="width: calc(100% - 120rpx);word-break: break-all;"
class="disabledLine">
{{ activePersonInfo.highRecruitmentSalary || '--' }}
</view>
</view>
</view>
<view class="tuijian-btn" v-if="edit" @click="showPositionChooser">推荐岗位</view>
</view>
</view>
<view class="inner">
<view class="part-title" style="margin-top: 32rpx;">人员推荐记录</view>
<view class="inner-part">
<view v-for="(item, index) in tuijianList" :key="index" class="job-list">
<view>{{ item.postName }}</view>
<view style="color: #8492a6;margin-top: 7rpx;">工种{{item.recruitWorkTypeName}}</view>
<view style="color: #8492a6;margin-top: 7rpx;">单位名称{{item.unitName}}</view>
<view class="del-btn" @click="removeTuijian(item)">删除</view>
</view>
<img v-if="!tuijianList.length" src="https://rc.jinan.gov.cn/qcwjyH5/static/images/person/empty.png"
style="width: 100%;display: block;margin: 0 auto;" />
<view v-if="!tuijianList.length" style="text-align: center;color: #8E8E8E;font-size: 24rpx;">暂无数据~
</view>
</view>
</view>
<!-- 办理完成后 需求说明 -->
<req-comp :form="{
actualSolveDate: formData.actualSolveDate,
actualSolvePeople: formData.actualSolvePeople,
solveDesc: formData.solveDesc,
fileUrl: formData.fileUrl
}" />
</scroll-view>
<choose-person style="width: 100%;position: relative;z-index: 2;" :choiceType="3" ref="personChooser" @confirm="personNameConfirm" />
<positionChooser ref="positionChooser" @confirm="jobListConfirm" />
<!-- <u-datetime-picker :show="show.actualSolveDate" v-model="dates.actualSolveDate" mode="date"
@confirm="confirmDate('actualSolveDate', $event)"
@cancel="cancelPicker('hopeSolveDate')"></u-datetime-picker> -->
<!-- <uni-popup ref="openDeal" style="position: relative;z-index: 2;">
<u--form class="self-form popup" labelPosition="top" :model="formData" :rules="rules" ref="uForm"
labelWidth="300" style="width: calc(100% - 64rpx);margin: 0 auto;">
<u-form-item label="实际办理时间" prop="actualSolveDate" required>
<view class="bordered" style="width: 100%;" @click="showPicker('actualSolveDate')"
:class="{noValue: !formData.actualSolveDate}">{{ formData.actualSolveDate||'请选择' }}</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="办理说明" prop="solveDesc" required>
<u-textarea v-model="formData.solveDesc" placeholder="请输入"></u-textarea>
</u-form-item>
</u--form>
<view class="button-area" style="width: 100%;margin-left: 0;box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.1);">
<view class="btn" @click="closeDeal">取消</view>
<view class="btn reset" @click="form.actualSolveDate = '';formData.solveDesc = ''">重置</view>
</view>
</uni-popup> -->
</view>
<view class="button-area" v-if="edit">
<view class="btn" @click="cancelPage">取消</view>
<!-- <view class="btn save" @click="finishJobRecommend">办结</view> -->
<view class="btn save" @click="formData.currentStatus='2';saveInfo()">保存</view>
</view>
</view>
</template>
<script>
import {
deptTreeSelect
} from "@/apiRc/person";
import {
addJobRecommend,
updateJobRecommend,
getJobRecommend,
getAddedJobs,
saveJobRecommend
} from "@/apiRc/service/jobRecommend";
import {
getPersonDemand
} from "@/apiRc/needs/personDemand";
import { listJobType } from "@/apiRc/jobType/index";
import ImageUpload from '@/packageRc/components/ImageUpload'
import ChoosePerson from './choosePerson.vue';
import positionChooser from './positionChooser.vue';
import dayjs from "dayjs";
export default {
components: {
ChoosePerson,
positionChooser,
ImageUpload
},
props: {
showInfo: {
type: String,
default: '0'
}
},
data() {
return {
fileList: [],
jobTypeList:[],
edit: true,
originalDept: [],
personBase: {},
dates: {},
formData: {
recommendTopic: '',
personName: '',
},
rules: {
personName: [{
required: true,
message: '请填写姓名',
trigger: ['blur', 'change'],
}, ],
recommendTopic: [{
required: true,
message: '请填写服务需求标题',
trigger: ['blur', 'change'],
}, ],
},
dict: {},
show: {},
loading: false,
workParams: {},
activePersonInfo: {},
tuijianList: [],
openDeal: false,
}
},
onReady() {
this.$refs.uForm.setRules(this.rules)
},
created() {
this.loading = true;
this.$getDict('qcjy_zgzpgz').then(res => {
this.dict.salary = res.data
})
this.workTypeRemoteMethod()
},
methods: {
closeDeal() {
this.$refs.openDeal.close()
},
// saveDeal() {
// if (!this.formData.actualSolveDate) {
// uni.showToast({
// title: '请填写实际解决时间!',
// icon: 'none'
// })
// return;
// }
// if (!this.formData.solveDesc) {
// uni.showToast({
// title: '请填写办理说明!',
// icon: 'none'
// })
// return;
// }
// this.formData.currentStatus = '3'
// this.$refs.openDeal.close();
// this.saveInfo()
// },
// finishJobRecommend() {
// this.$refs.uForm.validate().then(res => {
// this.$refs.openDeal.open()
// }).catch(() => {
// uni.showToast({
// title: '请检查必填项填写',
// icon: 'none'
// })
// })
// },
cancelPage() {
if (this.formData.id) {
this.edit = false;
this.getDetail(this.formData.id)
} else {
uni.navigateBack()
}
},
removeTuijian({
id
}) {
if (!this.edit) return
this.tuijianList = this.tuijianList.filter(t => t.id !== id);
},
openPersonChooser() {
if (this.edit) {
console.log("this",this.activePersonInfo)
this.$refs.personChooser.open();
}
},
showPositionChooser() {
if (this.edit) {
console.log("this.params",this.workParams)
this.workParams.latitude=this.activePersonInfo.latitude
this.workParams.longitude=this.activePersonInfo.longitude
this.$refs.positionChooser.open(this.workParams);
}
},
personNameConfirm(event) {
this.formData.personName = event.personName
this.formData.personId = event.personId
this.formData.jobDemandInfoId = event.id
// this.form.personStatus = event.currentStatus;
this.activePersonInfo = event;
console.log("event",event)
this.formNameChange(event);
this.$forceUpdate();
},
jobListConfirm(event) {
this.tuijianList = event;
},
// changeFile(e) {
// if (e.length) {
// let data = e[0];
// this.formData.fileUrl = data.data ? data.data.url : data.url
// } else {
// this.formData.fileUrl = ''
// }
// },
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.edit = true
},
addForPerson({
jobDemandInfoId
}) {
if (!jobDemandInfoId) return
getPersonDemand(jobDemandInfoId).then(res => {
this.activePersonInfo = res.data
this.formNameChange(this.activePersonInfo)
})
},
// 单独设置 人员姓名 和 id
setPersonName(data){
this.formData.personName = data.personName
this.formData.personId = data.personId
this.formData.jobDemandInfoId = data.jobDemandInfoId
this.addForPerson(data)
},
getDetail(id) {
// 查询角色详情
getJobRecommend(id).then(res => {
this.formData = res.data;
this.fileList = this.$processFileUrl(this.formData.fileUrl)
// 获取详情的时候 调用方法 拿到求职需求详情
this.addForPerson(res.data)
this.edit = false
this.getAddedJobsList(res.data)
})
},
// 获取推荐人员列表
getAddedJobsList({
postIdList
}) {
getAddedJobs({
postIdList,
pageNum: 1,
pageSize: 10000
}).then((res) => {
this.tuijianList = res.rows;
});
},
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();
},
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 '请选择'
}
}
},
workTypeRemoteMethod(key) {
listJobType({
workTypeName: key,
pageNum: 1,
pageSize: 50,
}).then((res) => {
this.jobTypeList = res.rows;
});
},
getJobWorkTypeName(data){
if (data) {
let arr = this.jobTypeList.filter((ele) => ele.id == data);
if(arr.length){
return arr[0].workTypeName;
}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()
// }
// },
formNameChange(e) {
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.recommendTopic =
`${this.$store.state.user.nick}_于${dayNew}对人员_${this.formData.personName}_进行_${this.getJobWorkTypeName(e.jobWorkType)}岗位推荐`;
this.$set(this.workParams, "recruitWorkType", e.jobWorkType);
this.$set(this.workParams, "workLocation", e.hopeWorkLocation);
this.$set(this.workParams, "minRecruitmentSalary", e.minRecruitmentSalary);
this.$set(this.workParams, "highRecruitmentSalary", e.highRecruitmentSalary);
this.$set(this.workParams, "longitude", e.longitude);
this.$set(this.workParams, "latitude", e.latitude);
// this.$set(this.workParams, "userId", e.userId);
},
async saveInfo() {
uni.showLoading();
try {
// 验证表单
let isValid = true
// = await this.$refs.uForm.validate();
for(let prop in this.rules){
this.rules[prop].forEach(ele => {
if(ele.required = false && !this.formData[prop]){
isValid = false
}
})
}
if (!isValid) {
uni.showToast({
title: '请检查必填项填写',
icon: 'none'
})
// throw new Error('请检查必填项填写');
}
// 显示全局加载
// 更新 formData 中的 postIdList
this.formData.postIdList = this.tuijianList.map((ele) => ele.id);
this.formData.id = this.formData.jobDemandInfoId;
// 保存职位推荐
const response = await saveJobRecommend(this.formData);
// 检查响应码是否为200
if (response.code === 200) {
uni.showToast({title: '提交成功', icon: 'none'});
}
// 延迟1秒后返回上一页
setTimeout(() => {
uni.navigateBack();
}, 1000);
} catch (error) {
uni.showToast({title: '错误详情:' + error, icon: 'none'});
} finally {
// 确保加载页总是会被隐藏
uni.hideLoading();
}
},
// saveInfo() {
// this.$refs.uForm.validate().then(res => {
// this.formData.postIdList = this.tuijianList.map((ele) => ele.id)
// saveJobRecommend(this.formData).then(response => {
// if (response.code == 200) {
// uni.showToast({
// title: '提交成功'
// })
// }
// uni.navigateBack();
// });
// if(this.formData.id){
// updateJobRecommend(this.formData).then(res => {
// if(res.code == 200) {
// uni.showToast({
// title: '修改成功'
// })
// this.edit = false;
// }
// })
// }else{
// addJobRecommend(this.formData).then(res => {
// if(res.code == 200) {
// uni.showToast({
// title: '保存成功'
// })
// uni.navigateBack();
// }
// })
// }
// }).catch((e) => {
// uni.showToast({
// title: '请检查必填项填写',
// icon: 'none'
// })
// })
// }
}
}
</script>
<style lang="scss">
.noValue {
color: rgb(192, 196, 204);
}
.disabledLine {
background: rgb(245, 247, 250);
cursor: not-allowed;
width: 100%;
}
// 改进选择器样式
.picker-view {
display: flex;
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;
position: relative;
&:active {
background: #f8f9fa;
border-color: #007aff;
transform: scale(0.98);
}
&::after {
content: '';
position: absolute;
right: 36rpx;
top: 50%;
transform: translateY(-50%);
width: 0;
height: 0;
border-left: 12rpx solid transparent;
border-right: 12rpx solid transparent;
border-top: 12rpx solid #999999;
}
.picker-text {
color: #333333;
font-size: 28rpx;
flex: 1;
}
.picker-placeholder {
color: #999999;
font-size: 28rpx;
}
}
// 选中状态的样式
.picker-view.selected {
border-color: #1D64CF;
background: #f0f8ff;
&::after {
border-top-color: #1D64CF;
}
}
.tuijian-btn {
background: #197cd2;
line-height: 60rpx;
width: 176rpx;
margin-right: 16rpx;
margin-top: 24rpx;
font-size: 28rpx;
color: #fff;
text-align: center;
border-radius: 8rpx;
margin: 0 auto;
}
.job-list {
padding: 24rpx 32rpx;
border-radius: 8rpx;
box-sizing: border-box;
border: 1px solid #e4e4e4;
margin-bottom: 24rpx;
position: relative;
&.active {
border: 1px solid #1890ff;
}
.del-btn {
background: #E95A49;
line-height: 48rpx;
width: 120rpx;
margin-right: 0;
margin-top: 0rpx;
margin-left: auto;
font-size: 24rpx;
color: #fff;
text-align: center;
border-radius: 8rpx;
}
}
.self-form.popup {
padding-top: 32rpx;
.bordered {
border: 1rpx solid #dadbde;
padding: 9px;
border-radius: 4px;
}
}
.form-label{
width: 120rpx;
}
</style>

View File

@@ -0,0 +1,399 @@
<!--
* @Date: 2024-10-08 14:29:36
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-04 14:16:13
-->
<template>
<view class="input-outer-part">
<scroll-view scroll-y="true" :style="{height: edit?'calc(100vh - 150px)':'calc(100vh - 144px)'}">
<view class="inner">
<view class="part-title" style="display: flex;justify-content: space-between;">服务信息
<view v-if="!edit&&formData.id" class="btn" style="font-weight: normal;display: flex;"
@click="edit=true">编辑<u-icon name="edit-pen" color="#A6A6A6"></u-icon></view>
</view>
<view class="inner-part">
<u--form labelPosition="left" :model="formData" :rules="rules" ref="uForm" class="self-form"
labelWidth="110">
<u-form-item label="姓名" prop="personName" required>
<view style="width: 100%;" @click="openPersonChooser"
:class="{disabledLine: !edit, 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="personStatus">
<view style="width: 100%;" @click="showPicker('personStatus')"
:class="{disabledLine: !edit, noValue: !formData.personStatus}">
{{ getDictLabel(formData.personStatus, dict.personStatus)||'请选择' }}
</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="就业类别" prop="employmentType" required>
<view style="width: 100%;" @click="showPicker('employmentType')"
:class="{disabledLine: !edit, noValue: !formData.employmentType}">
{{ getDictLabel(formData.employmentType, dict.employmentType)||'请选择' }}
</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="就业单位" prop="employmentUnit" required>
<u--input :disabled="!edit" v-model="formData.employmentUnit" border="none"
placeholder="请输入"></u--input>
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="就业状态" prop="employmentStatus" required>
<view style="width: 100%;" @click="showPicker('employmentStatus')"
:class="{disabledLine: !edit, noValue: !formData.employmentStatus}">
{{ getDictLabel(formData.employmentStatus, dict.employmentStatus)||'请选择' }}
</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="就业岗位" prop="employmentPosition">
<u--input :disabled="!edit" v-model="formData.employmentPosition" border="none"
placeholder="请输入"></u--input>
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="岗位工资" prop="money">
<u--input :disabled="!edit" v-model="formData.money" border="none"
placeholder="请输入"></u--input>
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="就业时间" prop="time">
<view style="width: 100%;" @click="showPicker('time')"
:class="{disabledLine: !edit, noValue: !formData.time}">{{ formData.time||'请选择' }}
</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item>
</u--form>
</view>
</view>
<view class="inner" style="margin-top: 32rpx;">
<view class="inner-part">
<u--form labelPosition="left" class="self-form" labelWidth="110">
<u-form-item label="备注" prop="remark">
<u-textarea :disabled="!edit" v-model="formData.remark" placeholder="请输入"></u-textarea>
</u-form-item>
</u--form>
</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="{
actualSolveDate: formData.actualSolveDate,
actualSolvePeople: formData.actualSolvePeople,
solveDesc: formData.solveDesc,
fileUrl: formData.fileUrl
}" />
</scroll-view>
<u-datetime-picker :show="show.time" v-model="dates.time" mode="date" @confirm="confirmDate('time', $event)"
@cancel="cancelPicker('time')"></u-datetime-picker>
<u-picker :show="show.personStatus" :columns="[dict.personStatus]" keyName="dictLabel"
@confirm="pickerConfirm('personStatus', $event)" @cancel="cancelPicker('personStatus')"></u-picker>
<u-picker :show="show.employmentType" :columns="[dict.employmentType]" keyName="dictLabel"
@confirm="pickerConfirm('employmentType', $event)" @cancel="cancelPicker('employmentType')"></u-picker>
<u-picker :show="show.employmentStatus" :columns="[dict.employmentStatus]" keyName="dictLabel"
@confirm="pickerConfirm('employmentStatus', $event)" @cancel="cancelPicker('employmentStatus')"></u-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="formData = {}" v-if="!formData.id">重置</view>
<view class="btn save" @click="saveInfo">保存</view>
</view>
</view>
</template>
<script>
import {
addJobTrack,
updateJobTrack,
getJobTrack
} from "@/apiRc/service/jobTrack";
import ImageUpload from '@/packageRc/components/ImageUpload'
import ChoosePerson from './choosePerson.vue';
export default {
components: {
ChoosePerson,
ImageUpload
},
data() {
return {
edit: true,
personBase: {},
dates: {},
formData: {
personName: '',
time: '',
visitor: '',
},
rules: {
personName: [{
required: true,
message: '请填写姓名',
trigger: ['blur', 'change'],
}, ],
employmentType: [{
required: true,
message: '请选择就业类别',
trigger: ['blur', 'change'],
}, ],
employmentUnit: [{
required: true,
message: '请填写就业单位',
trigger: ['blur', 'change'],
}, ],
employmentStatus: [{
required: true,
message: '请选择就业状态',
trigger: ['blur', 'change'],
}, ],
},
dict: {},
show: {},
loading: false,
fileList: [],
}
},
onReady() {
this.$refs.uForm.setRules(this.rules)
},
created() {
this.loading = true;
let arr = [{
key: 'qcjy_ryzt',
prop: 'personStatus'
},
{
key: 'qcjy_jylb',
prop: 'employmentType'
},
{
key: 'qcjy_jyzt',
prop: 'employmentStatus'
},
]
arr.forEach(ele => {
this.$getDict(ele.key).then(res => {
this.dict[ele.prop] = res.data
this.$forceUpdate();
})
})
},
methods: {
cancelPage() {
if (this.formData.id) {
this.edit = false;
this.getDetail(this.formData.id)
} else {
uni.navigateBack()
}
},
openPersonChooser() {
if (this.edit) {
this.$refs.personChooser.open();
}
},
personNameConfirm(event) {
this.formData.personName = event.name
this.formData.personId = event.id
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.edit = true
},
getDetail(id) {
getJobTrack(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();
},
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 '请选择'
}
}
},
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()
}
},
async saveInfo() {
try {
// 验证表单
const isValid = await this.$refs.uForm.validate();
if (!isValid) {
throw new Error('请检查必填项填写');
}
// 显示全局加载
this.$showLoading();
// 根据 formData 是否有 id 来决定是更新还是新增
let successMessage;
let response;
if (this.formData.id) {
response = await updateJobTrack(this.formData);
successMessage = '修改成功';
} else {
response = await addJobTrack(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();
}
}
} catch (error) {
this.$u.toast('错误详情:' + error);
} finally {
// 确保加载页总是会被隐藏
uni.hideLoading();
}
},
// saveInfo() {
// this.$refs.uForm.validate().then(res => {
// if (this.formData.id) {
// updateJobTrack(this.formData).then(res => {
// if (res.code == 200) {
// uni.showToast({
// title: '修改成功'
// })
// this.edit = false;
// }
// })
// } else {
// addJobTrack(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;
height: 100vh;
background-image: url('https://rc.jinan.gov.cn/qcwjyH5/static/images/top.png');
background-repeat: no-repeat;
background-size: 100% auto;
}
.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;
.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;
}
</style>

View File

@@ -0,0 +1,331 @@
<!--
* @Date: 2024-10-09 17:07:39
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-04 14:16:17
-->
<template>
<view class="input-outer-part">
<scroll-view scroll-y="true" :style="{height: edit?'calc(100vh - 150px)':'calc(100vh - 144px)'}">
<view class="inner">
<view class="part-title" style="display: flex;justify-content: space-between;">服务信息
<view v-if="!edit&&formData.id" class="btn" style="font-weight: normal;display: flex;"
@click="edit=true">编辑<u-icon name="edit-pen" color="#A6A6A6"></u-icon></view>
</view>
<view class="inner-part">
<u--form labelPosition="left" :model="formData" :rules="rules" ref="uForm" class="self-form"
labelWidth="110">
<u-form-item label="姓名" prop="personName" required>
<view style="width: 100%;" @click="openPersonChooser"
:class="{disabledLine: !edit, noValue: !formData.personName}">
{{ formData.personName || '请选择' }}
</view>
<!-- <u--input disabled v-model="formData.personName" border="none" placeholder="请输入" ></u--input> -->
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="咨询时间" prop="time" required>
<view style="width: 100%;" @click="showPicker('time')"
:class="{disabledLine: !edit, noValue: !formData.time}">{{ formData.time||'请选择' }}
</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="咨询讲解人员" prop="expositor" required>
<u--input :disabled="!edit" v-model="formData.expositor" border="none"
placeholder="请输入"></u--input>
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</u-form-item>
</u--form>
</view>
</view>
<view class="inner" style="margin-top: 32rpx;">
<view class="inner-part">
<u--form labelPosition="left" class="self-form" labelWidth="110">
<u-form-item label="情况说明" prop="content">
<u-textarea :disabled="!edit" v-model="formData.content" placeholder="请输入"></u-textarea>
</u-form-item>
</u--form>
</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>
<handler-data style="margin-top: 30rpx;" v-if="false"/>
</scroll-view>
<u-datetime-picker :show="show.time" v-model="dates.time" mode="date" @confirm="confirmDate('time', $event)"
@cancel="cancelPicker('time')"></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="formData = {}" v-if="!formData.id">重置</view>
<view class="btn save" @click="saveInfo">保存</view>
</view>
</view>
</template>
<script>
import {
addPolicyConsultation,
updatePolicyConsultation,
getPolicyConsultation
} from "@/apiRc/service/policyConsultation";
import ImageUpload from '@/packageRc/components/ImageUpload'
import ChoosePerson from './choosePerson.vue';
export default {
components: {
ChoosePerson,
ImageUpload,
},
data() {
return {
fileList: [],
edit: true,
personBase: {},
dates: {},
formData: {
demandTitle: '',
isAcceptAssistance: '',
isAcceptApprovalResult: '',
personName: '',
},
rules: {
time: [{
required: true,
message: '请填写咨询讲解人员',
trigger: ['blur', 'change'],
}, ],
expositor: [{
required: true,
message: '请选择咨询时间',
trigger: ['blur', 'change'],
}, ],
personName: [{
required: true,
message: '请填写姓名',
trigger: ['blur', 'change'],
}, ],
},
show: {},
loading: false,
}
},
onReady() {
this.$refs.uForm.setRules(this.rules)
},
created() {
this.loading = true;
},
methods: {
cancelPage() {
if (this.formData.id) {
this.edit = false;
this.getDetail(this.formData.id)
} else {
uni.navigateBack()
}
},
openPersonChooser() {
if (this.edit) {
this.$refs.personChooser.open();
}
},
personNameConfirm(event) {
this.formData.personName = event.name
this.formData.personId = event.id
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.edit = true
},
getDetail(id) {
getPolicyConsultation(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())}`
console.log(this.show[type], type)
this.$forceUpdate();
},
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 '请选择'
}
}
},
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()
}
},
async saveInfo() {
try {
// 验证表单
const isValid = await this.$refs.uForm.validate();
if (!isValid) {
throw new Error('请检查必填项填写');
}
// 显示全局加载
this.$showLoading();
// 根据 formData 是否有 id 来决定是更新还是新增
let response;
let successMessage;
if (this.formData.id) {
response = await updatePolicyConsultation(this.formData);
successMessage = '修改成功';
} else {
response = await addPolicyConsultation(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();
}
}
} catch (error) {
this.$u.toast('错误详情:' + error);
} finally {
// 确保加载页总是会被隐藏
uni.hideLoading();
}
},
// saveInfo() {
// this.$refs.uForm.validate().then(res => {
// if (this.formData.id) {
// updatePolicyConsultation(this.formData).then(res => {
// if (res.code == 200) {
// uni.showToast({
// title: '修改成功'
// })
// this.edit = false;
// }
// })
// } else {
// addPolicyConsultation(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;
height: 100vh;
background-image: url('https://rc.jinan.gov.cn/qcwjyH5/static/images/top.png');
background-repeat: no-repeat;
background-size: 100% auto;
}
.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;
.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;
}
</style>

View File

@@ -0,0 +1,388 @@
<template>
<uni-popup ref="showPersonChooser" type="bottom" round background-color="#fff">
<view style="padding: 32rpx 0">
<!-- <u--input @change="searchChange" placeholder="搜索选择岗位" v-model="searchPerson"></u--input> -->
<scroll-view style="height: 900rpx;" :scroll-y="true" @scrolltolower="getBottomList">
<!-- 搜索区域 -->
<view class="search-area">
<view class="search-inputs">
<input
v-model="searchValue"
placeholder="请输入公司/岗位名称"
border="surround"
clearable
class="search-input"
/>
</view>
<button type="primary" @click="onSearch" class="search-btn">搜索</button>
</view>
<!-- 岗位列表 -->
<view v-for="(item, index) in jobList"
:key="index"
@click="chooseJob(item)"
class="job-card"
:class="{active: activeJobList.indexOf(item.id)!=-1}">
<!-- 岗位名称和薪资 -->
<view class="job-header">
<text class="job-title">{{item.postName}}</text>
<text class="job-salary">{{formatSalary(item.minRecruitmentSalary, item.highRecruitmentSalary)}}</text>
</view>
<!-- 标签区域 -->
<view class="tag-area">
<text class="tag">{{getDictLabel(item.minEducation, xue_li) || '学历不限'}}</text>
<text class="tag">{{item.profession || '专业不限'}}</text>
<text class="tag">全职</text>
</view>
<!-- 公司信息 -->
<view class="company-info">
<view class="company-detail">
<text class="company-name">{{item.unitName}}</text>
<view class="location-line">
<text class="location">
<text class="location-icon">📍</text>
{{item.workLocation || '暂无地址'}}
</text>
</view>
</view>
</view>
<!-- 推荐标记 -->
<view class="recommend-tag" v-if="choosedIdList.indexOf(item.id) != -1">推荐</view>
</view>
<view v-if="loadingJob">加载中...</view>
<div v-if="jobList.length == 0&&!loadingJob" :text="'暂无数据'"></div>
</scroll-view>
<view class="button-area">
<view class="btn" @click="closeshowPersonChooser">取消</view>
<view class="btn save" @click="saveInfo">确定</view>
</view>
<!-- <view style="color: #8492a6;margin-top: 7rpx;">距离
<text style="color: #fa6553;">{{item.distance || '--'}} km</text>
</view> -->
</view>
</uni-popup>
</template>
<script>
import { getWorkListReq } from '@/apiRc/service/jobRecommend'
export default {
data() {
return {
showPersonChooser: false,
activeJobList: [],
searchPerson: '',
searcher: '',
workParams: {},
jobList: [],
jobTotal: 0,
showMorePage: true,
choosedIdList: [],
loadingJob: false,
xue_li:[],
searchValue: '',
searchJob: '',
}
},
methods: {
onSearch() {
// 重置页码和列表
this.workParams.pageNum = 1;
this.jobList = [];
// 添加搜索条件
this.workParams.searchValue = this.searchValue;
this.doSearch();
},
formatSalary(min, max) {
if (!min && !max) return '薪资面议';
if (!min) return `${max}元/月`;
if (!max) return `${min}元/月`;
return `${min}-${max}元/月`;
},
closeshowPersonChooser() {
this.$refs.showPersonChooser.close()
},
open(workParams) {
console.log("workparams",workParams)
this.$refs.showPersonChooser.open()
this.activeJobList = []
// this.workParams = workParams
this.workParams = {
// ...workParams,
recruitWorkType: workParams.recruitWorkType,
// longitude: workParams.longitude,
// latitude: workParams.latitude,
pageNum: 1,
pageSize: 10,
latitude:workParams.latitude,
longitude:workParams.longitude
}
this.jobTotal = 0;
this.jobList = [];
this.doSearch()
},
saveInfo() {
this.$emit('confirm', this.activeJobList)
this.$refs.showPersonChooser.close()
},
searchChange(){
if(this.searcher){
clearTimeout(this.searcher)
this.doSearch()
}else{
this.doSearch()
}
}, // 触底加载
getBottomList() {
if (this.workParams.pageNum * this.workParams.pageSize >= this.jobTotal) {
this.showMorePage = false;
} else if (this.workParams.pageNum * this.workParams.pageSize < this.jobTotal) {
this.workParams.pageNum++;
this.doSearch();
if (this.workParams.pageNum * this.workParams.pageSize >= this.jobTotal) {
this.showMorePage = false;
}
}
},
getDictLabel(value, list) {
if (list && value) {
const found = list.find(ele => ele.dictValue === value);
return found ? found.dictLabel : '学历不限';
}
return '学历不限';
},
doSearch() {
this.loadingJob = true;
// 先获取学历字典
this.$getDict('qcjy_jycd').then(res => {
this.xue_li = res.data;
// 再获取岗位列表
getWorkListReq(this.workParams).then((res) => {
this.loadingJob = false;
if (res.code == 200) {
if (res.rows.length < 10) {
this.showMorePage = false;
}
this.loading = false;
this.jobList = this.jobList.concat(res.rows);
this.jobTotal = res.total;
} else {
this.loading = false;
uni.showToast({
title: res.msg,
icon: "none",
});
}
});
});
},
chooseJob(item) {
let index = this.choosedIdList.indexOf(item.id);
if(index == -1){
this.activeJobList.push(item);
this.choosedIdList.push(item.id);
}else{
this.activeJobList.splice(index, 1);
this.choosedIdList.splice(index, 1);
}
this.$forceUpdate();
},
}
}
</script>
<style lang="scss" scoped>
.person-list{
padding: 24rpx 32rpx;
border-radius: 8rpx;
box-sizing: border-box;
border: 1px solid #e4e4e4;
margin-top: 32rpx;
position: relative;
&.active{
border: 1px solid #1890ff;
}
.tjBtn{
position: absolute;
right: -16rpx;
top: 0;
line-height: 48rpx;
width: 120rpx;
margin-right: 16rpx;
font-size: 24rpx;
color: #fff;
text-align: center;
border-radius: 0 8rpx 0 8rpx;
background: #1D64CF;
}
}
// .button-area{
// box-shadow: 0 0 10rpx rgba(0,0,0,0.1);
// 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;
// .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;
// }
// }
.part-title{
margin-bottom: 10rpx;
font-size: 28rpx;
font-weight: bold;
}
.search-area {
padding: 20rpx 32rpx;
display: flex;
align-items: center;
gap: 16rpx;
.search-inputs {
flex: 1;
display: flex;
gap: 16rpx;
.search-input {
flex: 1;
border: 1px solid #e4e4e4;
border-radius: 40rpx;
height: 60rpx;
padding: 0 16rpx;
}
}
.search-btn {
width: 140rpx;
height: 60rpx;
line-height: 60rpx;
margin: 0;
background: #1890ff;
color: #fff;
font-size: 24rpx;
}
}
.job-card {
background: #FFFFFF;
border-radius: 12rpx;
padding: 24rpx;
margin: 0 32rpx 20rpx;
position: relative;
border: 1px solid #EBEEF5;
&.active {
border: 1px solid #1890ff;
}
}
.job-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
}
.job-title {
font-size: 32rpx;
font-weight: 500;
color: #333333;
}
.job-salary {
font-size: 28rpx;
color: #FA6553;
font-weight: 500;
}
.tag-area {
display: flex;
gap: 12rpx;
margin-bottom: 16rpx;
flex-wrap: wrap;
}
.tag {
font-size: 24rpx;
color: #666666;
background: #F5F7FA;
padding: 4rpx 12rpx;
border-radius: 4rpx;
}
.company-info {
display: flex;
align-items: center;
}
.company-detail {
flex: 1;
}
.company-name {
font-size: 26rpx;
color: #666666;
display: block;
}
.location-line {
display: flex;
align-items: center;
gap: 16rpx;
margin-top: 4rpx;
}
.location {
font-size: 24rpx;
color: #666666;
display: flex;
align-items: center;
.location-icon {
font-size: 24rpx;
margin-right: 4rpx;
}
}
.post-date {
font-size: 24rpx;
color: #999999;
}
.recommend-tag {
position: absolute;
right: -2rpx;
top: 0;
background: #1D64CF;
color: #FFFFFF;
font-size: 24rpx;
padding: 4rpx 16rpx;
border-radius: 0 12rpx 0 12rpx;
}
</style>

View File

@@ -0,0 +1,445 @@
<!--
* @Date: 2024-10-08 14:29:36
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-04 14:16:11
-->
<template>
<view class="input-outer-part">
<scroll-view scroll-y="true" :style="{height: edit?'calc(100vh - 150px)':'calc(100vh - 144px)'}">
<view class="inner">
<view class="part-title" style="display: flex;justify-content: space-between;">服务信息
<view v-if="!edit&&formData.id" class="btn" style="font-weight: normal;display: flex;"
@click="edit=true">编辑<u-icon name="edit-pen" color="#A6A6A6"></u-icon></view>
</view>
<view class="inner-part">
<u--form labelPosition="left" :model="formData" :rules="rules" ref="uForm" class="self-form"
labelWidth="110">
<u-form-item label="姓名" prop="personName" required>
<view style="width: 100%;" @click="openPersonChooser"
:class="{disabledLine: !edit, 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="personStatus">
<view style="width: 100%;" @click="showPicker('personStatus')" :class="{disabledLine: !edit, noValue: !formData.personStatus}">{{ getDictLabel(formData.personStatus, dict.personStatus)||'请选择' }}</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6" ></u-icon>
</u-form-item> -->
<u-form-item label="培训人员" prop="trainingStaff" required>
<u--input :disabled="!edit" v-model="formData.trainingStaff" border="none"
placeholder="请输入"></u--input>
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="培训时间" prop="time" required>
<view style="width: 100%;" @click="showPicker('time')"
:class="{disabledLine: !edit, noValue: !formData.time}">{{ formData.time||'请选择' }}
</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="培训题目" prop="trainingTopic" required>
<u-textarea :disabled="!edit" v-model="formData.trainingTopic"
placeholder="请输入"></u-textarea>
</u-form-item>
<u-form-item label="培训内容" prop="trainingContent" required>
<u-textarea :disabled="!edit" v-model="formData.trainingContent"
placeholder="请输入"></u-textarea>
</u-form-item>
</u--form>
</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="{
actualSolveDate: formData.actualSolveDate,
actualSolvePeople: formData.actualSolvePeople,
solveDesc: formData.solveDesc,
fileUrl: formData.fileUrl
}" />
</scroll-view>
<u-datetime-picker :show="show.time" v-model="dates.time" mode="date" @confirm="confirmDate('time', $event)"
@cancel="cancelPicker('time')"></u-datetime-picker>
<u-datetime-picker :show="show.actualSolveDate" v-model="dates.actualSolveDate" mode="date"
@confirm="confirmDate('actualSolveDate', $event)"
@cancel="cancelPicker('actualSolveDate')"></u-datetime-picker>
<!-- <u-picker :show="show.personStatus" :columns="[dict.personStatus]" keyName="dictLabel" @confirm="pickerConfirm('personStatus', $event)" @cancel="cancelPicker('personStatus')"></u-picker> -->
<choose-person :choiceType="4" ref="personChooser" @confirm="personNameConfirm" />
<u-popup :show="openDeal" style="position: relative;z-index: 2;">
<u--form class="self-form popup" labelPosition="top" :model="formData" :rules="rules" ref="uForm"
labelWidth="300" style="width: calc(100% - 64rpx);margin: 0 auto;">
<u-form-item label="实际办理时间" prop="actualSolveDate" required>
<view class="bordered" style="width: 100%;" @click="showPicker('actualSolveDate')"
:class="{noValue: !formData.actualSolveDate}">{{ formData.actualSolveDate||'请选择' }}</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="办理说明" prop="solveDesc" required>
<u-textarea v-model="formData.solveDesc" placeholder="请输入"></u-textarea>
</u-form-item>
</u--form>
<view class="button-area" style="width: 100%;margin-left: 0;box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.1);">
<view class="btn" @click="openDeal = false">取消</view>
<view class="btn reset" @click="form.actualSolveDate = '';formData.solveDesc = ''">重置</view>
<!-- <view class="btn save" @click="saveDeal">办结</view> -->
</view>
</u-popup>
<view class="button-area" v-if="edit">
<view class="btn" @click="cancelPage">取消</view>
<!-- <view class="btn save" @click="finishSkillTrain">办结</view> -->
<view class="btn save" @click="formData.skillTrainingStatus='2';saveInfo()">保存</view>
</view>
</view>
</template>
<script>
import {
addSkillTrain,
updateSkillTrain,
getSkillTrain
} from "@/apiRc/service/skillTrain";
import ImageUpload from '@/packageRc/components/ImageUpload'
import ChoosePerson from './choosePerson.vue';
export default {
components: {
ChoosePerson,
ImageUpload
},
data() {
return {
fileList: [],
edit: true,
personBase: {},
dates: {},
formData: {
personName: '',
trainingStaff: '',
time: '',
trainingTopic: '',
trainingContent: '',
},
rules: {
personName: [{
required: true,
message: '请填写姓名',
trigger: ['blur', 'change'],
}, ],
trainingStaff: [{
required: true,
message: '请填写培训人员',
trigger: ['blur', 'change'],
}, ],
time: [{
required: true,
message: '请选择培训时间',
trigger: ['blur', 'change'],
}, ],
trainingTopic: [{
required: true,
message: '请填写培训题目',
trigger: ['blur', 'change'],
}, ],
trainingContent: [{
required: true,
message: '请填写培训内容',
trigger: ['blur', 'change'],
}, ],
},
dict: {},
show: {},
loading: false,
openDeal: false,
form: {},
}
},
onReady() {
this.$refs.uForm.setRules(this.rules)
},
created() {
this.$getDict('qcjy_ryzt').then(res => {
this.dict.personStatus = res.data
})
this.loading = true;
},
methods: {
cancelPage() {
if (this.formData.id) {
this.edit = false;
this.getDetail(this.formData.id)
} else {
uni.navigateBack()
}
},
saveDeal() {
if (!this.formData.actualSolveDate) {
uni.showToast({
title: '请填写实际解决时间!',
icon: 'none'
})
return;
}
if (!this.formData.solveDesc) {
uni.showToast({
title: '请填写办理说明!',
icon: 'none'
})
return;
}
this.formData.skillTrainingStatus = '3'
this.openDeal = false;
this.saveInfo()
},
finishSkillTrain() {
this.$refs.uForm.validate().then(res => {
this.openDeal = true;
}).catch(() => {
uni.showToast({
title: '请检查必填项填写',
icon: 'none'
})
})
},
openPersonChooser() {
if (this.edit) {
this.$refs.personChooser.open();
}
},
personNameConfirm(event) {
this.formData.personName = event.personName
this.formData.personId = event.personId
this.formData.skillTrainingId = event.id
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.edit = true
},
// addForPerson(options) {
// this.formData = {
// personName: options.personName,
// personId: options.personId,
// skillTrainingId: options.skillTrainingId
// }
// this.edit = true
// },
getDetail(id) {
getSkillTrain(id).then(res => {
this.formData = res.data || {};
this.edit = false
if(this.formData.fileUrl) {
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();
},
goBack() {
uni.navigateBack();
},
cancelPicker(type) {
this.show[type] = false
this.$forceUpdate();
},
// 单独设置 人员姓名 和 id
setPersonName(data){
this.formData.personName = data.personName
this.formData.personId = data.personId
this.formData.skillTrainingId = data.skillTrainingId
// this.addForPerson(data)
},
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()
}
},
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()}`
this.formData.trainingTopic =
`${this.$store.state.user.nick}_于${day}对人员_${this.formData.personName}_进行XXXX培训`;
},
async saveInfo() {
try {
// 验证表单
const isValid = await this.$refs.uForm.validate();
if (!isValid) {
throw new Error('请检查必填项填写');
}
// 显示全局加载
this.$showLoading();
// 根据 formData 是否有 id 来决定是更新还是新增
let response;
let successMessage;
if (this.formData.id) {
response = await updateSkillTrain(this.formData);
successMessage = '修改成功';
} else {
response = await addSkillTrain(this.formData);
successMessage = '保存成功';
}
if (response.code === 200) {
this.$u.toast(successMessage);
// 如果是编辑模式,关闭编辑状态;否则返回上一页
if (this.formData.id) {
this.edit = false;
} else {
await this.$delay(1000); // 延迟1秒后返回上一页
uni.navigateBack();
}
}
} catch (error) {
// 处理错误并显示提示信息
this.$u.toast('错误详情:' + error);;
} finally {
// 确保加载页总是会被隐藏
uni.hideLoading();
}
},
// saveInfo() {
// this.$refs.uForm.validate().then(res => {
// if (this.formData.id) {
// updateSkillTrain(this.formData).then(res => {
// if (res.code == 200) {
// uni.showToast({
// title: '修改成功'
// })
// this.edit = false;
// }
// })
// } else {
// addSkillTrain(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;
height: 100vh;
background-image: url('https://rc.jinan.gov.cn/qcwjyH5/static/images/top.png');
background-repeat: no-repeat;
background-size: 100% auto;
}
.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;
.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);
}
.self-form.popup {
padding-top: 32rpx;
.bordered {
border: 1rpx solid #dadbde;
padding: 9px;
border-radius: 4px;
}
}
.disabledLine {
background: rgb(245, 247, 250);
cursor: not-allowed;
}
</style>