合并人才集团代码

This commit is contained in:
2025-11-03 12:30:37 +08:00
parent 233e5fecdc
commit 1c6d5c7a15
118 changed files with 12562 additions and 14 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
/unpackage/
/node_modules/

84
apiRc/person.js Normal file
View File

@@ -0,0 +1,84 @@
/*
* @Date: 2025-10-31 13:50:15
* @LastEditors: shirlwang
* @LastEditTime: 2025-10-31 14:30:31
*/
import request from '@/utilsRc/request'
// 人员信息保存
export function savePersonBase(data) {
return request({
'url': '/personnel/personBaseInfo',
'method': 'put',
'data': data
})
}
// 人员信息查询
export function getPersonBase(userId) {
return request({
'url': `/personnel/personBaseInfo/user/${userId}`,
'method': 'get',
})
}
// 获取行政区划列表
export function getQUList() {
return request({
url: `/manage/xzqh//xzqhTree`,
method: 'get'
})
}
// 查询部门下拉树结构
export function deptTreeSelect() {
return request({
url: '/system/center/user/deptTree',
method: 'get'
})
}
// 社群端 根据所在社区 获取姓名
export function generateUserName(deptId) {
return request({
url: `/generateUserName/${deptId}`,
method: 'get'
})
}
// 获取部门列表
export function getDeptList(name,personId) {
return request({
url: `/system/center/user/getDeptList?name=${name}&parentId=${personId}`,
method: 'get'
})
}
// 求职工种列表
export function touristWork() {
return request({
url: `/basicdata/workType/workTypeTree`,
method: 'get'
})
}
// 获取招聘工种列表
export function jobTypeList(params) {
return request({
url: '/basicdata/workType/list',
method: 'get',
params
})
}
// 未读消息数量
export function unreadNum() {
return request({
url: '/manage/tjgw/notReadNum',
method: 'get',
})
}
// 地图类型列表
export function jyshdt(cyfhjd) {
return request({
url: `/jyshdt/jyshdt/queryList?lx=${cyfhjd}`,
method: 'get',
})
}

63
apiRc/system/dict.js Normal file
View File

@@ -0,0 +1,63 @@
/*
* @Date: 2025-10-31 15:06:34
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-03 12:20:28
*/
import request from '@/utilsRc/request'
// 查询字典数据列表
export function listData (query) {
return request({
url: '/system/dict/data/list',
method: 'get',
params: query
})
}
// 查询字典数据详细
export function getData (dictCode) {
return request({
url: '/system/dict/data/' + dictCode,
method: 'get'
})
}
// 根据字典类型查询字典数据信息
export function getDicts (dictType) {
return request({
url: '/system/dict/data/type/' + dictType,
method: 'get'
})
}
// 根据字典类型查询字典数据信息
export function getDict (dictType) {
return request({
url: '/system/dict/data/type/' + dictType,
method: 'get'
})
}
// 新增字典数据
export function addData (data) {
return request({
url: '/system/dict/data/add',
method: 'post',
data: data
})
}
// 修改字典数据
export function updateData (data) {
return request({
url: '/system/dict/data',
method: 'post',
data: data
})
}
// 删除字典数据
export function delData (dictCode) {
return request({
url: '/system/dict/data/remove' + dictCode,
method: 'get'
})
}

27
main.js
View File

@@ -1,3 +1,8 @@
/*
* @Date: 2025-11-03 10:52:09
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-03 12:12:49
*/
import App from '@/App'
import * as Pinia from 'pinia'
import globalFunction from '@/common/globalFunction'
@@ -13,6 +18,10 @@ import SelectPopup from '@/components/selectPopup/selectPopup.vue'
import SelectPopupPlugin from '@/components/selectPopup/selectPopupPlugin';
import RenderJobs from '@/components/renderJobs/renderJobs.vue';
import RenderCompanys from '@/components/renderCompanys/renderCompanys.vue';
import uniIcons from './uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
import uniPopup from './uni_modules/uni-popup/components/uni-popup/uni-popup.vue'
import uniDataSelect from './uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue'
import storeRc from './utilsRc/store/index.js'
// iconfont.css 已在 App.vue 中通过 @import 引入,无需在此处重复引入
// import Tabbar from '@/components/tabbar/midell-box.vue'
// 自动导入 directives 目录下所有指令
@@ -27,6 +36,7 @@ import {
// const foldFeature = window.visualViewport && 'segments' in window.visualViewport
// console.log('是否支持多段屏幕:', foldFeature)
import { getDict } from '@/apiRc/system/dict.js';
// 全局组件
export function createApp() {
const app = createSSRApp(App)
@@ -38,6 +48,21 @@ export function createApp() {
app.component('SelectPopup', SelectPopup)
app.component('RenderJobs', RenderJobs)
app.component('RenderCompanys', RenderCompanys)
app.component('uni-icons', uniIcons)
app.component('uni-popup', uniPopup)
app.component('uni-data-select', uniDataSelect)
app.config.globalProperties.$getDict = getDict;
app.config.globalProperties.$store = storeRc;
app.config.globalProperties.$getDictSelectOption = async (dictType, isDigital = false, forceRefresh = false) => {
const dictData = await getDict(dictType, forceRefresh);
return dictData.map(item => ({
value: isDigital ? Number(item.dictValue || item.dictvalue) : (item.dictValue || item.dictvalue),
label: item.dictLabel || item.dictlabel,
...item
}));
};
// app.component('tabbar-custom', Tabbar)
for (const path in directives) {
@@ -56,6 +81,8 @@ export function createApp() {
app.use(SelectPopupPlugin);
app.use(Pinia.createPinia());
// 注册vuex
app.use(storeRc);
return {
app,

51
package-lock.json generated Normal file
View File

@@ -0,0 +1,51 @@
{
"name": "ks-app-employment-service",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"dependencies": {
"dayjs": "^1.11.19",
"sm-crypto": "^0.3.13"
}
},
"node_modules/dayjs": {
"version": "1.11.19",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz",
"integrity": "sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw=="
},
"node_modules/jsbn": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz",
"integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A=="
},
"node_modules/sm-crypto": {
"version": "0.3.13",
"resolved": "https://registry.npmjs.org/sm-crypto/-/sm-crypto-0.3.13.tgz",
"integrity": "sha512-ztNF+pZq6viCPMA1A6KKu3bgpkmYti5avykRHbcFIdSipFdkVmfUw2CnpM2kBJyppIalqvczLNM3wR8OQ0pT5w==",
"dependencies": {
"jsbn": "^1.1.0"
}
}
},
"dependencies": {
"dayjs": {
"version": "1.11.19",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz",
"integrity": "sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw=="
},
"jsbn": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz",
"integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A=="
},
"sm-crypto": {
"version": "0.3.13",
"resolved": "https://registry.npmjs.org/sm-crypto/-/sm-crypto-0.3.13.tgz",
"integrity": "sha512-ztNF+pZq6viCPMA1A6KKu3bgpkmYti5avykRHbcFIdSipFdkVmfUw2CnpM2kBJyppIalqvczLNM3wR8OQ0pT5w==",
"requires": {
"jsbn": "^1.1.0"
}
}
}
}

6
package.json Normal file
View File

@@ -0,0 +1,6 @@
{
"dependencies": {
"dayjs": "^1.11.19",
"sm-crypto": "^0.3.13"
}
}

View File

@@ -0,0 +1,514 @@
// 获取人员基本信息详情
// import { post, get } from '../../utils/request.js'
// export function getPersonInfo(id) {
// return get({
// url: `personnel/personBaseInfo/${id}`,
// method: 'get'
// })
// }
import request from '@/utilsRc/request'
// 根据 userId 获取企业详情
export function companyDetails(userId) {
return request({
method: 'get',
url: `/company/unitBaseInfo/user/${userId}`,
})
}
// 企业-推荐人员信息
export function recommendedPerson(params) {
return request({
url: '/company/unitBaseInfo/recommend/person',
method: 'get',
params
})
}
// 人员邀请
export function invitePerson(params) {
return request({
url: '/company/unitBaseInfo/invite',
method: 'get',
params
})
}
// 获取企业招聘岗位列表
export function jobList(params) {
return request({
url: '/company/unitPostInfo/list',
method: 'get',
params
})
}
// 查找已投递、已推荐、已邀请的人员信息
export function listMatch(query) {
return request({
url: '/company/unitBaseInfo/relevance',
method: 'get',
params: query
})
}
// 添加企业基本信息
export function addJobBase(data) {
return request({
url: '/company/unitBaseInfo',
method: 'post',
data: data
})
}
// 查询部门下拉树结构
export function deptTreeSelect() {
return request({
url: '/system/center/user/deptTree',
method: 'get'
})
}
// 企业发布招聘岗位
export function addJob(data) {
return request({
url: '/company/unitPostInfo',
method: 'post',
data: data
})
}
// 获取招聘工种列表
export function jobTypeList(params) {
return request({
url: '/basicdata/workType/list',
method: 'get',
params
})
}
// 企业基本信息列表
export function jobBaseList(query) {
return request({
url: '/company/unitBaseInfo/list',
method: 'get',
params: query
})
}
// 获取企业招聘岗位信息详细信息
export function getJob(id) {
return request({
url: `/company/unitPostInfo/${id}`,
method: 'get'
})
}
// 修改企业招聘岗位信息
export function updateJob(data) {
return request({
url: '/company/unitPostInfo',
method: 'put',
data: data
})
}
// 修改企业基本信息
export function updateJobBase(data) {
return request({
url: '/company/unitBaseInfo',
method: 'put',
data: data
})
}
// 查询角色详细
export function getJobService(id) {
return request({
url: '/personnel/personBaseInfo/' + id,
method: 'get'
})
}
// 查询推荐人员、已推荐、已邀请 详情
export function getUnitBaseInfo(id) {
return request({
url: '/manage/personDemand/' + id,
method: 'get'
})
}
// 查询工种列表
export function listJobType(query) {
return request({
url: '/basicdata/workType/list',
method: 'get',
params: query
})
}
// 人员基本信息 - 列表
export function personInfoList(query) {
return request({
url: '/personnel/personBaseInfo/list',
method: 'get',
params: query
})
}
// 获取人员基本信息详情
export function getPersonInfo(id) {
return request({
url: `/personnel/personBaseInfo/${id}`,
method: 'get'
})
}
// 删除人员基本信息
export function delPersonInfo(ids) {
return request({
url: '/personnel/personBaseInfo/' + ids,
method: 'delete'
})
}
// 删除录入人员 公用 type = 1 失业中 2 就业困难 3 离校生 4 其他人员
export function delPersonUser(ids) {
return request({
url: `/personnel/personInputInfo/${ids}`,
method: 'delete',
})
}
// 新增人员基本信息
export function addPersonInfo(data) {
return request({
url: '/personnel/personBaseInfo',
method: 'post',
data: data
})
}
// 修改人员基本信息
export function updatePersonInfo(data) {
return request({
url: '/personnel/personBaseInfo',
method: 'put',
data
})
}
//社区人员审核
export function personInfoAudit(data) {
return request({
url: '/personnel/personBaseInfo/audit',
method: 'post',
data: data
})
}
//记录查看身份证
export function recordLookIdCard(params) {
return request({
url: '/personnel/personBaseInfo/recordLookIdCard',
method: 'get',
params
})
}
/* 失业人员 --------------------------------------------- start */
// 新增失业人员
export function addPersonUnemployed(data) {
return request({
url: '/person/unemployment',
method: 'post',
data
})
}
// 失业人员修改
export function updatePersonUnemployed(data) {
return request({
url: '/person/unemployment',
method: 'put',
data,
})
}
// 失业人员列表
export function unemployment(params) {
return request({
url: '/person/unemployment/list',
method: 'get',
params
})
}
// 失业人员详情
export function unemploymentDetails(id) {
return request({
url: `/person/unemployment/${id}`,
method: 'get',
})
}
// 失业人员删除
export function unemploymentDelete(id) {
return request({
url: `/person/unemployment/${id}`,
method: 'delete',
})
}
/* 失业人员 --------------------------------------------- end */
/* 就业困难人员 --------------------------------------------- start */
// 新增就业困难
export function addPersonDifficult(data) {
return request({
url: '/person/findingEmployment',
method: 'post',
data
})
}
// 修改就业困难
export function updatePersonDifficult(data) {
return request({
url: '/person/findingEmployment',
method: 'put',
data
})
}
// 就业困难列表
export function findingEmployment(params) {
return request({
url: '/person/findingEmployment/list',
method: 'get',
params
})
}
// 就业困难详情
export function findingEmploymentDetails(id) {
return request({
url: `/person/findingEmployment/${id}`,
method: 'get',
})
}
// 就业困难删除
export function findingEmploymentDelete(id) {
return request({
url: `/person/findingEmployment/${id}`,
method: 'delete',
})
}
/* 就业困难人员 --------------------------------------------- end */
/* 离校未就业高校生 --------------------------------------------- start */
// 新增离校未就业高校生
export function addLeaveSchool(data) {
return request({
url: '/person/leavingSchoolInfo',
method: 'post',
data
})
}
// 修改离校未就业高校生
export function updateLeaveSchool(data) {
return request({
url: '/person/leavingSchoolInfo',
method: 'put',
data,
})
}
// 高校未就业列表
export function leavingSchoolInfo(params) {
return request({
url: '/person/leavingSchoolInfo/list',
method: 'get',
params
})
}
// 高校未就业详情
export function leavingSchoolInfoDetails(id) {
return request({
url: `/person/leavingSchoolInfo/${id}`,
method: 'get',
})
}
// 高校未就业删除
export function leavingSchoolInfoDelete(id) {
return request({
url: `/person/leavingSchoolInfo/${id}`,
method: 'delete',
})
}
/* 离校未就业高校生 --------------------------------------------- end */
/* 其他人员 --------------------------------------------- start */
// 新增其他人员
export function addOther(data) {
return request({
url: '/person/other',
method: 'post',
data
})
}
// 其他人员修改
export function updateOther(data) {
return request({
url: '/person/other',
method: 'post',
data,
})
}
// 其他人员列表
export function other(params) {
return request({
url: '/person/other/list',
method: 'get',
params
})
}
// 其他人员详情
export function otherDetails(id) {
return request({
url: `/person/other/${id}`,
method: 'get',
})
}
// 其他人员删除
export function otherDelete(id) {
return request({
url: `/person/other/${id}`,
method: 'delete',
})
}
/* 其他人员 --------------------------------------------- end */
// 需求预警列表
export function personAlertList(params) {
return request({
url: '/manage/personDemand/warningList',
method: 'get',
params
})
}
export function personDealList(params) {
return request({
url: '/manage/personDemand/dealingList',
method: 'get',
params
})
}
// 服务追踪 服务类型/服务id
export function serviceTraceability({
demandType,
id
}) {
return request({
// url: `/system/personRequirementsRecords/serviceTraceability/${demandType}/${id}`,
url: `/timelime/timelime/fwzs/${id}`,
method: 'get',
})
}
// 需求办结
export function requirementCompletion(url, data) {
return request({
url,
method: 'post',
data
})
}
//岗位审核
export function jobAudit(data) {
return request({
url: '/company/unitPostInfo/audit',
method: 'post',
data: data
})
}
//社群 首页未完成数
// export function getPeopleCount() {
// return request({
// url: '/pc/index/getPeopleCount',
// method: 'get',
// })
// }
//社群 首页未完成数
export function getDemandUnfinished() {
return request({
url: '/pc/index/todo',
method: 'get',
})
}
// 删除企业招聘岗位信息
export function delJob(ids) {
return request({
url: '/company/unitPostInfo/' + ids,
method: 'delete'
})
}
// 所在社区列表
export function deptList(params) {
return request({
'url': `/system/center/user/deptList`,
'method': 'get',
params
})
}
// 所在社区列表
export function returnPerson(params) {
return request({
'url': `/personnel/personBaseInfo/returnPerson`,
'method': 'get',
params
})
}
// 根据人的身份证查询人的详细信息
export function getIdNumberInfo(params) {
return request({
'url': `/personnel/personBaseInfo/getIdNumberInfo`,
'method': 'get',
params
})
}

View File

@@ -0,0 +1,15 @@
/*
* @Date: 2025-10-31 11:06:15
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-03 10:28:16
*/
import { post, get } from '../../utils/request.js'
import request from '@/utilsRc/request'
export function listJobType(query) {
return request({
url: '/basicdata/workType/list',
method: 'get',
params: query
})
}

18
packageRc/api/login.js Normal file
View File

@@ -0,0 +1,18 @@
/*
* @Date: 2025-10-31 11:06:15
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-03 12:26:41
*/
import request from '@/utilsRc/request'
// 登录方法
export function login(data) {
return request({
method: 'post',
url: '/personnel/personBaseInfo/loginGrAndQy',
data,
headers: {
isToken: false
}
})
}

View File

@@ -0,0 +1,34 @@
/*
* @Date: 2025-10-31 11:06:15
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-03 10:28:27
*/
// 人员接口
import { post, get } from '../../utils/request.js'
import request from '@/utilsRc/request'
export function getPersonBase(params) {
return request({
url: '/personnel/personBaseInfo/list',
method: 'get',
params
})
}
export function getPersonList(params) {
return request({
url: '/personnel/personBaseInfo/list',
method: 'get',
params
})
}
// 新增角色
export function addInvestigate(data) {
return request({
// url: '//process/processInterview',
url: '//timelime/timelime',
method: 'post',
data: data
})
}

View File

@@ -0,0 +1,52 @@
/*
* @Date: 2025-11-03 08:48:44
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-03 10:28:31
*/
// 查询个人需求信息列表
import { post, get } from '../../utils/request.js'
import request from '@/utilsRc/request'
export function listPersonDemand(query) {
return request({
method: 'get',
url: '/manage/personDemand/list',
params: query
})
}
export function delPersonDemand(id) {
return request({
url: '/manage/personDemand/' + id,
method: 'delete'
})
}
// 查询个人需求信息详细
export function getPersonDemand(id) {
return request({
method: 'get',
url: '/manage/personDemand/' + id,
})
}
// 新增个人需求信息
export function addPersonDemand(data) {
// 确保传递数据前进行日志输出
console.log('addPersonDemand函数接收到的数据:', data);
return request({
url: '/manage/personDemand',
method: 'post', // 修改为大写POST确保请求参数正确传递
data: data
})
}
// 修改个人需求信息
export function updatePersonDemand(data) {
return request({
url: '/manage/personDemand',
method: 'put',
data: data
})
}

View File

@@ -0,0 +1,43 @@
import { post, get } from '../../utils/request.js'
import request from '@/utilsRc/request'
// 登录方法
export function personInfoList(data) {
return request({
method: 'get',
url: '/personnel/personBaseInfo/list',
params: data,
})
}
// 需求预警列表
export function personAlertList(params) {
return request({
method: 'get',
url: '/manage/personDemand/warningList',
params
})
}
//经办人数据获取
export function getJbrInfo() {
return request({
method: 'get',
url: `system/center/user/selectHxjbr`,
method: 'get'
})
}
export function getPersonBase() {
return request({
method: 'get',
url: `system/center/user/selectHxjbr`,
method: 'get'
})
}
export function returnPerson(params) {
return request({
method: 'get',
'url': `/personnel/personBaseInfo/returnPerson`,
params
})
}

View File

@@ -0,0 +1,374 @@
<template>
<view>
<view class="popupAll">
<view class="tabList dispalyF" v-if="!allCheckShow">
<scroll-view scroll-x style="white-space: nowrap;width: calc(100% - 144rpx);margin-left: 32rpx">
<view class="rightView">
<view
@click="getTopActive(newCkeckData[0], index, item)"
:class="
index == newCkeckData[0].activeIndex
? 'popupItem-active tabItem rightView'
: 'popupItem tabItem rightView'
"
v-for="(item, index) in newCkeckData[0] && newCkeckData[0].data"
:key="index"
style="display: inline-block; margin-right: 15rpx;margin-bottom: 0"
>
{{ item.dictLabel }}
</view>
</view>
</scroll-view>
<view class="tabrightBtnOut" @click="allCheckShowChange">
<image
class="tabrightBtn"
src="https://rc.jinan.gov.cn/qcwjyH5/static/images/getMoreCheck.png"
mode=""
></image>
</view>
</view>
<view class="popupListAll" v-if="allCheckShow">
<view
class="popupList"
v-for="(item, index) in newCkeckData"
:key="index"
>
<view class="tabTitle">
{{ item.name }}
</view>
<view
class="dispalyF"
:style="[
{
position: 'sticky',
top: '-2rpx',
zIndex: 1,
flexWrap: 'wrap',
},
]"
>
<template>
<template v-for="(itm, idx) in item.data">
<view :key="idx" v-if="!itm.mode"
@click="getActive(itm, index, idx)"
:class="
idx == item.activeIndex
? 'popupItem-active'
: 'popupItem'
"
style="margin-right: 20rpx"
>
{{ itm.dictLabel }}
</view>
<!-- <view v-if="itm.mode == 'timerange'">
{{itm.start||'开始时间'}} - {{ item.end||'结束时间' }}
</view> -->
</template>
</template>
</view>
</view>
<!-- <view class="search_btn" @click="search">
查询
</view> -->
<view class="bottom-search">
<view class="search-left" @click="clearAll">
清空
</view>
<view class="search-right" @click="search">查询</view>
</view>
<view class="popupPic" @click="close">
<u-icon name="arrow-up"></u-icon>
</view>
</view>
<view class="gropo" v-if="allCheckShow"></view>
</view>
</view>
</template>
<script>
export default {
name: "popupList",
props: {
checkData: {
type: Array,
default: [],
},
},
data() {
return {
newCkeckData: this.checkData,
allCheckShow: false,
params: "",
fijItem: "",
outData: [],
nickName: ''
};
},
watch: {
checkData(newVal) {
this.newCkeckData = newVal;
},
allCheckShow(newVal) {
this.$parent.zctopShow = newVal;
},
},
mounted() {
if (uni.getStorageSync("userInfo")) {
let userInfo = JSON.parse(uni.getStorageSync("userInfo"));
this.nickName = userInfo.userName ? userInfo.userName : "";
}
},
methods: {
allCheckShowChange() {
this.allCheckShow = !this.allCheckShow;
},
search() {
this.allCheckShow = false;
let param = [];
this.$emit('popupSearch', this.newCkeckData)
},
clearAll(){
this.allCheckShow = false;
this.newCkeckData.forEach((item, index) => {
item.activeIndex=0
});
this.$emit('popupSearch', this.newCkeckData)
},
close() {
this.allCheckShow = false;
},
getActive(item, index, idx) {
if(item.checkLogin&&!this.nickName){
uni.showToast({
title: item.noLoginText,
icon: 'none'
})
return
}
this.newCkeckData[index].activeIndex = idx;
},
getTopActive(list, index, item) {
if(item.checkLogin&&!this.nickName){
uni.showToast({
title: item.noLoginText,
icon: 'none'
})
return
}
this.$set(this.newCkeckData[0], "activeIndex", index);
this.search();
},
},
};
</script>
<style lang="scss">
.dispalyF {
display: flex;
align-items: center;
}
.popupAll {
width: 100%;
position: relative;
z-index: 9;
}
.popupListAll {
background: #F2F4F7;
position: relative;
z-index: 99;
width: 100%;
padding-top: 8rpx;
}
.popupList {
background: #F2F4F7;
margin: 0 32rpx;
.tabTitle {
font-family: Source Han Sans;
font-size: 24rpx;
color: #282828;
margin: 16rpx 0;
}
.popupItem {
padding: 0 32rpx;
text-align: center;
background: #fff;
border-radius: 4rpx;
font-family: Source Han Sans;
font-size: 24rpx;
font-feature-settings: "kern" on;
color: #282828;
margin-right: 15rpx;
flex-shrink: 0;
margin-bottom: 20rpx;
line-height: 56rpx;
min-width: 144rpx;
border: 1rpx solid #CAD4E2;
box-sizing: border-box;
}
.popupItem-active {
padding: 0 32rpx;
text-align: center;
background: #1A62CE;
border-radius: 4rpx;
font-family: Source Han Sans;
font-size: 24rpx;
font-feature-settings: "kern" on;
color: #fff;
margin-right: 15rpx;
flex-shrink: 0;
margin-bottom: 20rpx;
line-height: 56rpx;
min-width: 144rpx;
border: 1rpx solid #1A62CE;
box-sizing: border-box;
}
}
.popupPic {
width: 100%;
padding-top: 16rpx;
padding-bottom: 28rpx;
display: flex;
align-items: center;
justify-content: center;
}
.gropo {
position: fixed;
left: 0rpx;
top: 0rpx;
width: 100vw;
height: 100vh;
opacity: 0.6;
background: rgba(0, 0, 0, 0.23);
}
.tabList {
padding: 32rpx 0;
position: relative;
overflow: hidden;
flex-wrap: nowrap;
width: 100%;
z-index: 9;
.tabItem {
line-height: 56rpx;
padding: 0 32rpx;
background: #fff;
border-radius: 4rpx;
font-family: Source Han Sans;
font-size: 24rpx;
font-feature-settings: "kern" on;
color: #282828;
margin-right: 15rpx;
flex-shrink: 0;
min-width: 144rpx;
box-sizing: border-box;
text-align: center;
}
.tabrightBtnOut {
position: absolute;
right: 0;
width: 87rpx;
height: 56rpx;
// background: linear-gradient(270deg, #2A51DF 0%, rgba(66, 110, 230, 0) 100%);
}
.tabrightBtn {
position: absolute;
right: 36rpx;
top: 50%;
transform: translateY(-50%);
width: 32rpx;
height: 32rpx;
z-index: 99;
}
.popupItem {
padding: 0 32rpx;
text-align: center;
background: #fff;
border-radius: 4rpx;
font-family: Source Han Sans;
font-size: 24rpx;
font-feature-settings: "kern" on;
color: #282828;
margin-right: 15rpx;
flex-shrink: 0;
margin-bottom: 20rpx;
line-height: 56rpx;
min-width: 144rpx;
border: 1rpx solid #CAD4E2;
box-sizing: border-box;
}
.popupItem-active {
padding: 0 32rpx;
text-align: center;
background: #1A62CE;
border-radius: 4rpx;
font-family: Source Han Sans;
font-size: 24rpx;
font-feature-settings: "kern" on;
color: #fff;
margin-right: 15rpx;
flex-shrink: 0;
margin-bottom: 20rpx;
line-height: 56rpx;
min-width: 144rpx;
border: 1rpx solid #1A62CE;
box-sizing: border-box;
}
}
.dispalyF {
display: flex;
align-items: center;
}
.rightView :last-child {
margin-right: 100rpx !important;
}
.bottom-search {
margin-top:56rpx;
display: flex;
justify-content: space-between;
align-items: center;
margin: 16rpx 32rpx 0;
.search-left {
font-family: Source Han Sans;
font-size: 28rpx;
font-weight: bold;
line-height: 70rpx;
background: #fff;
color: #3D3D3D;
border-radius: 4rpx;
height: 62rpx;
flex-grow: 1;
text-align: center;
}
.search-right {
margin-right: 30rpx;
width: 472rpx;
line-height: 64rpx;
border-radius: 4rpx;
background: linear-gradient(270deg, #53A0EA 10%, #1A62CE 100%);
font-family: Source Han Sans;
font-size: 28rpx;
font-weight: bold;
margin-left: 24rpx;
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
}
}
</style>

View File

@@ -0,0 +1,130 @@
<template>
<u-popup :show="showExitPopup" @close="closeExitPopup" closeOnClickOverlay>
<view class="exit_popup df_flex df__direction_column ">
<view class="popup-header">
<u-icon name="warning" size="60rpx" color="#E33C3C"></u-icon>
<view class="popup-title">退出登录</view>
</view>
<view class="df_flex df_justify_center name">{{nick || '--'}}</view>
<view class="popup-content">确定要退出当前账号吗</view>
<view class="df_flex">
<u-button class="custom_btn" text="退出登录" @tap="logOut"></u-button>
<u-button class="cancel_btn" text="取 消" @tap="closeExitPopup"></u-button>
</view>
</view>
</u-popup>
</template>
<script>
// import {
// mapGetters
// } from 'vuex'
export default {
name: "exitPopup",
// computed: {
// ...mapGetters(['showExitPopup', 'nick'])
// },
data() {
return {
showExitPopup: false,
nick: ''
}
},
onload() {
this.nick = this.$store.state.user.nick
this.showExitPopup = this.$store.state.user.showExitPopup
},
methods: {
closeExitPopup() {
this.$store.commit('SET_SHOWEXITPOPUP', false)
},
// 退出
logOut() {
this.$store.dispatch('LogOut').then((res) => {
this.closeExitPopup()
uni.navigateTo({
url: '/pages/login/login-one'
})
})
}
}
}
</script>
<style lang="scss" scoped>
.exit_popup {
padding: 48rpx 60rpx 60rpx 60rpx;
background: #ffffff;
border-radius: 24rpx;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.12);
&>view {
width: 100%;
}
.popup-header {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 32rpx;
.popup-title {
margin-top: 16rpx;
font-size: 36rpx;
font-weight: bold;
color: #333333;
}
}
.popup-content {
text-align: center;
font-size: 28rpx;
color: #666666;
margin-bottom: 48rpx;
line-height: 1.5;
display: flex;
justify-content: center;
align-items: center;
}
.name {
margin: 16rpx auto 32rpx auto;
font-size: 32rpx;
font-weight: 500;
color: #333333;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
.custom_btn {
margin: 16rpx;
color: #ffffff;
border: none;
border-radius: 12rpx;
background: linear-gradient(135deg, #E33C3C 0%, #ff4757 100%);
box-shadow: 0 4rpx 12rpx rgba(227, 60, 60, 0.3);
transition: all 0.3s ease;
&:active {
transform: scale(0.95);
box-shadow: 0 2rpx 8rpx rgba(227, 60, 60, 0.4);
}
}
.cancel_btn {
margin: 16rpx;
color: #666666;
border: 2rpx solid #e5e5e5;
border-radius: 12rpx;
background-color: #ffffff;
transition: all 0.3s ease;
&:active {
transform: scale(0.95);
background-color: #f8f9fa;
}
}
}
</style>

View File

@@ -0,0 +1,203 @@
<template>
<view>
<u-popup :show="visible">
<view style="position: relative;height: 100vh;width: 100%;">
<view class="button-area" style="padding: 8vh 32rpx 24rpx 32rpx; margin: 0;border: 0;position: relative;z-index: 2;display: block; top: 10rpx; border-radius: 0;">
<u-input style="margin-bottom: 16px;" v-model="placeInput" @change="getLocations" placeholder="请输入并选择相应地点"></u-input>
<view v-if="checkedMarker&&checkedMarker.name" class="selected">您已选择:{{ checkedMarker.name }}<text v-if="checkedMarker.address">{{ checkedMarker.address }}</text></view>
<view v-for="(item, index) in placeList" :key="index" :label="item.name" :value="item.name" @click="addIcon(item.name)" class="place-list">
<view style="display: flex;justify-content: space-between;">{{ item.name }}
<view style="color: #8492a6; font-size: 13px;width: 50%">{{ item.address }}</view>
</view>
</view>
</view>
<view class="map" id="map"></view>
<view class="button-area">
<view class="btn" @click="cancel"> </view>
<view class="btn save" @click="submitForm"> </view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
//import { jsonp } from "vue-jsonp";
export default {
data() {
return {
map: '',
placeList: [],
placeInput: '',
markerList: [],
checkedMarker: '',
visible: false,
}
},
mounted() {
// this.openDialog();
},
methods: {
submitForm() {
if(this.checkedMarker&&this.checkedMarker.name){
this.$emit('selected', this.checkedMarker)
this.visible = false;
}else{
this.$message.warning('您尚未选择地点!')
}
},
cancel() {
this.visible = false;
if (this.map) {
this.map.removeEventListener('click', this.handleMapClick);
}
},
openDialog() {
this.visible = true;
this.$nextTick(() => {
this.map = new BMapGL.Map("map");
var point = new BMapGL.Point(117.123237,36.657017);
this.map.centerAndZoom(point, 15);
this.map.enableScrollWheelZoom();
var locationCtrl = new BMapGL.LocationControl();
this.map.addControl(locationCtrl)
this.map.addEventListener('click', this.handleMapClick);
})
},
handleMapClick(e) {
const lng = e.latlng.lng;
const lat = e.latlng.lat;
// 逆地理编码
jsonp("https://api.map.baidu.com/reverse_geocoding/v3/", {
ak: "qr93Dm5Ph6Vb4n1aTfvHG9KZkvG8S4YU",
output: "json",
location: `${lat},${lng}`,
}).then(res => {
if (res.status === 0) {
// 清除原有标记
this.removeOverlay();
// 新建标记
const point = new BMapGL.Point(lng, lat);
const marker = new BMapGL.Marker(point);
this.map.addOverlay(marker);
this.markerList = [marker];
// 保存选中信息
this.checkedMarker = {
name: res.result.formatted_address,
address: res.result.sematic_description,
location: { lng, lat }
};
this.$forceUpdate();
}
});
},
getLocations(place) {
jsonp("https://api.map.baidu.com/place/v2/suggestion", {
q: place,
ak: "qr93Dm5Ph6Vb4n1aTfvHG9KZkvG8S4YU",
region: '济南市',
output: "json",
})
.then((json) => {
console.log(json,23423434)
this.placeList = json.result
})
.catch((err) => {
console.log(err);
});
},
addIcon(e) {
let arr = this.placeList.filter(ele => ele.name == e)
if(arr.length){
this.addMaker(arr)
this.clickMaker(arr[0]);
}else{
this.addMaker(JSON.parse(JSON.stringify(this.placeList)))
}
this.placeList = []
},
removeOverlay() {
this.markerList.forEach(ele => {
this.map.removeOverlay(ele)
})
},
addMaker(list) {
this.removeOverlay()
list.forEach((ele, index) => {
let point = new BMapGL.Point(ele.location.lng, ele.location.lat);
if(index == 0){
this.map.centerAndZoom(point, 15)
}
let marker = new BMapGL.Marker(point); // 创建标注
this.map.addOverlay(marker);
let that = this;
this.markerList.push(marker)
marker.addEventListener("click", function(){
that.clickMaker(ele)
});
})
},
clickMaker(e){
this.checkedMarker = e;
this.$forceUpdate();
}
}
}
</script>
<style lang="scss" scoped>
.selected {
margin-bottom: 16px;
position: relative;z-index: 2;
background: #DCE2E9;
border-radius: 8rpx;
padding: 12rpx 24rpx;
}
.map{
width: 100%;
margin-top: 16px;
height: 100%;
position: absolute;
z-index: 1;
left: 0;
top: 0;
}
.button-area{
position: absolute;
z-index: 2;
bottom: 0;
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;
}
}
.place-list{
line-height: 32rpx;
padding: 16rpx 0;
border-bottom: 1px solid #DCE2E9;
}
</style>

View File

@@ -0,0 +1,969 @@
<template>
<view class="page">
<u-navbar
title="帮扶登记"
:autoBack="true"
bgColor="transparent"
leftIconColor="#fff"
:titleStyle="{ color: '#fff' }"
></u-navbar>
<view class="input-outer-part">
<scroll-view scroll-y="true" style="height: calc(100vh - 100px)">
<view class="inner">
<div class="self-form">
<view class="inner-part">
<div class="form-item required">
<label class="form-label">被帮扶对象</label>
<input
v-model="serviceForm.serviceObjectName"
style="border: none; width: 100%; padding: 10px 0;"
placeholder="请输入"
disabled
/>
</div>
<div class="form-item required">
<label class="form-label">帮扶方式</label>
<div class="form-select-wrapper" style="position: relative;">
<!-- 显示区域 -->
<div
class="form-value"
:class="{ 'noValue': !serviceForm.demandType }"
@click="showDemandTypePicker = !showDemandTypePicker"
style="width: 100%; height: 40px; padding: 0 10px; border: 1px solid #e6e6e6; border-radius: 8rpx; background-color: #fff; display: flex; align-items: center; justify-content: space-between; cursor: pointer;"
>
{{ getDemandTypeLabel(serviceForm.demandType) || "请选择" }}
<span class="arrow-down"></span>
</div>
<!-- 选项列表 -->
<div
v-if="showDemandTypePicker"
class="options-list"
style="position: absolute; top: 45px; left: 0; right: 0; background-color: #fff; border: 1px solid #e6e6e6; border-radius: 8rpx; z-index: 1000; max-height: 200px; overflow-y: auto;"
>
<div
v-for="option in demandTypeOptions"
:key="option.value"
@click="selectDemandType(option.value)"
style="padding: 10px; border-bottom: 1px solid #f0f0f0; cursor: pointer;"
>
{{ option.label }}
</div>
</div>
</div>
</div>
<div class="form-item required" v-if="serviceForm.demandType == '4' || serviceForm.demandType == '5'">
<label class="form-label">帮扶时间 <text class="required">*</text></label>
<picker mode="date" :value="serviceForm.practicalSolutionTime" start="1900-01-01" end="2100-12-31" @change="onDateChange">
<view class="date-picker-wrapper" :class="{ noValue: !serviceForm.practicalSolutionTime }">
<view v-if="serviceForm.practicalSolutionTime" class="date-value">{{ serviceForm.practicalSolutionTime }}</view>
<view v-else>请选择</view>
<view class="icon-right"></view>
</view>
</picker>
</div>
<div class="form-item required" v-if="serviceForm.demandType == '4' || serviceForm.demandType == '5'">
<label class="form-label">经办人</label>
<div class="form-select-wrapper">
<el-select
style="width: 100%"
v-model="serviceForm.agentUserId"
placeholder="请选择经办人"
@change="handleAgentChange"
>
<el-option
v-for="item in jingbrList1"
:key="item.userId"
:label="item.nickName"
:value="item.userId"
></el-option>
</el-select>
</div>
</div>
<div class="form-item required" v-if="serviceForm.demandType == '5'">
<label class="form-label">电话沟通结果</label>
<div class="form-value" @click="showPicker('dhgtjg')" :class="{ noValue: !serviceForm.dhgtjg }">
{{ getDhgtjgLabel(serviceForm.dhgtjg) || "请选择" }}
<span class="arrow-down"></span>
</div>
</div>
<div class="form-item required" v-if="serviceForm.demandType == '4' || serviceForm.demandType == '5'">
<label class="form-label">帮扶内容</label>
<div class="date-picker-wrapper" :class="{ noValue: !serviceForm.serviceContent }">
<picker
@change="onServiceContentChange"
:range="serviceContentOptions.map(item => item.label)"
:value="getServiceContentIndex(serviceForm.serviceContent)"
mode="selector"
>
<view class="date-value">
{{ getServiceContentLabel(serviceForm.serviceContent) || "请选择" }}
<span class="arrow-down"></span>
</view>
</picker>
</div>
</div>
</view>
<view class="inner-part">
<div class="form-item required" v-if="serviceForm.demandType == '4' || serviceForm.demandType == '5'">
<label class="form-label">帮扶情况说明</label>
<textarea
v-model="serviceForm.blqksm"
style="width: 100%; border: none; padding: 10px 0; min-height: 100px; resize: none;"
placeholder="请输入"
></textarea>
</div>
</view>
<view class="inner-part">
<div class="form-item required" v-if="serviceForm.demandType == '4' || serviceForm.demandType == '5'">
<label class="form-label">帮扶情况说明</label>
<div class="file-upload-container">
<button class="upload-btn" @click="chooseImages" :disabled="fileList.length >= 6">
+ 添加图片 ({{ fileList.length }}/6)
</button>
<div class="file-list" v-if="fileList.length > 0">
<div v-for="(file, index) in fileList" :key="index" class="file-item">
<image :src="file.url" mode="aspectFill" class="uploaded-image"></image>
<span class="delete-btn" @click="removeImage(index)">删除</span>
</div>
</div>
</div>
</div>
</view>
<view class="inner-part" v-if="serviceForm.demandType == '4' || serviceForm.demandType == '5'">
<div class="form-item">
<label class="form-label">附件</label>
<div style="width: 100%; padding: 10px 0;">
<button @click="triggerFileUpload" style="padding: 8px 16px; background: #f0f0f0; border: none; border-radius: 4px;">
上传附件 (最多6个)
</button>
<!-- 简单的文件列表显示 -->
<div v-if="serviceForm.fileUrl.length > 0" class="file-list">
<div v-for="(file, index) in serviceForm.fileUrl" :key="index" class="file-item">
{{ file.name }}
<span @click="removeFile(index)" style="margin-left: 10px; cursor: pointer; color: #ff4444;">删除</span>
</div>
</div>
</div>
</div>
</view>
</div>
</view>
</scroll-view>
<view class="button-area">
<view class="btn" @click="cancelPage">取消</view>
<view class="btn save" @click="submitServiceForm">保存</view>
</view>
</view>
<!-- 通用选择器 -->
<div v-if="currentPicker" class="datetime-picker-overlay">
<div class="datetime-picker">
<div class="picker-header">
<span @click="cancelPicker" style="padding: 10px;">取消</span>
<span style="font-weight: bold;">{{ getPickerTitle(currentPicker) }}</span>
<span @click="confirmPicker" style="padding: 10px; color: #007AFF;">确定</span>
</div>
<div class="picker-content">
<div v-if="currentPicker === 'practicalSolutionTime'">
<input
type="datetime-local"
v-model="manualDateTime"
style="width: 100%; padding: 15px; box-sizing: border-box;"
/>
</div>
<div v-else class="picker-options">
<div
v-for="option in getPickerOptions(currentPicker)"
:key="option.value"
@click="selectPickerOption(option.value)"
:class="{ 'selected': selectedOption === option.value }"
>
{{ option.label }}
</div>
</div>
</div>
</div>
</div>
</view>
</template>
<script>
import {getJbrInfo} from "../../api/personinfo/index"
import { getDicts } from '@/apiRc/system/dict.js';
export default {
data() {
return {
serviceForm: {
serviceObjectName: '',
userId: '',
demandType: '', // 帮扶方式
practicalSolutionTime: '', // 帮扶时间
agentUserId: '', // 经办人ID
agentUserName: '', // 经办人名称
dhgtjg: '', // 电话沟通结果
serviceContent: '', // 帮扶内容
blqksm: '', // 帮扶情况说明
personStatus: '', // 人员状态
fileUrl: [] // 附件
},
serviceContentMap: {
'1': '就业政策咨询',
'2': '职业指导',
'3': '技能培训',
'4': '岗位推荐',
'5': '创业指导',
'6': '其他'
},
// 帮扶内容选项picker组件需要的格式
serviceContentOptions: [
{ value: '1', label: '就业政策咨询' },
{ value: '2', label: '职业指导' },
{ value: '3', label: '技能培训' },
{ value: '4', label: '岗位推荐' },
{ value: '5', label: '创业指导' },
{ value: '6', label: '其他' }
],
showDemandTypePicker: false, // 控制帮扶方式选择器显示
jingbrList1:[],
currentPicker: null,
selectedOption: '',
manualDateTime: this.formatDateTime(new Date()),
fileList: [], // 初始化文件列表
// 帮扶方式选项 (4: 上门服务, 5: 电话回访)
demandTypeOptions: [
{ value: '4', label: '上门服务' },
{ value: '5', label: '电话回访' }
],
// 经办人选项(模拟数据)
jingbrList: [
{ userId: '1', nickName: '张三' },
{ userId: '2', nickName: '李四' },
{ userId: '3', nickName: '王五' }
],
// 电话沟通结果选项
dhgtjgOptions: [
{ value: '1', label: '已沟通' },
{ value: '2', label: '未接通' },
{ value: '3', label: '拒绝沟通' }
],
// 帮扶内容选项(通过字典获取)
serviceContentOptions: [],
// 人员状态选项(通过字典获取)
personStatusOptions: []
};
},
created(){
this.getJbrInfo11();
// 使用getDicts API获取帮扶内容字典数据
getDicts('qcjy_fwnr').then(res => {
if (res.data && Array.isArray(res.data)) {
// 将字典数据转换为picker组件需要的格式
this.serviceContentOptions = res.data.map(item => ({
value: item.dictValue,
label: item.dictLabel
}));
}
});
// 使用getDicts API获取人员状态字典数据
getDicts('qcjy_ryzt').then(res => {
if (res.data && Array.isArray(res.data)) {
this.personStatusOptions = res.data.map(item => ({
value: item.dictValue,
label: item.dictLabel
}));
}
});
},
onLoad(options) {
if (options.name) {
this.serviceForm.serviceObjectName = options.name;
}
if (options.id) {
this.serviceForm.userId = options.id;
}
},
methods: {
// 选择图片
chooseImages() {
const remainingCount = 6 - this.fileList.length;
if (remainingCount <= 0) {
uni.showToast({ title: '最多只能上传6张图片', icon: 'none' });
return;
}
uni.chooseImage({
count: remainingCount,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
// 添加新选择的图片到列表
res.tempFilePaths.forEach((path, index) => {
this.fileList.push({
url: path,
file: res.tempFiles[index]
});
});
// 更新 serviceForm.fileUrl
this.updateFileUrls();
},
fail: (err) => {
console.error('选择图片失败:', err);
}
});
},
// 移除图片
removeImage(index) {
this.fileList.splice(index, 1);
// 更新 serviceForm.fileUrl
this.updateFileUrls();
},
// 更新文件URL数组
updateFileUrls() {
this.serviceForm.fileUrl = this.fileList.map(file => file.url);
},
async getJbrInfo11(){
const res=await getJbrInfo()
this.jingbrList1=res
},
// 显示选择器
showPicker(type) {
this.currentPicker = type;
if (type !== 'practicalSolutionTime') {
this.selectedOption = this.serviceForm[type] || '';
}
},
// 取消选择器
cancelPicker() {
this.currentPicker = null;
},
// 确认选择器
confirmPicker() {
if (this.currentPicker === 'practicalSolutionTime') {
this.manualConfirmDate();
} else {
this.serviceForm[this.currentPicker] = this.selectedOption;
// 特殊处理经办人,同时保存名称
if (this.currentPicker === 'agentUserId') {
const agent = this.jingbrList1.find(item => item.userId === this.selectedOption);
this.serviceForm.agentUserName = agent ? agent.nickName : '';
}
}
this.currentPicker = null;
},
// 选择选项
selectPickerOption(value) {
this.selectedOption = value;
},
// 获取选择器标题
getPickerTitle(type) {
const titles = {
demandType: '选择帮扶方式',
practicalSolutionTime: '选择帮扶时间',
agentUserId: '选择经办人',
dhgtjg: '选择电话沟通结果',
serviceContent: '选择帮扶内容'
};
return titles[type] || '请选择';
},
// 获取选择器选项
getPickerOptions(type) {
const options = {
demandType: this.demandTypeOptions || [],
agentUserId: this.jingbrList1 && this.jingbrList1.length > 0 ?
this.jingbrList1.map(item => ({ value: item.userId, label: item.nickName })) : [],
dhgtjg: this.dhgtjgOptions || [],
serviceContent: this.serviceContentOptions || []
};
return options[type] || [];
},
// 获取帮扶方式标签
getDemandTypeLabel(value) {
const option = this.demandTypeOptions.find(item => item.value === value);
return option ? option.label : '';
},
// 获取经办人名称
getAgentUserName(userId) {
const agent = this.jingbrList1.find(item => item.userId === userId);
return agent ? agent.nickName : '';
},
// 处理经办人选择变化
handleAgentChange(value) {
if (!value || !this.jingbrList1 || !this.jingbrList1.length) {
this.serviceForm.agentUserName = '';
return;
}
const user = this.jingbrList1.find(item => item.userId === value);
if (user) {
this.serviceForm.agentUserName = user.nickName;
} else {
this.serviceForm.agentUserName = '';
}
},
// 处理帮扶方式选择变化
handleDemandTypeChange(event) {
this.serviceForm.demandType = event.target.value;
},
// 选择帮扶方式
selectDemandType(value) {
this.serviceForm.demandType = value;
this.showDemandTypePicker = false;
},
// 获取电话沟通结果标签
getDhgtjgLabel(value) {
const option = this.dhgtjgOptions.find(item => item.value === value);
return option ? option.label : '';
},
// 获取帮扶内容标签
getServiceContentLabel(value) {
return this.serviceContentMap[value] || '';
},
// 处理帮扶内容选择变化
onServiceContentChange(e) {
const index = e.detail.value;
if (this.serviceContentOptions && this.serviceContentOptions[index]) {
this.serviceForm.serviceContent = this.serviceContentOptions[index].value;
}
},
// 获取帮扶内容当前索引
getServiceContentIndex(value) {
if (!value) return 0;
const index = this.serviceContentOptions.findIndex(item => item.value === value);
return index !== -1 ? index : 0;
},
// 格式化日期时间为YYYY-MM-DDTHH:MM格式datetime-local输入框需要
formatDateTime(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
return `${year}-${month}-${day}T${hours}:${minutes}`;
},
// 日期选择变化处理
onDateChange(e) {
this.serviceForm.practicalSolutionTime = e.detail.value;
},
// 手动确认日期选择
manualConfirmDate() {
// 将datetime-local格式转换为显示格式
const date = new Date(this.manualDateTime);
this.serviceForm.practicalSolutionTime = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')} ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`;
},
// 触发文件上传
triggerFileUpload() {
if (this.serviceForm.fileUrl.length < 6) {
// 模拟添加文件
const mockFiles = ['文档.pdf', '图片.jpg', '表格.xlsx', '报告.docx'];
const randomFile = mockFiles[Math.floor(Math.random() * mockFiles.length)];
this.serviceForm.fileUrl.push({
name: randomFile,
url: `mock-url/${Date.now()}/${randomFile}`
});
} else {
uni.showToast({ title: '最多只能上传6个文件', icon: 'none' });
}
},
// 删除文件
removeFile(index) {
this.serviceForm.fileUrl.splice(index, 1);
},
// 取消页面
cancelPage() {
uni.navigateBack();
},
// 验证表单
validateForm() {
if (!this.serviceForm.serviceObjectName) {
uni.showToast({ title: '请填写被帮扶对象', icon: 'none' });
return false;
}
if (!this.serviceForm.demandType) {
uni.showToast({ title: '请选择帮扶方式', icon: 'none' });
return false;
}
// 如果是上门服务或电话回访,需要验证更多字段
if (this.serviceForm.demandType === '4' || this.serviceForm.demandType === '5') {
if (!this.serviceForm.practicalSolutionTime) {
uni.showToast({ title: '请选择帮扶时间', icon: 'none' });
return false;
}
if (!this.serviceForm.agentUserId) {
uni.showToast({ title: '请选择经办人', icon: 'none' });
return false;
}
if (this.serviceForm.demandType === '5' && !this.serviceForm.dhgtjg) {
uni.showToast({ title: '请选择电话沟通结果', icon: 'none' });
return false;
}
if (!this.serviceForm.serviceContent) {
uni.showToast({ title: '请选择帮扶内容', icon: 'none' });
return false;
}
if (!this.serviceForm.blqksm) {
uni.showToast({ title: '请填写帮扶情况说明', icon: 'none' });
return false;
}
if (!this.serviceForm.personStatus) {
uni.showToast({ title: '请选择人员状态', icon: 'none' });
return false;
}
}
return true;
},
setName(){
this.serviceForm.serviceObjectName = this.name
this.serviceForm.serviceObjectId = this.userId
this.serviceForm.userId = this.userId
this.$forceUpdate();
},
// 提交表单
async submitServiceForm() {
try {
// 验证表单
if (!this.validateForm()) {
return;
}
// 模拟加载状态
uni.showLoading({ title: '保存中...' });
// 准备提交数据
const submitData = {
...this.serviceForm,
// 格式化文件数据
fileUrl: JSON.stringify(this.serviceForm.fileUrl)
};
// 打印提交数据
console.log('提交数据:', submitData);
// 模拟API调用延迟
await new Promise(resolve => setTimeout(resolve, 1000));
uni.showToast({ title: '保存成功', icon: 'success' });
uni.navigateBack();
} catch (error) {
console.error(error);
uni.showToast({ title: '保存失败', icon: 'none' });
} finally {
uni.hideLoading();
}
}
}
};
</script>
<style lang="scss" scoped>
.page {
height: 100vh;
background-color: #eef1f5 !important;
background-image: url("~@/packageRc/static/images/top.png");
background-repeat: no-repeat;
background-size: 100% auto;
}
.input-outer-part {
background: #eef1f5;
padding: 32rpx;
padding-top: 100rpx; /* 增加顶部内边距,防止内容被遮挡 */
position: relative;
top: -80rpx;
border-radius: 32rpx 32rpx 0 0;
}
.inner {
.inner-part {
background: #fff;
padding: 0 32rpx;
border-radius: 16rpx;
margin-bottom: 20rpx;
}
}
.self-form {
// 表单样式
}
/* 表单项目样式 */
.form-item {
display: flex;
align-items: flex-start;
margin-bottom: 20px;
padding-bottom: 15px;
border-bottom: 1px solid #f0f0f0;
}
/* 选择器容器样式 */
.form-select-wrapper {
flex: 1;
padding: 5px 0;
position: relative;
}
.form-select {
width: 100%;
padding: 20rpx;
border: 1px solid #e6e6e6;
border-radius: 8rpx;
font-size: 28rpx;
color: #333;
background-color: #fff;
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
cursor: pointer;
}
.form-select.noValue {
color: #999;
}
.form-select-wrapper::after {
content: '▼';
position: absolute;
right: 30rpx;
top: 50%;
transform: translateY(-50%);
pointer-events: none;
color: #999;
font-size: 20rpx;
}
.form-item.required .form-label::after {
content: '*';
color: #ff4444;
margin-left: 4px;
}
.form-label {
width: 110px;
flex-shrink: 0;
font-size: 14px;
color: #333;
padding: 10px 0;
}
.form-value {
flex: 1;
padding: 10px 0;
font-size: 14px;
color: #666;
display: flex;
justify-content: space-between;
align-items: center;
}
.form-value.noValue {
color: #999;
}
.arrow-down {
font-size: 12px;
color: #A6A6A6;
}
.edit-icon {
font-size: 14px;
color: #A6A6A6;
}
.form-input-wrapper {
flex: 1;
position: relative;
}
.form-input-wrapper input {
width: 100%;
padding: 10px 0;
border: none;
outline: none;
font-size: 14px;
}
.form-input-wrapper .edit-icon {
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
}
/* 单选按钮样式 */
.radio-group {
flex: 1;
display: flex;
flex-wrap: wrap;
padding: 10px 0;
}
.radio-item {
display: flex;
align-items: center;
margin-right: 20px;
margin-bottom: 10px;
cursor: pointer;
}
.radio-item input[type="radio"] {
margin-right: 6px;
}
.radio-label {
font-size: 14px;
color: #666;
}
/* 文件列表样式 */
.file-list {
margin-top: 10px;
}
.file-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 0;
font-size: 14px;
color: #666;
}
/* 文件上传样式 */
.file-upload-container {
width: 100%;
padding: 10px 0;
}
.upload-btn {
padding: 10px 20px;
background-color: #f0f0f0;
border: 1px dashed #ddd;
border-radius: 4px;
color: #666;
margin-bottom: 10px;
width: 100%;
}
.upload-btn:disabled {
opacity: 0.6;
}
.file-list {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.file-item {
position: relative;
width: 100px;
height: 100px;
}
.uploaded-image {
width: 100%;
height: 100%;
border-radius: 4px;
}
.delete-btn {
position: absolute;
top: -8px;
right: -8px;
background-color: #ff4444;
color: white;
width: 20px;
height: 20px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
}
/* 选择器样式 */
.datetime-picker-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 999;
}
.datetime-picker {
background-color: #fff;
border-radius: 12px;
width: 85%;
max-width: 420px;
overflow: hidden;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.picker-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 20px;
border-bottom: 1px solid #f5f5f5;
font-size: 17px;
background-color: #fafafa;
}
.picker-header > span:first-child {
color: #666;
font-size: 16px;
}
.picker-header > span:last-child {
color: #1d64cf;
font-size: 16px;
font-weight: 500;
}
.picker-content {
max-height: 280px;
overflow-y: auto;
}
.picker-options {
padding: 5px 0;
}
.picker-options > div {
padding: 16px 20px;
font-size: 16px;
color: #333;
position: relative;
transition: all 0.2s ease;
display: flex;
align-items: center;
}
.picker-options > div:not(:last-child) {
border-bottom: 1px solid #f8f8f8;
}
.picker-options > div:active {
background-color: #f5f5f5;
}
.picker-options > div.selected {
background-color: #f0f7ff;
color: #1d64cf;
font-weight: 500;
}
/* 添加选中状态的对勾图标 */
.picker-options > div.selected::after {
content: '✓';
position: absolute;
right: 20px;
font-size: 18px;
font-weight: bold;
color: #1d64cf;
}
/* 日期选择器样式 */
.date-picker-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
background-color: #fff;
}
.date-picker-wrapper.noValue {
background-color: #f9f9f9;
}
.date-value {
color: #333;
}
.icon-right {
color: #999;
font-size: 16px;
}
.noValue {
color: #c0c4cc;
}
.button-area {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 24rpx 32rpx;
background: #fff;
display: flex;
box-sizing: border-box;
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
.btn {
line-height: 72rpx;
width: 176rpx;
margin-right: 16rpx;
font-size: 28rpx;
border: 1px solid #b8c5d4;
color: #282828;
text-align: center;
border-radius: 8rpx;
}
.save {
background: linear-gradient(103deg, #1d64cf 0%, #1590d4 99%);
color: #fff;
border: 0;
flex-grow: 1;
}
}
</style>

View File

@@ -0,0 +1,599 @@
<!--
* @Date: 2025-10-16 15:15:47
* @LastEditors: shirlwang
* @LastEditTime: 2025-10-31 14:56:32
-->
<template>
<view>
<!-- @scroll="handleScroll" @scrolltolower="scrollBottom" -->
<scroll-view :scroll-y="true" class="container" style="background-image: url('../../../packageRc/static/pageBg.png');">
<view style="padding: 40rpx 28rpx;">
<view class="kinggang">
<view>
<view class="num-title" style="color: #1A62CE">重点毕业生数</view>
<view>1120</view>
</view>
<text style="color: #B5C1D1;"></text>
<view>
<view class="num-title" style="color: #16ACB7">累计需求数</view>
<view>1120</view>
</view>
<text style="color: #B5C1D1;"></text>
<view>
<view class="num-title" style="color: #6A57D1">累计服务数</view>
<view>1120</view>
</view>
</view>
<view class="trace-line">
<view class="trace">
<view class="title">
<image src="../../../packageRc/static/trace.png"/>
毕业生追踪
</view>
<view style="display: flex;justify-content: space-between;" @click="goPersonalList">
<view>点击查看</view>
<uni-icons color="#639AEB" type="arrow-right" size="16"></uni-icons>
</view>
</view>
<view class="sendManager">
<view class="title">
<image src="../../../packageRc/static/sendManager.png"/>
任务下发管理员
</view>
<view style="display: flex;justify-content: space-between;">
<view>点击查看</view>
<uni-icons color="#DBAA4E" type="arrow-right" size="16"></uni-icons>
</view>
</view>
</view>
<view class="titles">
<view class="title-item active"><view>待办需求预警列表</view></view>
<view> {{jobList1count}}条信息</view>
</view>
<view v-for="(item, index) in jobList1" :key="index" class="job-list">
<view class="title">销售顾问</view>
<view class="info">
待办内容文字示例待办内容文字示例待办内容文字示例待办内容文字示例
</view>
<view class="bottom-line">
<view>发起时间2025-09-24 15:02</view>
<view style="color: #EF7325;">青岛xx公司</view>
</view>
</view>
<view class="titles">
<view class="title-item active"><view>待服务毕业生列表</view></view>
<view> {{jobListcount}} 条信息</view>
</view>
<view v-for="(item, index) in jobList" :key="index" class="person-list">
<view class="top-info">
<image v-if="index%2==0" src="../../../packageRc/static/personIcon.png"/>
<image v-else src="../../../packageRc/static/personIconFe.png"/>
<view class="top-right">
<view class="name-line">
<view class="name">姓名<view class="tag">{{item.name}}</view></view>
<view class="service-status">·未服务</view>
</view>
<view class="info-line" style="display: flex;">
<view style="margin-right: 24rpx;"><text>年龄</text>27</view>
<view><text>服务次数</text>1</view>
</view>
</view>
</view>
<view class="info-line">
<view><text>联系电话</text>152****5488</view>
<view><text>详细地址</text>{{item.xxdz}}</view>
</view>
<view class="services">
<view @click="showReturnReasonPopup(item.id)">退回</view>
<view @click="tiao(item.id,item.name)">服务</view>
</view>
</view>
</view>
</scroll-view>
<!-- 退回原因弹窗 -->
<uni-popup ref="returnReasonPopup" position="center" round>
<view class="popup-content" style="background:rgb(248, 248, 248);">
<textarea
v-model="returnReason"
class="reason-textarea"
placeholder="请输入退回原因"
placeholder-class="placeholder-style"
rows="5"
maxlength="200"
></textarea>
<view class="popup-footer">
<button class="cancel-btn" @click="cancelReturn">取消</button>
<button class="confirm-btn" @click="confirmReturn">确认退回</button>
</view>
</view>
</uni-popup>
</view>
</template>
<script setup>
import { personInfoList,personAlertList } from '../../api/personinfo/index'
import { returnPerson} from '@/packageRc/api/personinfo/index'
import { reactive, inject, watch, ref, onMounted, watchEffect, nextTick } from 'vue';
let activeTab = ref(1)
let activeTitle = ref(1)
let jobList = ref([{},{},{},{},{}])
let jobListcount = ref()
let returnItemData = ref()
let jobList1 = ref([{},{}])
let jobList1count = ref()
// 退回原因弹窗相关
let returnReasonPopup = ref(null)
let returnReason = ref('')
let currentItemIndex = ref(-1)
function goPersonalList() {
console.log('goPersonalList')
uni.navigateTo({
url: '/packageRc/pages/personalList/personalList'
});
}
function back() {
uni.navigateBack({
delta: 1
});
};
onMounted(() => {
getlist();
getlistyujing();
});
async function getlist(){
try {
const res = await personInfoList();
console.log("res", res);
jobList.value = res.rows || [];
jobListcount.value=res.total || 0
} catch (error) {
console.error("获取数据失败:", error);
jobList.value = [];
}
};
async function getlistyujing(){
try {
const res = await personAlertList();
console.log("res", res);
jobList1.value = res.rows || [];
jobList1count.value=res.total || 0
} catch (error) {
console.error("获取数据失败:", error);
jobList1.value = [];
}
};
// 显示退回原因弹窗
function showReturnReasonPopup(dd) {
this.returnItemData.id=dd
console.log("退回")
returnReason.value = ''
// 使用 ref 控制弹窗显示
if (returnReasonPopup.value) {
returnReasonPopup.value.open()
}
}
function tiao(id,name){
console.log('尝试导航到待办详情页面ID:', id);
// 尝试直接使用uni.navigateTo使用正确的格式并传递id参数
uni.navigateTo({
url: `/packageRc/pages/daiban/daibandetail?id=${id}&name=${name}`,
success: function() {
console.log('导航成功');
},
fail: function(err) {
console.error('导航失败:', err);
}
});
}
// 确认退回
function confirmReturn() {
if (!returnReason.value.trim()) {
uni.showToast({
title: '请填写退回原因',
icon: 'none'
})
return
}
const params = {
id: this.returnItemData.id,
opinion: this.returnReason
}
const { code, msg } = returnPerson(params);
if (code == 200) {
this.returnDialog = false;
this.$u.toast(msg);
this.getList(true);
}
// 这里可以添加提交退回原因的API调用
console.log('退回原因:', returnReason.value, '项目索引:', currentItemIndex.value)
// 模拟提交成功
uni.showToast({
title: '退回成功'
})
// 使用 ref 控制弹窗关闭
if (returnReasonPopup.value) {
returnReasonPopup.value.close()
}
}
// 取消退回
function cancelReturn() {
// 使用 ref 控制弹窗关闭
if (returnReasonPopup.value) {
returnReasonPopup.value.close()
}
}
function viewMore() {
// uni.navigateTo({
// url: '/pages/jobList/jobList'
// })
}
</script>
<style lang="less" scoped>
view{box-sizing: border-box;display: block;}
.container{
background-color: #F4F4F4;background-position: top center;background-size: 100% auto;
height: 100vh;
min-width: 100vw;
padding-bottom: 0;
background-repeat: no-repeat;
box-sizing: border-box;
}
.kinggang{
display: flex;
justify-content: space-around;
align-items: center;
padding: 36rpx 32rpx 33rpx 32rpx;
background: #FFFFFF;
border-radius: 16rpx;
border: 3rpx solid #FFFFFF;
margin-bottom: 24rpx;background: linear-gradient(180deg, #EDF4FF 0%, #FFFFFF 52%);
>view{
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
font-weight: bold;
>view{font-size: 50rpx;}
.num-title{
font-size: 28rpx;
margin-top: 16rpx;
font-weight: normal;
}
// text{
// font-size: 28rpx;
// }
}
image{
width: 78rpx;
// margin-bottom: 15rpx;
height: 78rpx;
}
/* 退回原因弹窗样式 */
.popup-content {
background: #FFFF;
border-radius: 24rpx;
padding: 48rpx;
width: 88%;
box-sizing: border-box;
box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.15);
}
.popup-title {
font-size: 36rpx;
font-weight: bold;
color: #282828;
margin-bottom: 36rpx;
text-align: center;
}
.reason-textarea {
width: 100%;
border: 2rpx solid #D8D8D8;
border-radius: 12rpx;
padding: 24rpx;
min-height: 220rpx;
font-size: 30rpx;
color: #333333;
box-sizing: border-box;
background: #FAFAFA;
}
.placeholder-style {
color: #999999;
}
.popup-footer {
display: flex;
justify-content: space-between;
margin-top: 40rpx;
}
.cancel-btn,
.confirm-btn {
flex: 1;
height: 90rpx;
line-height: 90rpx;
border-radius: 16rpx;
font-size: 32rpx;
text-align: center;
margin: 0 15rpx;
font-weight: 500;
}
.cancel-btn {
background: #F8F8F8;
color: #666666;
border: none;
}
.confirm-btn {
background: #1A62CE;
color: #FFFFFF;
border: none;
}
/* 弹窗背景遮罩层样式 */
::v-deep(.uni-popup__wrapper) {
background-color: rgba(0, 0, 0, 0.5);
}
}
.trace-line{
width: 100%;
margin-bottom: 24rpx;
display: flex;
justify-content: space-between;
>view{
padding: 37.5rpx 32rpx;
width: calc(50% - 12rpx);
.title{
font-size: 28rpx;
font-weight: bold;
color: #1D6AD7;
margin-bottom: 16rpx;
display: flex;
image{
width: 46rpx;
height: 46rpx;
margin-right: 11rpx;
}
}
.more{
display: flex;
justify-content: space-between;
}
}
.trace{
color: #2E77DF;
border: 2rpx solid #78ADFF;
background: linear-gradient(0deg, #FFFFFF 1%, #D0E1FF 100%);
box-shadow: inset 0px 4rpx 10rpx 0px rgba(255, 255, 255, 0.302);
.title{
color: #1D6AD7;
}
}
.sendManager{
border: 2rpx solid #FFC34B;
color: #C68412;
box-shadow: inset 0px 4px 10px 0px rgba(255, 255, 255, 0.302);
background: linear-gradient(0deg, #FFFFFF 0%, #FBF4D1 100%);
.title{color: #CE9523;}
}
}
.tabs{
margin-bottom: 29rpx;
border-radius: 16rpx;
display: flex;
background: #fff;
color: #878787;
text-align: center;
width: 100%;
.tab{
width: 50%;
border: 4rpx solid transparent;
border-radius: 16rpx;
line-height: 64rpx;
position: relative;
&.active{
border: 4rpx solid #fff;
color: #fff;
background: linear-gradient(180deg, #79AFFF 1%, #A2B3FE 100%);
box-shadow: 0px 4rpx 10rpx 0px rgba(40, 102, 194, 0.4);
}
}
}
.titles{
display: flex;
margin-bottom: 44rpx;
display: flex;
justify-content: space-between;
.title-item{
font-size: 32rpx;
font-weight: bold;
color: #282828;
margin-right: 32rpx;
position: relative;
>view{
position: relative;
z-index: 2;
padding: 0 16rpx;
}
&.active::after{
content: '';
position: absolute;
z-index: 1;
bottom: -12rpx;
left: 0;
width: 120%;
height: 24rpx;
border-radius: 50px 0px 0px 50px;
background: linear-gradient(90deg, #78AEFF 0%, rgba(120, 174, 255, 0.31) 52%, rgba(24, 116, 255, 0) 100%);
}
}
}
.job-list{
width: 100%;
margin: 0 auto;
color: #333333;
border-radius: 24rpx;
background: #FFFFFF;
padding: 32rpx;
margin-bottom: 24rpx;
position: relative;
.sign{
position: absolute;
font-size: 24rpx;
right: 0;
top: 0;
padding: 4rpx 14rpx;
border: 1rpx solid #EC4827;
background: rgba(227, 79, 49, 0.09);
border-top-right-radius: 24rpx;
border-bottom-left-radius: 24rpx;
color: #EC4827;
}
.top-line{
display: flex;
justify-content: space-between;
font-size: 24rpx;
color: #A2A2A2;
margin-bottom: 16rpx;
.salary{
font-size: 32rpx;
color: #4C6EFB;
font-weight: bold;
}
}
.title{
font-size: 32rpx;
font-weight: bold;
color: #282828;
margin-bottom: 16rpx;
display: flex;
image{
width: 46rpx;
height: 46rpx;
margin-right: 11rpx;
}
}
.info{
font-size: 24rpx;
margin-bottom: 16rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.bottom-line{
display: flex;
justify-content: space-between;
font-size: 24rpx;
color: #A2A2A2;
margin-top: 12rpx;
}
}
.view-more-btn{
padding: 10rpx 56rpx;
background: #FFFFFF;
color: #4C6EFB;
border: 1rpx solid #4C6EFB;
text-align: center;
border-radius: 40rpx;
width: fit-content;
margin: 0 auto;
margin-bottom: 20rpx;
}
.person-list{
padding-top: 32rpx;
margin-bottom: 24rpx;
border-radius: 16rpx;
background: #FFFFFF;
.top-info{
padding: 0 32rpx;
margin-bottom: 24rpx;
display: flex;
image{
width: 86rpx;
height: 86rpx;
margin-right: 19rpx;
display: block;
}
.top-right{
flex-grow: 1;
flex-shrink: 1;
.name-line{
display: flex;
justify-content: space-between;
align-items: center;
.name{
font-size: 32rpx;
display: flex;
margin-right: 15rpx;
margin-bottom: 3rpx;
align-items: center;
.tag{
font-size: 24rpx;
line-height: 32rpx;
padding: 0 12rpx;
margin-left: 15rpx;
border-radius: 4rpx;
background: #4D89E3;
color: #fff;
}
}
.service-status{
color: #E0A61F;
font-weight: bold;
font-size: 26rpx;
}
}
.info-line{
padding: 0;
border: 0;
}
}
}
.info-line{
padding: 0 32rpx 32rpx;
color: #3D3D3D;
border-bottom: 1px solid #E8E8E8;
>view{
text{
color: #8E8E8E;
}
font-size: 26rpx;
}
}
.services{
line-height: 40rpx;
padding: 28rpx 32rpx;
display: flex;
>view{
flex-grow: 1;
font-size: 26rpx;
color: #1A62CE;
text-align: center;
&:first-child{
color: #E04020;
border-right: 1px solid #D8D8D8;
}
}
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,158 @@
<template>
<view class="upload-container">
<u-upload :disabled="disabled" :width="width" :height="height" :fileList="internalFileList" :name="name" :multiple="multiple"
:maxCount="maxCount" @afterRead="handleAfterRead" @delete="handleRemove">
</u-upload>
</view>
</template>
<script>
// import {
// uploadImg
// } from '@/api/company'
import config from '@/config'
// import {
// getToken
// } from '@/utils/auth'
export default {
props: {
maxSize: {
type: Number,
default: 5, // 最大文件大小MB
},
allowedFormats: {
type: Array,
default: () => [], // 允许的文件格式
},
maxImageSize: {
type: Object,
default: () => ({
width: 2048,
height: 2048
}), // 图片最大宽度和高度
},
width: {
type: String,
default: '100rpx', // 默认宽度
},
height: {
type: String,
default: '100rpx', // 默认高度
},
name: {
type: String,
default: 'file', // 默认name字段
},
multiple: {
type: Boolean,
default: false, // 是否允许多选,默认不允许
},
maxCount: {
type: Number,
default: 1, // 默认最大上传数量为1
},
fileList: {
type: Array,
default: () => [], // 默认的文件列表为空
},
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
internalFileList: Array.isArray(this.fileList) ? [...this.fileList] : [], // 内部的文件列表,确保与父组件的同步
};
},
watch: {
// 监听 fileList 的变化,确保内外部数据同步
fileList(newVal) {
this.internalFileList = Array.isArray(newVal) ? [...newVal] : [];
},
},
methods: {
// 新增图片
async handleAfterRead(event) {
let lists = [].concat(event.file);
let fileListLen = this.internalFileList.length;
lists.map((item) => {
this.internalFileList.push({
...item,
status: "uploading",
message: "上传中",
});
});
for (let i = 0; i < lists.length; i++) {
if (this.allowedFormats.length > 0) {
let fileType = lists[i].name.split('.').pop().toLowerCase();
if (!this.allowedFormats.includes(fileType)) {
// this.$emit('error', '不支持的文件格式');
uni.showToast({
title: '不支持的文件格式',
icon: 'none',
});
this.internalFileList.splice(fileListLen, 1);
this.$emit('update', this.internalFileList); // 通知父组件文件列表更新
return;
}
}
const result = await this.uploadFilePromise(lists[i].url);
let item = this.internalFileList[fileListLen];
this.internalFileList.splice(
fileListLen,
1,
Object.assign(item, {
status: "success",
message: "",
data: result,
})
);
fileListLen++;
this.$emit('update', this.internalFileList); // 通知父组件文件列表更新
}
},
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
uni.uploadFile({
url: config.baseUrl + '/system/oss/upload',
filePath: url,
name: "file",
header: {
Authorization: "Bearer " + getToken(),
},
success: (uploadFileRes) => {
let res = JSON.parse(uploadFileRes.data);
resolve(res.data);
},
fail: (err) => {
console.log(err);
},
});
});
},
handleRemove({file, index}) {
this.internalFileList.splice(index, 1); // 从文件列表中移除指定文件
this.$emit('update', this.internalFileList); // 通知父组件文件列表更新
},
},
};
</script>
<style scoped>
.upload-container {
display: flex;
align-items: center;
justify-content: center;
}
.upload-slot {
display: flex;
align-items: center;
justify-content: center;
border: 1px dashed #ccc;
border-radius: 4px;
padding: 20px;
}
</style>

View File

@@ -0,0 +1,439 @@
<!--
* @Date: 2024-10-09 17:07:39
* @LastEditors: lip
* @LastEditTime: 2025-05-07 09:34:25
-->
<template>
<view class="input-outer-part">
<scroll-view scroll-y="true" :style="{height: edit?'calc(100vh - 325rpx)':'calc(100vh - 200rpx)'}">
<view class="inner">
<view class="part-title" style="display: flex;justify-content: space-between;">需求信息
<view v-if="!edit&&formData.id&&formData.currentStatus!=3&&formData.currentStatus!=2" 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="100">
<u-form-item label="姓名" prop="personName" required
v-if="$store.getters.roles.includes('shequn')|| $store.getters.roles.includes('gly')"
>
<view style="width: 100%; margin-left: 30rpx;" @click="openPersonChooser"
:class="{disabledLine: !edit||!canChoosePerson, noValue: !formData.personName}">
{{ formData.personName || '请选择' }}
</view>
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="需求说明" prop="demandDesc">
<u-textarea :disabled="!edit" v-model="formData.demandDesc" placeholder="请输入"></u-textarea>
</u-form-item>
<!-- <u-form-item label="需求标题" prop="demandTitle" required>
<u--textarea :disabled="!edit" v-model="formData.demandTitle" placeholder="请输入"
style="margin-left: 30rpx;"></u--textarea>
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
</u-form-item> -->
<!-- <u-form-item label="是否意向接受援助" prop="isAcceptAssistance" required>
<view style="margin-left: 30rpx;">
<u-radio-group :disabled="!edit" v-model="formData.isAcceptAssistance" placement="row">
<u-radio :customStyle="{marginRight: '16px'}" label="是" name="是"
value="1"></u-radio>
<u-radio :customStyle="{marginRight: '16px'}" label="否" name="否"
value="0"></u-radio>
</u-radio-group>
</view>
</u-form-item> -->
<!-- <u-form-item label="是否接受审批结果" prop="isAcceptApprovalResult" required>
<view style="margin-left: 30rpx;">
<u-radio-group :disabled="!edit" v-model="formData.isAcceptApprovalResult"
placement="row">
<u-radio :customStyle="{marginRight: '16px'}" label="是" name="是"
value="1"></u-radio>
<u-radio :customStyle="{marginRight: '16px'}" label="否" name="否"
value="0"></u-radio>
</u-radio-group>
</view>
</u-form-item> -->
<!-- <u-form-item label="希望解决日期" prop="hopeSolveDate" required>
<view style="width: 100%; margin-left: 30rpx;" @click="showPicker('hopeSolveDate')"
:class="{disabledLine: !edit, noValue: !formData.hopeSolveDate}">
{{ formData.hopeSolveDate||'请选择' }}
</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" ref="uForm" :model="formData"
:rules="rules">
<u-form-item label="需求说明" prop="demandDesc">
<u-textarea :disabled="!edit" v-model="formData.demandDesc" 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.hopeSolveDate" v-model="dates.hopeSolveDate" mode="date"
@confirm="confirmDate('hopeSolveDate', $event)" @cancel="cancelPicker('hopeSolveDate')"></u-datetime-picker>
<choose-person ref="personChooser" @confirm="personNameConfirm" />
<view class="button-area" v-if="edit">
<view class="btn" @click="cancelPage">取消</view>
<view class="btn reset" @click="getDetail(formData.id)">重置</view>
<view class="btn save" @click="saveInfo">保存</view>
</view>
</view>
</template>
<script>
// import {
// getPersonBase
// } from "@/api/person";
// import {
// addAssistService,
// updateAssistService,
// getAssistService
// } from "@/api/needs/assistService";
// import ImageUpload from '@/components/ImageUpload'
// import ChoosePerson from '@/pages/needs/components/choosePerson';
// import dayjs from "dayjs";
export default {
components: {
// ChoosePerson,
// ImageUpload,
},
data() {
return {
fileList: [],
edit: true,
personBase: {},
dates: {},
formData: {
demandDesc: ''
// demandTitle: '',
// isAcceptAssistance: '',
// isAcceptApprovalResult: '',
// personName: '',
},
rules: {
// demandTitle: [{
// required: true,
// message: '请填写需求标题',
// trigger: ['blur', 'change'],
// }, ],
// isAcceptAssistance: [{
// required: true,
// message: '请选择是否意向接受援助',
// trigger: ['blur', 'change'],
// }, ],
// isAcceptApprovalResult: [{
// required: true,
// message: '请选择是否接受审批结果',
// trigger: ['blur', 'change'],
// }, ],
// personName: [{
// required: true,
// message: '请填写姓名',
// trigger: ['blur', 'change'],
// }, ],
// hopeSolveDate: [{
// required: true,
// message: '请选择希望解决日期',
// trigger: ['blur', 'change'],
// }, ],
personName: [{
required: true,
message: '请填写姓名',
trigger: ['blur', 'change'],
}, ],
demandDesc: [{
required: true,
message: '请填写需求说明',
trigger: ['blur', 'change'],
}, ],
},
dict: {},
show: {},
currentCityArr: [],
originalDept: [],
currentCity: '请选择',
bysj: '',
loading: false,
route: {},
canChoosePerson: 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.canChoosePerson) {
this.$refs.personChooser.open();
}
},
personNameConfirm(event) {
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) {
getAssistService(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()
}
},
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() {
try {
// 验证表单
const isValid = await this.$refs.uForm.validate();
console.log(isValid)
if (!isValid) {
throw new Error('请检查必填项填写');
}
// 显示全局加载
this.$showLoading();
// 根据 formData 是否有 id 来决定是更新还是新增
let response;
let successMessage;
if (this.formData.id) {
response = await updateAssistService(this.formData);
successMessage = '修改成功';
} else {
response = await addAssistService(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) {
if(error.length){
this.$u.toast('请填写完整信息!');
}else{
this.$u.toast('系统错误,请联系管理员!');
}
} finally {
// 确保加载页总是会被隐藏
this.$hideLoading();
}
},
// saveInfo() {
// this.$refs.uForm.validate().then(res => {
// if (this.formData.id) {
// updateAssistService(this.formData).then(res => {
// if (res.code == 200) {
// uni.showToast({
// title: '修改成功'
// })
// this.edit = false;
// }
// })
// } else {
// addAssistService(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,133 @@
<template>
<view>
<u-popup :show="showPersonChooser" closeOnClickOverlay @close="showPersonChooser=false">
<view style="padding: 32rpx 32rpx 0">
<u--input @change="searchChange" placeholder="搜索选择人员" v-model="searchPerson"></u--input>
<scroll-view style="height: 500rpx;" :scroll-y="true">
<view v-for="(item, index) in personList" :key="index" :label="item.name" :value="item.name"
@click="bindPerson(item)" class="person-list" :class="{active: activePerson.id == item.id}">
<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>
</view>
</scroll-view>
<view class="button-area">
<view class="btn" @click="showPersonChooser=false">取消</view>
<view class="btn reset" @click="resetData">重置</view>
<view class="btn save" @click="saveInfo">确定</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import {
getPersonList
} from '../../../api/needs/person'
export default {
data() {
return {
showPersonChooser: false,
activePerson: {},
searchPerson: '',
personList: [],
searcher: '',
}
},
mounted() {
this.doSearch()
},
methods: {
open() {
this.showPersonChooser = true;
this.activePerson = {}
},
saveInfo() {
this.$emit('confirm', this.activePerson)
this.showPersonChooser = false
},
searchChange() {
if (this.searcher) {
clearTimeout(this.searcher)
this.doSearch()
} else {
this.doSearch()
}
},
doSearch() {
this.searcher = setTimeout(() => {
getPersonList({
name: this.searchPerson,
pageSize: 100,
pageNum: 1
}).then(res => {
this.personList = res.rows
console.log("人眼",res.row)
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;
}
}
.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;
}
}
</style>

View File

@@ -0,0 +1,636 @@
<!--
* @Date: 2024-10-08 14:29:36
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-03 12:15:15
-->
<template>
<view class="container" style="background-color: #eef1f5;">
<scroll-view scroll-y="true" :style="{height: edit?'calc(90vh - 150px)':'calc(100vh - 144px)'}">
<view class="inner">
<view class="part-title" style="display: flex;justify-content: space-between;">创业需求信息
<view v-if="!edit&&formData.id&&formData.currentStatus!=3" class="btn"
style="font-weight: normal;display: flex;" @click="edit=true">编辑<view class="icon-right"></view></view>
</view>
<view class="inner-part">
<view class="self-form">
<view class="form-item">
<view class="form-label">姓名 <text class="required">*</text></view>
<view v-if="name" style="width: 100%;"
class="disabledLine">
{{ formData.personName || '请选择' }}
</view>
<view v-else style="width: 100%;" @click="openPersonChooser"
:class="{disabledLine: !edit||!canChoosePerson, noValue: !formData.personName}">
{{ formData.personName || '请选择' }}
</view>
<view class="icon-right"></view>
</view>
<view class="form-item">
<view class="form-label">有无场地需求 <text class="required">*</text></view>
<view class="radio-group">
<view
:class="['radio-item', { 'radio-disabled': !edit }]"
@click="formData.ywcdxq = '是'"
v-if="edit">
<view :class="['radio', { 'radio-checked': formData.ywcdxq === '是' }]"></view>
<text></text>
</view>
<view
:class="['radio-item', { 'radio-disabled': !edit }]"
@click="formData.ywcdxq = '否'"
v-if="edit">
<view :class="['radio', { 'radio-checked': formData.ywcdxq === '否' }]"></view>
<text></text>
</view>
<view v-else>{{ formData.ywcdxq }}</view>
</view>
</view>
<view class="form-item">
<view class="form-label">场地面积</view>
<input type="number" :disabled="!edit" v-model="formData.requiredOfficeSpace" placeholder="请输入" :class="['form-input', { 'form-input-disabled': !edit }]"/>
<view class="icon-right"></view>
</view>
<view class="form-item">
<view class="form-label">办公人数</view>
<input type="number" :disabled="!edit" v-model="formData.bgrs" placeholder="请输入" :class="['form-input', { 'form-input-disabled': !edit }]"/>
<view class="icon-right"></view>
</view>
<view class="form-item">
<view class="form-label">办公位置</view>
<input type="text" :disabled="!edit" v-model="formData.bgdd" placeholder="请输入" :class="['form-input', { 'form-input-disabled': !edit }]"/>
<view class="icon-right"></view>
</view>
<view class="form-item">
<view class="form-label">有无创业培训需求 <text class="required">*</text></view>
<view class="radio-group">
<view
:class="['radio-item', { 'radio-disabled': !edit }]"
@click="formData.ywcypxxq = '是'"
v-if="edit">
<view :class="['radio', { 'radio-checked': formData.ywcypxxq === '是' }]"></view>
<text></text>
</view>
<view
:class="['radio-item', { 'radio-disabled': !edit }]"
@click="formData.ywcypxxq = '否'"
v-if="edit">
<view :class="['radio', { 'radio-checked': formData.ywcypxxq === '否' }]"></view>
<text></text>
</view>
<view v-else>{{ formData.ywcypxxq }}</view>
</view>
</view>
<!-- <u-form-item label="是否意向接受创业培训" prop="isInterestedEntrepreneurshipGuidance" required>-->
<!-- <u-radio-group :disabled="!edit" v-model="formData.isInterestedEntrepreneurshipGuidance"-->
<!-- placement="row">-->
<!-- <u-radio :customStyle="{marginRight: '16px'}" label="是" name="是"></u-radio>-->
<!-- <u-radio :customStyle="{marginRight: '16px'}" label="否" name="否"></u-radio>-->
<!-- </u-radio-group>-->
<!-- </u-form-item>-->
<view class="form-item">
<view class="form-label">有无资金需求 <text class="required">*</text></view>
<view class="radio-group">
<view
:class="['radio-item', { 'radio-disabled': !edit }]"
@click="formData.ywzjxq = '是'"
v-if="edit">
<view :class="['radio', { 'radio-checked': formData.ywzjxq === '是' }]"></view>
<text>是</text>
</view>
<view
:class="['radio-item', { 'radio-disabled': !edit }]"
@click="formData.ywzjxq = '否'"
v-if="edit">
<view :class="['radio', { 'radio-checked': formData.ywzjxq === '否' }]"></view>
<text>否</text>
</view>
<view v-else>{{ formData.ywzjxq }}</view>
</view>
</view>
<view class="form-item">
<view class="form-label">需求说明 <text class="required">*</text></view>
<textarea :disabled="!edit" v-model="formData.jobDescription" placeholder="请输入" :class="['form-textarea', { 'form-textarea-disabled': !edit }]"></textarea>
</view>
</view>
</view>
</view>
<!-- <view class="inner" style="margin-top: 32rpx;">-->
<!-- <view class="inner-part">-->
<!-- <u&#45;&#45;form labelPosition="left" class="self-form" labelWidth="110">-->
<!-- <u-form-item label="需求说明" prop="qtxqsm">-->
<!-- <u-textarea :disabled="!edit" v-model="formData.qtxqsm" placeholder="请输入"></u-textarea>-->
<!-- </u-form-item>-->
<!-- </u&#45;&#45;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>
<view class="button-area" v-if="edit">
<view class="btn" @click="cancelPage">取消</view>
<view class="btn reset" @click="formData.id ? getDetail(formData.id) : setDefaultValues()">重置</view>
<view class="btn save" @click="saveInfo">保存</view>
</view>
</view>
</template>
<script>
import {
getPersonBase
} from "@/packageRc/api/personinfo/index";
import {
addPersonDemand,
updatePersonDemand,
getPersonDemand
} from "@/packageRc/api/needs/personDemand";
import ChoosePerson from './choosePerson';
import dayjs from "dayjs";
export default {
components: {
// ChoosePerson,
// ImageUpload
},
props: {
needId: {
type: String,
default: ''
},
name: {
type: String,
default: ''
}
},
data() {
return {
edit: true,
loading: false,
canChoosePerson: false,
formData: {
id: '',
personId: '',
userId: '',
personName: '',
ywcdxq: '',
requiredOfficeSpace: '',
bgrs: '',
bgdd: '',
ywcypxxq: '',
ywzjxq: '',
jobDescription: '',
actualSolveDate: '',
solveDesc: '',
actualSolvePeople: '',
fileUrl: '',
currentStatus: ''
}
}
},
onReady() {
this.$refs.uForm.setRules(this.rules);
},
async created() {
this.loading = true;
// await this.$delay(600)
this.setDefaultValues()
setTimeout(() => {
this.setName()
}, 0);
},
methods: {
cancelPage() {
if (this.formData.id) {
this.edit = false;
this.getDetail(this.formData.id)
} else {
uni.navigateBack()
}
},
setName(){
// 只有在name有值时才设置人员信息
if(this.name) {
this.formData.personName = this.name
this.formData.personId = this.needId
this.formData.userId = this.needId
}
console.log("this",this)
},
openPersonChooser() {
if (this.edit && this.canChoosePerson) {
this.$refs.personChooser.open();
}
},
personNameConfirm(event) {
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.setDefaultValues()
this.getPersonInfo()
if(this.name){
this.formData.personName = this.name
this.formData.personId = this.needId
this.formData.userId = this.needId
}
this.edit = true
},
getDetail(id) {
getPersonDemand(id).then(res => {
this.formData = res.data;
this.edit = false
this.fileList = this.$processFileUrl(this.formData.fileUrl)
})
},
confirmDate(type, e) {
this.show[type] = false;
let date = new Date(e.value)
this.formData[type] =
`${date.getFullYear()}-${(date.getMonth()+1)>9?(date.getMonth()+1):('0'+(date.getMonth()+1))}-${date.getDate()>9?date.getDate():('0'+date.getDate())}`
this.$forceUpdate();
},
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()
}
},
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.serviceRequirementTitle = `${this.formData.personName}_于${dayNew}_提出创业需求`
},
async saveInfo() {
this.setName()
try {
// 验证必填项
if (!this.formData.personName || this.formData.personName.trim() === '') {
uni.showToast({ title: '请选择姓名!', icon: 'none' });
return;
}
if (!this.formData.ywcdxq) {
uni.showToast({ title: '请选择有无场地需求!', icon: 'none' });
return;
}
if (!this.formData.ywcypxxq) {
uni.showToast({ title: '请选择有无创业培训需求!', icon: 'none' });
return;
}
if (!this.formData.ywzjxq) {
uni.showToast({ title: '请选择有无资金需求!', icon: 'none' });
return;
}
if (!this.formData.jobDescription || this.formData.jobDescription.trim() === '') {
uni.showToast({ title: '请填写需求说明!', icon: 'none' });
return;
}
// 显示全局加载
uni.showLoading({ title: '保存中...' });
// 根据 formData 是否有 id 来决定是更新还是新增
let response;
this.formData.demandType = 2;
let successMessage;
if (this.formData.id) {
response = await updatePersonDemand(this.formData);
successMessage = '修改成功';
} else {
response = await addPersonDemand(this.formData);
successMessage = '保存成功';
}
// 检查响应码是否为200
if (response.code === 200) {
uni.showToast({ title: successMessage, icon: 'success' });
// 如果是编辑模式,关闭编辑状态;否则返回上一页
if (this.formData.id) {
this.edit = false;
} else {
// 延迟1秒后返回上一页
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
}
} catch (error) {
console.error('保存失败:', error);
uni.showToast({ title: '系统错误,请联系管理员!', icon: 'none' });
} finally {
// 确保加载页总是会被隐藏
uni.hideLoading();
}
},
// 设置默认选中
setDefaultValues(){
this.$set(this.formData, 'ywcdxq', '是')
this.$set(this.formData, 'ywcypxxq', '是')
this.$set(this.formData, 'isInterestedEntrepreneurshipGuidance', '是')
this.$set(this.formData, 'ywzjxq', '是')
},
// 获取详情数据
async getDetail(id) {
try {
this.loading = true;
const response = await getPersonDemand(id);
if (response.code === 200) {
this.formData = { ...response.data };
}
} catch (error) {
console.error('获取详情失败:', error);
uni.showToast({ title: '获取详情失败', icon: 'none' });
} finally {
this.loading = false;
}
}
// saveInfo() {
// this.$refs.uForm.validate().then(res => {
// if (this.formData.id) {
// updateEntrepreneurshipService(this.formData).then(res => {
// if (res.code == 200) {
// uni.showToast({
// title: '修改成功'
// })
// this.edit = false;
// }
// })
// } else {
// addEntrepreneurshipService(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: #3161c7;
height: 100vh;
background-image: url('https://rc.jinan.gov.cn/qcwjyH5/static/images/top.png');
background-repeat: no-repeat;
background-size: 100% auto;
}
.inner {
background: #eef1f5;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
}
.inner-part {
width: 100%;
}
/* 为表单元素添加一些间距 */
.self-form {
width: 100%;
}
/* 表单项目样式 */
.form-item {
display: flex;
align-items: flex-start;
margin-bottom: 24rpx;
background-color: #fff;
border-radius: 8rpx;
padding: 24rpx;
}
.form-label {
width: 200rpx;
font-size: 28rpx;
color: #333;
flex-shrink: 0;
line-height: 48rpx;
}
.required {
color: #f56c6c;
margin-left: 4rpx;
}
.form-input {
flex: 1;
border: none;
outline: none;
font-size: 28rpx;
color: #333;
background: none;
height: 48rpx;
line-height: 48rpx;
}
.form-input-disabled {
color: #909399;
background-color: #f5f7fa;
}
.form-textarea {
flex: 1;
border: none;
outline: none;
font-size: 28rpx;
color: #333;
background: none;
min-height: 120rpx;
line-height: 40rpx;
}
.form-textarea-disabled {
color: #909399;
background-color: #f5f7fa;
}
.icon-right {
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
color: #A6A6A6;
margin-left: 16rpx;
}
/* 单选框样式 */
.radio-group {
flex: 1;
display: flex;
align-items: center;
}
.radio-item {
display: flex;
align-items: center;
margin-right: 32rpx;
cursor: pointer;
}
.radio-item.radio-disabled {
cursor: not-allowed;
}
.radio {
width: 28rpx;
height: 28rpx;
border-radius: 50%;
border: 2rpx solid #dcdfe6;
margin-right: 12rpx;
position: relative;
}
.radio.radio-checked {
border-color: #409eff;
background-color: #409eff;
}
.radio.radio-checked::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 12rpx;
height: 12rpx;
border-radius: 50%;
background-color: #fff;
}
/* 调整按钮区域样式 */
.button-area {
margin-top: 24rpx;
}
.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,930 @@
<!--
* @Date: 2024-10-08 14:29:36
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-03 12:15:48
-->
<template>
<view class="container" style="background-color: #f7f7f7;">
<scroll-view scroll-y="true" >
<view class="inner">
<view class="part-title" style="display: flex;justify-content: space-between;">求职需求信息
<view v-if="!edit&&formData.id&&formData.currentStatus!=3" class="btn"
style="font-weight: normal;display: flex;" @click="edit=true">编辑<view class="icon-right"></view></view>
</view>
<view class="inner-part">
<view class="self-form">
<view class="form-item">
<view class="form-label">姓名 <text class="required">*</text></view>
<view v-if="name" style="width: 100%;"
class="disabledLine">
{{ formData.personName || '请选择' }}
</view>
<view v-else style="width: 100%;" @click="openPersonChooser"
:class="{disabledLine: !edit||!canChoosePerson, noValue: !formData.personName}">
{{ formData.personName || '请选择' }}
</view>
<view class="icon-right"></view>
</view>
<!-- <u-form-item label="姓名" prop="personName" required>
<u--input :disabled="!edit" v-model="formData.name" border="none"
placeholder="请输入"></u--input>
<view class="icon-right" style="width: 40rpx; height: 40rpx;"></view>
</u-form-item> -->
<!-- <u-form-item label="求职工种" prop="jobWorkType" required>
<view style="width: 100%;" @click="showPicker('jobWorkType')"
:class="{disabledLine: !edit, noValue: !formData.jobWorkTypeName}">
{{ formData.jobWorkTypeName ||'请选择' }}
</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item> -->
<!-- 新增工种选择 -->
<view class="form-item">
<view class="form-label">求职工种</view>
<picker
mode="multiSelector"
:range="workTypeColumns"
range-key="workTypeName"
:value="workTypeIndexes"
@change="onWorkTypePickerChange"
@columnchange="onWorkTypeColumnChange"
v-if="workTypeColumns[0] && workTypeColumns[0].length"
>
<view class="picker-view">
<view class="picker-view-text">{{ formData.jobWorkTypeName || '请选择工种' }}</view>
<view class="icon-right"></view>
</view>
</picker>
<view v-else class="picker-view">
<view class="picker-view-text">工种数据加载中...</view>
</view>
</view>
<!-- <u-form-item label="工种选择" prop="selectedWorkType">
<uni-data-picker
v-model="selectedWorkType"
:localdata="workTypeTreeList"
:popup-title="'请选择工种'"
:clear-icon="false"
:map="{text:'label', value:'id', children:'children'}"
@change="onWorkTypeChange"
:placeholder="'请选择工种'"
:step-searh="false"
:popup="true"
:multiple="false"
:self-field="false"
/>
</u-form-item> -->
<!-- <u-form-item label="希望解决日期" prop="hopeSolveDate" required>
<view style="width: 100%;" @click="showPicker('hopeSolveDate')"
:class="{disabledLine: !edit, noValue: !formData.hopeSolveDate}">
{{ formData.hopeSolveDate||'请选择' }}
</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item> -->
<!-- <u-form-item label="从业年数" prop="emplymentYear" required>
<view style="width: 100%;" @click="showPicker('emplymentYear')"
:class="{disabledLine: !edit, noValue: getDictLabel(formData.emplymentYear, dict.emplymentYear)=='请选择'}">
{{ getDictLabel(formData.emplymentYear, dict.emplymentYear) }}
</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item>
<u-form-item label="工资类型" prop="salaryType" required>
<view style="width: 100%;" @click="showPicker('salaryType')"
:class="{disabledLine: !edit, noValue: getDictLabel(formData.salaryType, dict.salaryType)=='请选择'}">
{{ getDictLabel(formData.salaryType, dict.salaryType) }}
</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item> -->
<view class="form-item">
<view class="form-label">最低薪酬 <text class="required">*</text></view>
<input type="number" :disabled="!edit" v-model="formData.minRecruitmentSalary" placeholder="请输入" :class="['form-input', { 'form-input-disabled': !edit }]"/>
<view class="icon-right" style="width: 40rpx; height: 40rpx;"></view>
</view>
<view class="form-item">
<view class="form-label">最高薪酬 <text class="required">*</text></view>
<input type="number" :disabled="!edit" v-model="formData.highRecruitmentSalary" placeholder="请输入" :class="['form-input', { 'form-input-disabled': !edit }]"/>
<view class="icon-right" style="width: 40rpx; height: 40rpx;"></view>
</view>
<!-- <u-form-item label="单位性质" prop="unitNature" required>
<view style="width: 100%;" @click="showPicker('unitNature')"
:class="{disabledLine: !edit, noValue: getDictLabel(formData.unitNature, dict.unitNature)=='请选择'}">
{{ getDictLabel(formData.unitNature, dict.unitNature) }}
</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: getDictLabel(formData.employmentType, dict.employmentType)=='请选择'}">
{{ getDictLabel(formData.employmentType, dict.employmentType) }}
</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item> -->
<view class="form-item">
<view class="form-label">希望工作地点</view>
<input type="text" placeholder="请输入" v-model="formData.addressDesc" class="form-input ellipsis_1" @focus="$refs.placePicker.openDialog()"/>
</view>
<view class="form-item">
<view class="form-label">求职说明 <text class="required">*</text></view>
<textarea :disabled="!edit" v-model="formData.jobDescription" placeholder="请输入" :class="['form-textarea', { 'form-textarea-disabled': !edit }]"></textarea>
</view>
<!-- <u-form-item label="就业意愿" prop="employmentWillingness">
<view style="width: 100%;" @click="showPicker('employmentWillingness')"
:class="{disabledLine: !edit, noValue: getDictLabel(formData.employmentWillingness, dict.employmentWillingness)=='请选择'}">
{{ getDictLabel(formData.employmentWillingness, dict.employmentWillingness) }}
</view>
<u-icon slot="right" name="arrow-down" color="#A6A6A6"></u-icon>
</u-form-item> -->
</view>
</view>
</view>
<!-- 办理完成后 需求说明 -->
<req-comp :form="{
actualSolveDate: formData.actualSolveDate,
actualSolvePeople: formData.actualSolvePeople,
solveDesc: formData.solveDesc,
fileUrl: formData.fileUrl
}" />
<!-- <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>
<!-- 使用原生picker组件代替uView的选择器 -->
<!-- 工种选择器弹窗 -->
</scroll-view>
<view class="button-area" v-if="edit">
<view class="btn" @click="cancelPage">取消</view>
<view class="btn reset" @click="getDetail(formData.id)">重置</view>
<view class="btn save" @click="saveInfo">保存</view>
</view>
</view>
</template>
<script>
import {
getPersonBase
} from "@/packageRc/api/personinfo/index";
import {
addPersonDemand,
updatePersonDemand,
getPersonDemand
} from "@/packageRc/api/needs/personDemand";
import {
listJobType
} from "@/packageRc/api/jobType/index";
import ImageUpload from './ImageUpload'
import ChoosePerson from './choosePerson';
import 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: {
type: String,
default: ''
},
name: {
type: String,
default: ''
}
},
data() {
return {
edit: true,
personBase: {},
dates: {},
currentCommunityId: '',
showPickerPicker: false,
canChoosePerson: true,
canChoosePerson: true,
formData: {
demandType:"1",
personName: '',
personId:"",
userId:"",
jobWorkType: '',
jobWorkTypeName: '',
selectedWorkType: '',
selectedWorkTypeName: '',
highRecruitmentSalary: '',
minRecruitmentSalary: '',
employmentType: '',
currentCommunity: '',
addressDesc: '',
jobDescription: '',
// fileUrl: []
},
bfnrzd:[],
rules: {
personName: [{
required: true,
message: '请填写姓名',
trigger: ['blur', 'change'],
}],
jobWorkType: [{
required: true,
message: '请选择求职工种',
trigger: ['blur', 'change'],
validator: (rule, value) => {
return (Array.isArray(value) && value.length > 0) || (!!value);
}
}],
highRecruitmentSalary: [{
required: true,
message: '请选择最高薪酬',
trigger: ['blur', 'change'],
}, ],
minRecruitmentSalary: [{
required: true,
message: '请选择最低薪酬',
trigger: ['blur', 'change'],
}, ],
jobDescription: [{
required: true,
message: '请填写求职说明',
trigger: ['blur', 'change'],
}, ]
// employmentType: [{
// required: true,
// message: '请选择用工形式',
// trigger: ['blur', 'change'],
// }, ],
// addressDesc: [{
// required: true,
// message: '请选择希望工作地点',
// trigger: ['blur', 'change'],
// }, ],
},
dict: {
emplymentYear: [],
salaryType: [],
highRecruitmentSalary: [],
minRecruitmentSalary: [],
unitNature: [],
employmentWillingness: []
},
show: {
hopeSolveDate: false,
jobWorkType: false,
emplymentYear: false,
salaryType: false,
highRecruitmentSalary: false,
minRecruitmentSalary: false,
unitNature: false,
employmentType: false,
employmentWillingness: false
},
currentCity: '请选择',
bysj: '',
loading: false,
jobTypeList: [],
route: {},
canChoosePerson: false,
fileList: [],
workTypeList: [],
workTypeColumns: [[], [], []],
workTypeIndexes: [0, 0, 0],
}
},
// 移除uView表单验证相关代码
created() {
getDicts('qcjy_fwnr').then(res => {
this.bfnrzd = res.data;
});
this.setName()
this.loading = true;
let arr = [{
key: 'qcjy_gznx',
prop: 'emplymentYear'
},
{
key: 'qcjy_gzlx',
prop: 'salaryType'
},
{
key: 'qcjy_zgzpgz',
prop: 'highRecruitmentSalary'
},
{
key: 'qcjy_zgzpgz',
prop: 'minRecruitmentSalary'
},
{
key: 'qcjy_dwxz',
prop: 'unitNature'
},
// {
// key: 'qcjy_ygxs',
// prop: 'employmentType'
// },
{
key: 'qcjt_jyyy',
prop: 'employmentWillingness'
},
]
// 使用 Promise.all 确保所有字典数据加载完成
Promise.all(arr.map(ele => this.getDicts(ele.key)))
.then(responses => {
responses.forEach((res, index) => {
this.dict[arr[index].prop] = res.data || [];
});
this.loading = false;
})
.catch(error => {
console.error('加载字典数据失败:', error);
// 设置默认空数组
arr.forEach(ele => {
this.dict[ele.prop] = [];
});
this.loading = false;
});
this.workTypeRemoteMethod('');
},
methods: {
// 获取字典数据
getDicts(dictType) {
return new Promise((resolve, reject) => {
// 这里应该调用实际的API暂时返回空数组
// 如果需要真实的API调用请替换下面的代码
setTimeout(() => {
resolve({ data: [] });
}, 100);
});
},
cancelPage() {
if (this.formData.id) {
this.edit = false;
this.getDetail(this.formData.id)
} else {
uni.navigateBack()
}
},
openPersonChooser() {
if (this.edit && this.canChoosePerson) {
this.$refs.personChooser.open();
}
},
setName(){
// 只有在name有值时才设置人员信息避免覆盖已有数据
if(this.name) {
this.formData.personName = this.name
this.formData.personId = this.needId
this.formData.userId = this.needId
}
},
personNameConfirm(event) {
// this.formData.personName = event.name
this.formData.personId = event.id
this.formData.userId = event.userId
},
changeFile(e) {
// 清空当前的 fileUrl 数组
this.formData.fileUrl = [];
// 如果 e 有长度(即用户选择了文件)
if (e.length) {
// 遍历每个文件对象并获取其 url
for (let data of e) {
const url = data.data ? data.data.url : data.url;
this.formData.fileUrl.push(url);
}
}
this.formData.fileUrl = this.$arrayToString(this.formData.fileUrl)
},
addOne() {
this.formData = {}
this.getPersonInfo()
if(this.name){
this.formData.personName = this.name
this.formData.userId = this.needId
}
this.edit = true
},
getDetail(id) {
getPersonDemand(id).then(res => {
this.formData = res.data;
// 设置工种索引(需要等工种数据加载完成后)
if (this.formData.jobWorkType && this.workTypeColumns[0].length) {
this.setWorkTypeIndexes(this.formData.jobWorkType);
}
this.currentCommunityId = +res.data.currentCommunity
this.formData.currentCommunity = res.data.currentCommunity
this.edit = false;
this.fileList = this.$processFileUrl(this.formData.fileUrl)
}).catch(error => {
console.error('Error fetching job detail:', error);
});
},
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())}`
},
workTypeRemoteMethod(key) {
listJobType({
workTypeName: key,
pageNum: 1,
pageSize: 50
}).then(
(res) => {
console.log('工种数据加载成功:', res.rows);
this.jobTypeList = res.rows;
// 处理树形数据为级联选择器格式
this.processWorkTypeTree(res.rows);
}
).catch(error => {
console.error('获取工种列表失败:', error);
this.workTypeList = [];
this.workTypeColumns = [[], [], []];
});
},
goBack() {
uni.navigateBack();
},
cancelPicker(type) {
this.show[type] = false
},
getCityOptis(data) {
if (data && data[0] && data[0].children) {
return [data].concat(this.getCityOptions(data[0].children))
} else {
return [data]
}
},
getDictLabel(value, list) {
if (list && Array.isArray(list)) {
let arr = list.filter(ele => ele.dictValue == value)
if (arr.length) {
return arr[0].dictLabel || '请选择'
} else {
return '请选择'
}
}
return '请选择'
},
pickerConfirm(type, event) {
this.show[type] = false
this.formData[type] = event.value[0].dictValue
},
jobTypeConfirm(type, event) {
this.show[type] = false
this.formData[type] = event.value[0].id
this.formData.jobWorkTypeName = event.value[0].workTypeName
},
showPicker(type) {
if (this.edit) {
if(type === 'workTypeTree') {
if (!this.workTypeTreeColumns[0] || !this.workTypeTreeColumns[0].length) {
this.$u.toast('工种数据未加载,请稍后重试');
return;
}
// 弹窗打开时初始化临时columns和index
this.tempWorkTypeTreeColumns = JSON.parse(JSON.stringify(this.workTypeTreeColumns));
this.tempWorkTypeTreeIndex = [...this.workTypeTreeIndex];
}
this.show[type] = true;
}
},
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
})
}
})
},
async saveInfo() {
this.setName()
try {
console.log("this.formData.personName",this.formData.personName)
// 先检查求职说明是否为空,如果为空直接提示
if (!this.formData.jobDescription || this.formData.jobDescription.trim() === '') {
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;
}
// 显示全局加载
uni.showLoading({ title: '加载中...' });
this.formData.demandType = 1;
// this.formData.userId = this.formData.personId
// 根据 formData 是否有 id 来决定是更新还是新增
let response;
let successMessage;
if (this.formData.id) {
response = await updatePersonDemand(this.formData);
successMessage = '修改成功';
} else {
response = await addPersonDemand(this.formData);
successMessage = '保存成功';
}
// 检查响应码是否为200
if (response.code === 200) {
uni.showToast({ title: successMessage });
// 如果是编辑模式,关闭编辑状态;否则返回上一页
if (this.formData.id) {
this.edit = false;
} else {
// 延迟1秒后返回
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
}
} catch (error) {
if(error && error.length){
uni.showToast({ title: '请填写完整信息!', icon: 'none' });
} else {
uni.showToast({ title: '系统错误,请联系管理员!', icon: 'none' });
}
}
finally {
// 确保加载页总是会被隐藏
uni.hideLoading();
}
},
popupclosed() {
this.showPickerPicker = false
},
onChange(e) {
const arr = e.detail.value
this.formData.currentCity = arr[0].value || "";
this.formData.currentArea = arr[1].value || "";
this.formData.currentStreet = arr[2].value || "";
this.formData.currentCommunity = arr[3].value + '' || "";
this.$forceUpdate();
},
// 接收地图数据
handleSelected(marker) {
this.$set(this.formData, "addressDesc", marker.address);
this.$set(this.formData, "latitude", marker.location.lat);
this.$set(this.formData, "longitude", marker.location.lng);
},
// 处理树形数据为级联选择器格式
processWorkTypeTree(treeData) {
if (!treeData || !Array.isArray(treeData)) {
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;
columns[1] = level2.filter(item => item.parentId === firstLevelId);
} else {
columns[1] = [];
}
// 根据第二级选择,过滤第三级
if (columns[1].length > 0) {
const secondLevelId = columns[1][0].id;
columns[2] = level3.filter(item => item.parentId === secondLevelId);
} 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 =>
item.level === "2" && item.parentId === selectedLevel1.id
);
this.workTypeColumns[1] = level2;
this.workTypeColumns[2] = [];
newIndexes[1] = 0;
newIndexes[2] = 0;
}
} else if (column === 1) {
// 第二列变化,重置第三列
const selectedLevel2 = this.workTypeColumns[1][value];
if (selectedLevel2) {
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;
this.formData.jobWorkTypeName = `${selectedLevel1.workTypeName}/${selectedLevel2.workTypeName}/${selectedLevel3.workTypeName}`;
} else if (selectedLevel2) {
// 选择第二级
this.formData.jobWorkType = selectedLevel2.id;
this.formData.jobWorkTypeName = `${selectedLevel1.workTypeName}/${selectedLevel2.workTypeName}`;
} else if (selectedLevel1) {
// 选择第一级
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);
if (index !== -1) {
this.workTypeIndexes = [index, 0, 0];
}
} else if (targetWorkType.level === "2") {
// 需要先找到父级
const parent = this.jobTypeList.find(item => item.id == targetWorkType.parentId);
if (parent) {
const parentIndex = this.workTypeColumns[0].findIndex(item => item.id == parent.id);
const childIndex = this.workTypeColumns[1].findIndex(item => item.id == workTypeId);
if (parentIndex !== -1 && childIndex !== -1) {
this.workTypeIndexes = [parentIndex, childIndex, 0];
}
}
} else if (targetWorkType.level === "3") {
// 需要找到祖父级和父级
const parent = this.jobTypeList.find(item => item.id == targetWorkType.parentId);
const grandparent = this.jobTypeList.find(item => item.id == parent.parentId);
if (parent && grandparent) {
const grandparentIndex = this.workTypeColumns[0].findIndex(item => item.id == grandparent.id);
const parentIndex = this.workTypeColumns[1].findIndex(item => item.id == parent.id);
const childIndex = this.workTypeColumns[2].findIndex(item => item.id == workTypeId);
if (grandparentIndex !== -1 && parentIndex !== -1 && childIndex !== -1) {
this.workTypeIndexes = [grandparentIndex, parentIndex, childIndex];
}
}
}
}
}
}
</script>
<style lang="scss">
.page ::v-deep .u-navbar__content {
background-color: transparent !important;
}
.page {
background-color: #3161c7;
height: 100vh;
background-image: url('https://rc.jinan.gov.cn/qcwjyH5/static/images/top.png');
background-repeat: no-repeat;
background-size: 100% auto;
}
.inner {
background: #eef1f5;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
}
.inner-part {
width: 100%;
}
/* 为表单元素添加一些间距 */
.self-form {
width: 100%;
}
/* 表单项目样式 */
.form-item {
display: flex;
align-items: flex-start;
margin-bottom: 24rpx;
background-color: #fff;
border-radius: 8rpx;
padding: 24rpx;
}
.form-label {
width: 200rpx;
font-size: 28rpx;
color: #333;
flex-shrink: 0;
line-height: 48rpx;
}
.required {
color: #f56c6c;
margin-left: 4rpx;
}
.form-input {
flex: 1;
border: none;
outline: none;
font-size: 28rpx;
color: #333;
background: none;
height: 48rpx;
line-height: 48rpx;
}
.form-input-disabled {
color: #909399;
background-color: #f5f7fa;
}
.form-textarea {
flex: 1;
border: none;
outline: none;
font-size: 28rpx;
color: #333;
background: none;
min-height: 120rpx;
line-height: 40rpx;
}
.form-textarea-disabled {
color: #909399;
background-color: #f5f7fa;
}
.icon-right {
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
color: #A6A6A6;
margin-left: 16rpx;
}
.picker-view {
flex: 1;
display: flex;
justify-content: space-between;
align-items: center;
border: none;
outline: none;
font-size: 28rpx;
color: #333;
background: none;
height: 48rpx;
line-height: 48rpx;
}
.picker-view-text {
font-size: 28rpx;
color: #333;
}
/* 按钮区域样式 */
.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;
}
.ellipsis_1 {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 图标样式优化 */
.icon-right {
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
color: #A6A6A6;
margin-left: 16rpx;
}
</style>

View File

@@ -0,0 +1,403 @@
<!--
* @Date: 2024-10-08 14:29:36
* @LastEditors: lip
* @LastEditTime: 2025-05-07 10:03:20
-->
<template>
<view class="container">
<scroll-view scroll-y="true" >
<view class="inner">
<view class="part-title" style="display: flex;justify-content: space-between;">需求信息
<view v-if="!edit&&formData.id&&formData.currentStatus!=3" class="btn"
style="font-weight: normal;display: flex;" @click="edit=true">编辑<view class="icon-right"></view></view>
</view>
<view class="inner-part">
<view class="self-form">
<view class="form-item">
<view class="form-label">姓名 <text class="required">*</text></view>
<view v-if="name" style="width: 100%;" class="disabledLine">
{{ formData.personName || '请选择' }}
</view>
<view v-else style="width: 100%;" @click="openPersonChooser"
:class="{disabledLine: !edit||!canChoosePerson, noValue: !formData.personName}">
{{ formData.personName || '请选择' }}
</view>
<view class="icon-right"></view>
</view>
<view class="form-item">
<view class="form-label">需求说明 <text class="required">*</text></view>
<textarea :disabled="!edit" v-model="formData.jobDescription" placeholder="请输入" :class="['form-textarea', { 'form-textarea-disabled': !edit }]"></textarea>
</view>
</view>
</view>
</view>
<!-- 办理完成后 需求说明 -->
</scroll-view>
<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.id ? getDetail(formData.id) : setDefaultValues()">重置</view>
<view class="btn save" @click="saveInfo">保存</view>
</view>
</view>
</template>
<script>
import { getPersonBase } from "@/packageRc/api/personinfo/index";
import { addPersonDemand, updatePersonDemand, getPersonDemand } from "@/packageRc/api/needs/personDemand";
//import reqComp from './req-comp';
export default {
components: {
// reqComp
},
props: {
needId: {
type: String,
default: ''
},
name: {
type: String,
default: ''
}
},
data() {
return {
edit: true,
canChoosePerson: false,
formData: {
id: '',
personName: '',
personId: '',
demandType:"9",
userId: '',
demandTitle: '',
jobDescription: '',
actualSolveDate: '',
actualSolvePeople: '',
solveDesc: '',
fileUrl: '',
currentStatus: ''
}
}
},
onReady() {
// 组件已准备就绪
},
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 {
this.edit = false;
this.getDetail(this.formData.id);
}
},
// 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();
}
},
personNameConfirm(event) {
this.formData.personName = event.name
this.formData.personId = event.id
this.formData.userId = event.userId
this.$forceUpdate();
},
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);
});
},
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}_提出其他需求`;
},
saveInfo() {
console.log("执行")
try {
// 验证必填项
if (!this.formData.personName) {
uni.showToast({
title: '请选择姓名',
icon: 'none'
});
return;
}
if (!this.formData.jobDescription) {
uni.showToast({
title: '请输入需求说明',
icon: 'none'
});
return;
}
uni.showLoading({
title: '保存中...'
});
this.setName();
let params = {
...this.formData,
type: '3'
};
const requestFn = this.formData.id ? updatePersonDemand : addPersonDemand;
requestFn(params).then(res => {
if (res.code == 200) {
uni.showToast({
title: '保存成功',
icon: 'success'
});
this.edit = false;
if (!this.formData.id) {
this.formData.id = res.data;
}
} else {
uni.showToast({
title: res.message,
icon: 'none'
});
}
}).catch(err => {
if (err.message) {
uni.showToast({
title: err.message,
icon: 'none'
});
}
});
} catch (error) {
console.error('保存失败:', error);
} finally {
uni.hideLoading();
}
}
}
}
</script>
<style lang="scss"> .container {
height: 100vh;
overflow: hidden;
background-color: #f7f7f7;
}
.inner {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
}
.inner-part {
width: 100%;
}
.self-form {
width: 100%;
}
.form-item {
display: flex;
align-items: flex-start;
margin-bottom: 24rpx;
background-color: #fff;
border-radius: 8rpx;
padding: 24rpx;
}
.form-label {
width: 200rpx;
font-size: 28rpx;
color: #333;
flex-shrink: 0;
line-height: 48rpx;
}
.required {
color: #f56c6c;
margin-left: 4rpx;
}
.form-textarea {
flex: 1;
border: none;
outline: none;
font-size: 28rpx;
color: #333;
background: none;
min-height: 120rpx;
line-height: 40rpx;
}
.form-textarea-disabled {
color: #909399;
background-color: #f5f7fa;
}
.icon-right {
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
color: #A6A6A6;
margin-left: 16rpx;
}
.button-area {
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;
}
}
.container {
background-color: #f7f7f7;
}
.inner {
background-color: #f7f7f7;
padding: 24rpx 32rpx;
}
.self-form {
width: 100%;
}
.form-item {
display: flex;
align-items: flex-start;
margin-bottom: 24rpx;
background-color: #fff;
border-radius: 8rpx;
padding: 24rpx;
}
.form-label {
width: 200rpx;
font-size: 28rpx;
color: #333;
flex-shrink: 0;
line-height: 48rpx;
}
.required {
color: #f56c6c;
margin-left: 4rpx;
}
.form-textarea {
flex: 1;
border: none;
outline: none;
font-size: 28rpx;
color: #333;
background: none;
min-height: 120rpx;
line-height: 40rpx;
}
.form-textarea-disabled {
color: #909399;
background-color: #f5f7fa;
}
.icon-right {
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
color: #A6A6A6;
margin-left: 16rpx;
}
.noValue {
color: rgb(192, 196, 204);
}
.disabledLine {
background: rgb(245, 247, 250);
cursor: not-allowed;
}
</style>

View File

@@ -0,0 +1,795 @@
<!--
* @Date: 2024-10-08 14:29:36
* @LastEditors: lip
* @LastEditTime: 2025-05-07 09:33:39
-->
<template>
<view class="container">
<scroll-view scroll-y="true" :style="{height: edit?'calc(90vh - 150px)':'calc(100vh - 144px)', backgroundColor: '#eef1f5'}">
<view class="inner">
<view class="part-title" style="display: flex;justify-content: space-between;">培训需求信息
<view v-if="!edit&&formData.id&&formData.currentStatus!=3" class="btn"
style="font-weight: normal;display: flex;" @click="edit=true">编辑<view class="icon-right"></view></view>
</view>
<view class="inner-part">
<view class="self-form">
<view class="form-item">
<view class="form-label">姓名 <text class="required">*</text></view>
<view v-if="name" style="width: 100%;"
class="disabledLine">
{{ formData.personName || '请选择' }}
</view>
<view v-else style="width: 100%;" @click="openPersonChooser"
:class="{disabledLine: !edit||!canChoosePerson, noValue: !formData.personName}">
{{ formData.personName || '请选择' }}
</view>
<view class="icon-right"></view>
</view>
<view class="form-item">
<view class="form-label">培训意愿工种 <text class="required">*</text></view>
<picker
mode="multiSelector"
:range="workTypeColumns"
range-key="workTypeName"
:value="workTypeIndexes"
@change="onWorkTypePickerChange"
@columnchange="onWorkTypeColumnChange"
v-if="workTypeColumns[0] && workTypeColumns[0].length"
>
<view class="picker-view">
<view class="picker-view-text">{{ formData.qwpxgzName || '请选择工种' }}</view>
<view class="icon-right"></view>
</view>
</picker>
<view v-else class="picker-view">
<view class="picker-view-text">工种数据加载中...</view>
</view>
</view>
<view class="form-item">
<view class="form-label">期望培训时间 <text class="required">*</text></view>
<picker mode="date" :value="formData.qwpxsj" start="1900-01-01" end="2100-12-31" @change="onDateChange">
<view class="date-picker-wrapper" :class="{ noValue: !formData.qwpxsj }">
<view v-if="formData.qwpxsj" class="date-value">{{ formData.qwpxsj }}</view>
<view v-else>请选择</view>
<view class="icon-right"></view>
</view>
</picker>
</view>
<view class="form-item">
<view class="form-label">需求说明 <text class="required">*</text></view>
<textarea :disabled="!edit" v-model="formData.jobDescription" placeholder="请输入" :class="['form-textarea', { 'form-textarea-disabled': !edit }]"></textarea>
</view>
</view>
</view>
</view>
<!-- 办理完成后 需求说明 -->
<req-comp :form="{
actualSolveDate: formData.actualSolveDate,
actualSolvePeople: formData.actualSolvePeople,
solveDesc: formData.solveDesc,
fileUrl: formData.fileUrl
}" />
</scroll-view>
<view class="button-area" v-if="edit">
<view class="btn" @click="cancelPage">取消</view>
<view class="btn reset" @click="getDetail(formData.id)">重置</view>
<view class="btn save" @click="saveInfo">保存</view>
</view>
</view>
</template>
<script>
import { getPersonBase } from "@/packageRc/api/personinfo/index";
import { addPersonDemand, updatePersonDemand, getPersonDemand } from "@/packageRc/api/needs/personDemand";
import { listJobType } from "@/packageRc/api/jobType/index";
import uniDateformat from '@/uni_modules/uni-dateformat/components/uni-dateformat/uni-dateformat.vue';
export default {
components: {
// ChoosePerson
},
props: {
needId: {
type: String,
default: ''
},
name: {
type: String,
default: ''
}
},
data() {
return {
edit: true,
personBase: {},
formData: {
userId:"",
personName:"",
demandType: "3",
personName: '',
personId: "",
userId: "",
demandTitle: '',
qwpxsj: '',
qwpxgz: '',
qwpxgzName: '',
jobDescription: ''
},
rules: {
personName: [{
required: true,
message: '请填写姓名',
trigger: ['blur', 'change'],
}, ],
qwpxgz: [{
required: true,
message: '请选择培训意愿工种',
trigger: ['blur', 'change'],
validator: (rule, value) => {
// 允许数组且有值,或字符串有值
return (Array.isArray(value) && value.length > 0) || (!!value);
}
}, ],
qwpxsj: [{
required: true,
message: '请选择期望培训时间',
trigger: ['blur', 'change'],
}, ],
},
dict: {},
show: {},
currentCityArr: [],
originalDept: [],
currentCity: '请选择',
bysj: '',
loading: false,
jobTypeList: [],
route: {},
canChoosePerson: false,
workTypeTreeList: [],
searchKeyword: '',
workTypeList: [],
workTypeColumns: [[], [], []],
workTypeIndexes: [0, 0, 0],
}
},
onReady() {
this.$refs.uForm.setRules(this.rules)
},
created() {
this.setName();
this.loading = true;
this.workTypeRemoteMethod('');
},
methods: {
setName() {
// 直接设置人员信息
this.formData.personName = this.name;
this.formData.personId = this.needId;
this.formData.userId = this.needId;
// 设置需求标题
if (this.formData.personName) {
const today = new Date();
const year = today.getFullYear();
const month = String(today.getMonth() + 1).padStart(2, '0');
const day = String(today.getDate()).padStart(2, '0');
const formattedDate = `${year}-${month}-${day}`;
this.formData.demandTitle = `${this.formData.personName}_于${formattedDate}_提出培训需求`;
}
},
cancelPage() {
if (this.formData.id) {
this.edit = false;
this.getDetail(this.formData.id)
} else {
uni.navigateBack()
}
},
openPersonChooser() {
if (this.edit && this.canChoosePerson) {
this.$refs.personChooser.open();
}
},
personNameConfirm(event) {
this.formData.personName = event.name
this.formData.personId = event.id
this.formData.userId = event.userId
this.formNameChange();
this.$forceUpdate();
},
// 使用picker组件的日期选择
onDateChange(e) {
this.formData.qwpxsj = e.detail.value;
},
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
},
workTypeRemoteMethod(key) {
listJobType({
workTypeName: key,
pageNum: 1,
pageSize: 50
}).then(
(res) => {
console.log('工种数据加载成功:', res.rows);
this.jobTypeList = res.rows;
// 处理树形数据为级联选择器格式
this.processWorkTypeTree(res.rows);
}
).catch(error => {
console.error('获取工种列表失败:', error);
this.workTypeList = [];
this.workTypeColumns = [[], [], []];
});
},
jobTypeConfirm(type, event) {
this.show[type] = false
this.formData[type] = event.value[0].id
this.formData.qwpxgzName = event.value[0].workTypeName
this.$forceUpdate();
},
getDetail(id) {
getPersonDemand(id).then(res => {
this.formData = res.data;
// 设置工种索引(需要等工种数据加载完成后)
if (this.formData.qwpxgz && this.workTypeColumns[0].length) {
this.setWorkTypeIndexes(this.formData.qwpxgz);
}
this.edit = false;
}).catch(error => {
console.error('Error fetching training detail:', error);
});
},
goBack() {
uni.navigateBack();
},
cancelPicker(type) {
this.$set(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()
}
},
getPersonInfo() {
this.loading = true;
this.$store.dispatch("GetInfo").then((res) => {
if (res.data.roles.indexOf('qunzhong') == -1) {
this.canChoosePerson = true;
this.setName() // 确保非群众角色也能获取姓名
} else {
this.canChoosePerson = false;
getPersonBase(res.data.user.userId).then(resp => {
this.formData.personId = resp.data.id
this.formData.userId = resp.data.userId
this.formData.personName = resp.data.name
this.formNameChange();
this.$forceUpdate();
})
}
})
},
setName() {
this.formData.personName = this.name;
this.formData.personId = this.needId;
this.formData.userId = this.needId;
let date = new Date();
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const dayNew = `${year}-${month}-${day}`;
this.formData.demandTitle = `${this.formData.personName}_于${dayNew}_提出培训需求`;
},
async saveInfo() {
try {
this.setName();
console.log("执行保存,表单数据:", this.formData);
console.log("personName:", this.formData.personName);
console.log("personId:", this.formData.personId);
console.log("userId:", this.formData.userId);
// 手动检查培训意愿工种是否已选择
if (!this.formData.qwpxgz || (typeof this.formData.qwpxgz === 'string' && this.formData.qwpxgz.trim() === '')) {
uni.showToast({
title: '请选择培训意愿工种!',
icon: 'none'
});
return;
}
// 手动检查期望培训时间是否已选择
if (!this.formData.qwpxsj || (typeof this.formData.qwpxsj === 'string' && this.formData.qwpxsj.trim() === '')) {
uni.showToast({
title: '请选择期望培训时间!',
icon: 'none'
});
return;
}
// 表单字段已通过手动检查,无需额外验证
uni.showLoading({
title: '加载中...'
});
let response;
let successMessage;
this.formData.demandType = 3;
if (this.formData.id) {
response = await updatePersonDemand(this.formData);
successMessage = '修改成功';
} else {
response = await addPersonDemand(this.formData);
successMessage = '保存成功';
}
// 检查响应码是否为200
if (response.code === 200) {
uni.showToast({
title: successMessage,
icon: 'success'
});
// 如果是编辑模式,关闭编辑状态;否则返回上一页
if (this.formData.id) {
this.edit = false;
} else {
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
} else {
// 响应码不为200时显示服务器返回的错误信息或默认错误信息
uni.showToast({
title: response.msg || '操作失败,请重试!',
icon: 'none'
});
}
} catch (error) {
console.error('保存失败:', error);
// 检查错误是否为字符串类型或有特定消息
if(typeof error === 'string' || (error && error.message && error.message.includes('请检查'))){
uni.showToast({
title: '请填写完整信息!',
icon: 'none'
});
} else {
uni.showToast({
title: '系统错误,请联系管理员!',
icon: 'none'
});
}
} finally {
// 确保加载页总是会被隐藏
uni.hideLoading();
}
},
// getWorkTypeTree() {
// listJobType({
// workTypeName: '',
// pageNum: 1,
// pageSize: 9999
// }).then(res => {
// console.log("11111",this.workTypeTreeList)
// this.workTypeTreeList = Array.isArray(res.rows) ? res.rows : [];
// });
// },
// 处理树形数据为级联选择器格式
processWorkTypeTree(treeData) {
if (!treeData || !Array.isArray(treeData)) {
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;
columns[1] = level2.filter(item => item.parentId === firstLevelId);
} else {
columns[1] = [];
}
// 根据第二级选择,过滤第三级
if (columns[1].length > 0) {
const secondLevelId = columns[1][0].id;
columns[2] = level3.filter(item => item.parentId === secondLevelId);
} 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 =>
item.level === "2" && item.parentId === selectedLevel1.id
);
this.workTypeColumns[1] = level2;
this.workTypeColumns[2] = [];
newIndexes[1] = 0;
newIndexes[2] = 0;
}
} else if (column === 1) {
// 第二列变化,重置第三列
const selectedLevel2 = this.workTypeColumns[1][value];
if (selectedLevel2) {
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.qwpxgz = selectedLevel3.id;
this.formData.qwpxgzName = `${selectedLevel1.workTypeName}/${selectedLevel2.workTypeName}/${selectedLevel3.workTypeName}`;
} else if (selectedLevel2) {
// 选择第二级
this.formData.qwpxgz = selectedLevel2.id;
this.formData.qwpxgzName = `${selectedLevel1.workTypeName}/${selectedLevel2.workTypeName}`;
} else if (selectedLevel1) {
// 选择第一级
this.formData.qwpxgz = selectedLevel1.id;
this.formData.qwpxgzName = selectedLevel1.workTypeName;
}
this.workTypeIndexes = indexes;
// 强制重新渲染组件
this.$forceUpdate();
},
// 根据工种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);
if (index !== -1) {
this.workTypeIndexes = [index, 0, 0];
}
} else if (targetWorkType.level === "2") {
// 需要先找到父级
const parent = this.jobTypeList.find(item => item.id == targetWorkType.parentId);
if (parent) {
const parentIndex = this.workTypeColumns[0].findIndex(item => item.id == parent.id);
const childIndex = this.workTypeColumns[1].findIndex(item => item.id == workTypeId);
if (parentIndex !== -1 && childIndex !== -1) {
this.workTypeIndexes = [parentIndex, childIndex, 0];
}
}
} else if (targetWorkType.level === "3") {
// 需要找到祖父级和父级
const parent = this.jobTypeList.find(item => item.id == targetWorkType.parentId);
const grandparent = this.jobTypeList.find(item => item.id == parent.parentId);
if (parent && grandparent) {
const grandparentIndex = this.workTypeColumns[0].findIndex(item => item.id == grandparent.id);
const parentIndex = this.workTypeColumns[1].findIndex(item => item.id == parent.id);
const childIndex = this.workTypeColumns[2].findIndex(item => item.id == workTypeId);
if (grandparentIndex !== -1 && parentIndex !== -1 && childIndex !== -1) {
this.workTypeIndexes = [grandparentIndex, parentIndex, childIndex];
}
}
}
},
}
}
</script>
<style lang="scss">
.date-picker-wrapper {
width: 100%;
padding: 10px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
border: 1px solid #ddd;
border-radius: 4px;
}
.date-picker-wrapper.noValue {
color: #999;
}
.date-value {
color: #333;
}
.page ::v-deep .u-navbar__content {
background-color: transparent !important;
}
.container {
height: 100vh;
overflow: hidden;
background-color: #f7f7f7;
}
.page {
background-color: #3161c7;
height: 100vh;
background-image: url('https://rc.jinan.gov.cn/qcwjyH5/static/images/top.png');
background-repeat: no-repeat;
background-size: 100% auto;
}
.inner {
background: #eef1f5;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
}
.inner-part {
width: 100%;
}
/* 为表单元素添加一些间距 */
.self-form {
width: 100%;
}
/* 表单项目样式 */
.form-item {
display: flex;
align-items: flex-start;
margin-bottom: 24rpx;
background-color: #fff;
border-radius: 8rpx;
padding: 24rpx;
}
.form-label {
width: 200rpx;
font-size: 28rpx;
color: #333;
flex-shrink: 0;
line-height: 48rpx;
}
.required {
color: #f56c6c;
margin-left: 4rpx;
}
.form-input {
flex: 1;
border: none;
outline: none;
font-size: 28rpx;
color: #333;
background: none;
height: 48rpx;
line-height: 48rpx;
}
.form-input-disabled {
color: #909399;
background-color: #f5f7fa;
}
.form-textarea {
flex: 1;
border: none;
outline: none;
font-size: 28rpx;
color: #333;
background: none;
min-height: 120rpx;
line-height: 40rpx;
}
.form-textarea-disabled {
color: #909399;
background-color: #f5f7fa;
}
.icon-right {
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
color: #A6A6A6;
margin-left: 16rpx;
}
/* 单选框样式 */
.radio-group {
flex: 1;
display: flex;
align-items: center;
}
.radio-item {
display: flex;
align-items: center;
margin-right: 32rpx;
cursor: pointer;
}
.radio-item.radio-disabled {
cursor: not-allowed;
}
.radio {
width: 28rpx;
height: 28rpx;
border-radius: 50%;
border: 2rpx solid #dcdfe6;
margin-right: 12rpx;
position: relative;
}
.radio.radio-checked {
border-color: #409eff;
background-color: #409eff;
}
.radio.radio-checked::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 12rpx;
height: 12rpx;
border-radius: 50%;
background-color: #fff;
}
/* 调整按钮区域样式 */
.button-area {
margin-top: 24rpx;
}
.picker-cover {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 99;
}
.button-area {
padding: 24rpx 32rpx 68rpx;
width: calc(100% + 64rpx);
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;
}
.bordered {
border: 1rpx solid #dadbde;
padding: 9px;
border-radius: 4px;
}
.picker-view {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
}
.picker-view-text {
color: #333333;
flex: 1;
text-align: left; font-size: 28rpx;
flex: 1;
}
</style>

View File

@@ -0,0 +1,59 @@
export default {
props: {
// 内置图标名称,或图片路径,建议绝对路径
icon: {
type: String,
default: uni.$u.props.empty.icon
},
// 提示文字
text: {
type: String,
default: uni.$u.props.empty.text
},
// 文字颜色
textColor: {
type: String,
default: uni.$u.props.empty.textColor
},
// 文字大小
textSize: {
type: [String, Number],
default: uni.$u.props.empty.textSize
},
// 图标的颜色
iconColor: {
type: String,
default: uni.$u.props.empty.iconColor
},
// 图标的大小
iconSize: {
type: [String, Number],
default: uni.$u.props.empty.iconSize
},
// 选择预置的图标类型
mode: {
type: String,
default: uni.$u.props.empty.mode
},
// 图标宽度单位px
width: {
type: [String, Number],
default: uni.$u.props.empty.width
},
// 图标高度单位px
height: {
type: [String, Number],
default: uni.$u.props.empty.height
},
// 是否显示组件
show: {
type: Boolean,
default: uni.$u.props.empty.show
},
// 组件距离上一个元素之间的距离默认px单位
marginTop: {
type: [String, Number],
default: uni.$u.props.empty.marginTop
}
}
}

View File

@@ -0,0 +1,128 @@
<template>
<view
class="u-empty"
:style="[emptyStyle]"
v-if="show"
>
<u-icon
v-if="!isSrc"
:name="mode === 'message' ? 'chat' : `empty-${mode}`"
:size="iconSize"
:color="iconColor"
margin-top="14"
></u-icon>
<image
v-else
:style="{
width: $u.addUnit(width),
height: $u.addUnit(height),
}"
:src="icon"
mode="widthFix"
></image>
<text
class="u-empty__text"
:style="[textStyle]"
>{{text ? text : icons[mode]}}</text>
<view class="u-empty__wrap" v-if="$slots.default || $slots.$default">
<slot />
</view>
</view>
</template>
<script>
import props from './props.js';
/**
* empty 内容为空
* @description 该组件用于需要加载内容,但是加载的第一页数据就为空,提示一个"没有内容"的场景, 我们精心挑选了十几个场景的图标,方便您使用。
* @tutorial https://www.uviewui.com/components/empty.html
* @property {String} icon 内置图标名称,或图片路径,建议绝对路径
* @property {String} text 提示文字
* @property {String} textColor 文字颜色 (默认 '#c0c4cc' )
* @property {String | Number} textSize 文字大小 (默认 14
* @property {String} iconColor 图标的颜色 (默认 '#c0c4cc'
* @property {String | Number} iconSize 图标的大小 (默认 90
* @property {String} mode 选择预置的图标类型 (默认 'data'
* @property {String | Number} width 图标宽度单位px (默认 160
* @property {String | Number} height 图标高度单位px (默认 160
* @property {Boolean} show 是否显示组件 (默认 true
* @property {String | Number} marginTop 组件距离上一个元素之间的距离默认px单位 (默认 0
* @property {Object} customStyle 定义需要用到的外部样式
*
* @event {Function} click 点击组件时触发
* @event {Function} close 点击关闭按钮时触发
* @example <u-empty text="所谓伊人,在水一方" mode="list"></u-empty>
*/
export default {
name: "u-empty",
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
data() {
return {
icons: {
car: '购物车为空',
page: '页面不存在',
search: '没有搜索结果',
address: '没有收货地址',
wifi: '没有WiFi',
order: '订单为空',
coupon: '没有优惠券',
favor: '暂无收藏',
permission: '无权限',
history: '无历史记录',
news: '无新闻列表',
message: '消息列表为空',
list: '列表为空',
data: '数据为空',
comment: '暂无评论',
}
}
},
computed: {
// 组件样式
emptyStyle() {
const style = {}
style.marginTop = uni.$u.addUnit(this.marginTop)
// 合并customStyle样式此参数通过mixin中的props传递
return uni.$u.deepMerge(uni.$u.addStyle(this.customStyle), style)
},
// 文本样式
textStyle() {
const style = {}
style.color = this.textColor
style.fontSize = uni.$u.addUnit(this.textSize)
return style
},
// 判断icon是否图片路径
isSrc() {
return this.icon.indexOf('/') >= 0
}
}
}
</script>
<style lang="scss" scoped>
@import '@/uni_modules/uview-ui/libs/css/components.scss';
$u-empty-text-margin-top:20rpx !default;
$u-empty-slot-margin-top:20rpx !default;
.u-empty {
@include flex;
flex-direction: column;
justify-content: center;
align-items: center;
&__text {
@include flex;
justify-content: center;
align-items: center;
margin-top: $u-empty-text-margin-top;
}
}
.u-slot-wrap {
@include flex;
justify-content: center;
align-items: center;
margin-top:$u-empty-slot-margin-top;
}
</style>

View File

@@ -0,0 +1,196 @@
<!--
* @Date: 2024-10-08 14:29:36
* @LastEditors: lip
* @LastEditTime: 2025-05-06 15:18:11
-->
<template>
<view class="page">
<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 class="tab-list" v-if="showTab != 1">
<view class="tab" :class="{active: activeType == 1}" @click="canChangeType ? changeType(1) : ''">求职<br>需求
</view>
<view class="tab" :class="{active: activeType == 3}" @click="canChangeType ? changeType(3) : ''">创业<br>需求
</view>
<view class="tab" :class="{active: activeType == 4}" @click="canChangeType ? changeType(4) : ''">培训<br>需求
</view>
<view class="tab" :class="{active: activeType == 5}" @click="canChangeType ? changeType(5) : ''">其他<br>需求
</view>
</view>
<jobService v-if="activeType == 1" :needId="id" :name="name" ref="type1" />
<assistService v-if="activeType == 2" :needId="id" :name="name" ref="type2" />
<entrepreneurshipService :needId="id" :name="name" v-if="activeType == 3" ref="type3" />
<trainService v-if="activeType == 4" :needId="id" :name="name" ref="type4" />
<otherService v-if="activeType == 5" :needId="id" :name="name" ref="type5" />
<!-- 社区端 - 显示隐藏退出组件 -->
<exitPopup />
</view>
</template>
<script>
import jobService from './components/jobService.vue';
import assistService from './components/assistService.vue';
import entrepreneurshipService from './components/entrepreneurshipService.vue';
import trainService from './components/trainService.vue';
import otherService from './components/otherService.vue';
export default {
components: {
jobService,
assistService,
entrepreneurshipService,
trainService,
otherService,
},
data() {
return {
isAdd: true,
activeType: 1,
canChangeType: true,
id: '',
name:"",
}
},
onLoad(options) {
this.showTab = options.showTab
this.id = options.id
console.log("this.id",this.id)
this.name = options.name
if (options.id && options.type) {
this.isAdd = false
this.activeType = options.type
this.canChangeType = false;
this.$nextTick(() => {
this.$refs['type' + options.type].getDetail(options.id)
})
} else {
// 添加需求的时候根据传入的类型 判断对应的表单
this.changeType(options.activeType || 1)
}
},
methods: {
changeType(type) {
this.activeType = type
this.$nextTick(() => {
this.$refs['type' + type].addOne()
})
},
goBack() {
uni.navigateBack();
},
}
}
</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;
}
.tab-list {
display: flex;
width: calc(100% - 64rpx);
margin: 16rpx auto 30rpx;
text-align: center;
border-radius: 16rpx;
background: #fff;
;
.tab {
width: 25%;
display: flex;
align-items: center;
justify-content: center;
border: 4rpx solid #FFFFFF;
background: #fff;
border-radius: 16rpx;
font-size: 28rpx;
color: #878787;
height: 106rpx;
&.active {
background: #1A62CE;
color: #fff;
position: relative;
font-weight: bold;
&::before {
content: '';
position: absolute;
bottom: -13rpx;
border-top: 14rpx solid #1A62CE;
border-left: 12rpx solid transparent;
border-right: 12rpx solid transparent;
left: calc(50% - 7rpx);
z-index: 2;
}
&::after {
content: '';
position: absolute;
z-index: 1;
bottom: -18rpx;
border-top: 14rpx solid #fff;
border-left: 12rpx solid transparent;
border-right: 12rpx solid transparent;
left: calc(50% - 7rpx);
}
}
}
}
</style>

View File

@@ -0,0 +1,268 @@
<!--
* @Date: 2025-10-16 15:15:47
* @LastEditors: shirlwang
* @LastEditTime: 2025-10-22 09:54:53
-->
<template>
<!-- @scroll="handleScroll" @scrolltolower="scrollBottom" -->
<scroll-view :scroll-y="true" class="container" style="background-image: url('../../../packageRc/static/pageBg.png');">
<view style="padding: 40rpx 28rpx;">
<view class="kinggang">
<view>
<image src="../../../packageRc/static/kinggang1.png"/>
<view>信息维护</view>
</view>
<view>
<image src="../../../packageRc/static/kinggang5.png"/>
<view>投递记录</view>
</view>
<view @click="tiao()">
<image src="../../../packageRc/static/kinggang2.png"/>
<view>需求上报</view>
</view>
<view>
<image src="../../../packageRc/static/kinggang3.png"/>
<view>虚拟面试</view>
</view>
<view>
<image src="../../../packageRc/static/kinggang4.png"/>
<view>素质测评</view>
</view>
</view>
<view class="tabs">
<view class="tab" :class="{active: activeTab == 1}" @click="activeTab = 1">岗位列表</view>
<view class="tab" :class="{active: activeTab == 2}" @click="activeTab = 2">实习实训</view>
<view class="tab" :class="{active: activeTab == 3}" @click="activeTab = 3">社区实践</view>
</view>
<view class="titles">
<view class="title-item" :class="{active: activeTitle == 1}" @click="activeTitle = 1"><view>推荐岗位</view></view>
<view class="title-item" :class="{active: activeTitle == 2}" @click="activeTitle = 2"><view>热门岗位</view></view>
</view>
<view v-for="(item, index) in jobList" :key="index" class="job-list">
<view class="top-line">
<view class="salary">4000-8000/</view>
<view class="time"><uni-icons color="#A2A2A2" type="info" size="12"></uni-icons>发布日期2025-10-20</view>
</view>
<view class="title">销售顾问</view>
<view class="infos">
<view>大专</view>
<view>1-3</view>
<view>喀什 市南区</view>
</view>
<view class="bottom-line">
<view><uni-icons color="#A2A2A2" type="person" size="12"></uni-icons>6</view>
<view>青岛xx公司</view>
</view>
</view>
<view class="view-more-btn" @click="viewMore">查看更多内容</view>
<view class="titles" style="justify-content: space-between;">
<view class="title-item active"><view>政策专区</view></view>
<view>{{'查看更多 >'}}</view>
</view>
<view v-for="(item, index) in jobList" :key="index" class="job-list">
<view class="sign">推荐</view>
<view class="title">
<image src="../../../packageRc/static/zcLeft.png"/>
销售顾问</view>
<view class="infos">
<view>大专</view>
<view>1-3</view>
<view>喀什 市南区</view>
</view>
<view class="bottom-line">
<view><uni-icons color="#A2A2A2" type="info" size="12"></uni-icons>发布日期2025-10-20</view>
<view>浏览数<text style="color: #6AA7E8">99+</text></view>
</view>
</view>
</view>
</scroll-view>
</template>
<script setup>
import { reactive, inject, watch, ref, onMounted, watchEffect, nextTick } from 'vue';
let activeTab = ref(1)
let activeTitle = ref(1)
let jobList = ref([{},{},{},{},{},{}])
function back() {
uni.navigateBack({
delta: 1
})
}
function viewMore() {
// uni.navigateTo({
// url: '/pages/jobList/jobList'
// })
}
function tiao(){
console.log('尝试导航到待办详情页面');
// 尝试直接使用uni.navigateTo使用正确的格式
uni.navigateTo({
url: '/packageRc/pages/demand/index',
success: function() {
console.log('导航成功');
},
fail: function(err) {
console.error('导航失败:', err);
}
});
}
</script>
<style lang="less" scoped>
view{box-sizing: border-box;display: block;}
.container{
background-color: #F4F4F4;background-position: top center;background-size: 100% auto;
height: 100vh;
min-width: 100vw;
padding-bottom: 0;
background-repeat: no-repeat;
box-sizing: border-box;
}
.kinggang{
display: flex;
justify-content: space-around;
align-items: center;
padding: 16rpx 16rpx 32rpx 16rpx;
font-size: 24rpx;
background: #FFFFFF;
border-radius: 16rpx;
margin-bottom: 24rpx;
>view{
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
}
image{
width: 78rpx;
// margin-bottom: 15rpx;
height: 78rpx;
}
}
.tabs{
margin-bottom: 29rpx;
border-radius: 16rpx;
display: flex;
background: #fff;
color: #878787;
text-align: center;
width: 100%;
.tab{
width: 50%;
border: 4rpx solid transparent;
border-radius: 16rpx;
line-height: 64rpx;
position: relative;
&.active{
border: 4rpx solid #fff;
color: #fff;
background: linear-gradient(180deg, #79AFFF 1%, #A2B3FE 100%);
box-shadow: 0px 4rpx 10rpx 0px rgba(40, 102, 194, 0.4);
}
}
}
.titles{
display: flex;
margin-bottom: 44rpx;
.title-item{
font-size: 32rpx;
font-weight: bold;
color: #282828;
margin-right: 32rpx;
position: relative;
>view{
position: relative;
z-index: 2;
padding: 0 16rpx;
}
&.active::after{
content: '';
position: absolute;
z-index: 1;
bottom: -12rpx;
left: 0;
width: 120%;
height: 24rpx;
border-radius: 50px 0px 0px 50px;
background: linear-gradient(90deg, #78AEFF 0%, rgba(120, 174, 255, 0.31) 52%, rgba(24, 116, 255, 0) 100%);
}
}
}
.job-list{
width: 100%;
margin: 0 auto;
color: #333333;
border-radius: 24rpx;
background: #FFFFFF;
padding: 32rpx;
margin-bottom: 24rpx;
position: relative;
.sign{
position: absolute;
font-size: 24rpx;
right: 0;
top: 0;
padding: 4rpx 14rpx;
border: 1rpx solid #EC4827;
background: rgba(227, 79, 49, 0.09);
border-top-right-radius: 24rpx;
border-bottom-left-radius: 24rpx;
color: #EC4827;
}
.top-line{
display: flex;
justify-content: space-between;
font-size: 24rpx;
color: #A2A2A2;
margin-bottom: 16rpx;
.salary{
font-size: 32rpx;
color: #4C6EFB;
font-weight: bold;
}
}
.title{
font-size: 32rpx;
font-weight: bold;
color: #282828;
margin-bottom: 16rpx;
display: flex;
image{
width: 46rpx;
height: 46rpx;
margin-right: 11rpx;
}
}
.infos{
display: flex;
flex-wrap: wrap;
font-size: 24rpx;
margin-bottom: 16rpx;
line-height: 42rpx;
view{
padding: 0 16rpx;
margin-right: 10rpx;
background: #F2F2F2;
}
}
.bottom-line{
display: flex;
justify-content: space-between;
font-size: 24rpx;
color: #A2A2A2;
margin-top: 12rpx;
}
}
.view-more-btn{
padding: 10rpx 56rpx;
background: #FFFFFF;
color: #4C6EFB;
border: 1rpx solid #4C6EFB;
text-align: center;
border-radius: 40rpx;
width: fit-content;
margin: 0 auto;
margin-bottom: 20rpx;
}
</style>

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
packageRc/static/pageBg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 963 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
packageRc/static/trace.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

BIN
packageRc/static/zcLeft.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

57
packageRc/utils/auth.js Normal file
View File

@@ -0,0 +1,57 @@
// 导入uni-app的存储API
import { encrypt, decrypt } from './sm2Encrypt.js'
const TokenKey = 'Admin-Token-tzxmgl'
export function getToken() {
return uni.getStorageSync(TokenKey)
}
export function setToken(token) {
uni.removeStorageSync('userName')
return uni.setStorageSync(TokenKey, token)
}
export function removeToken() {
return clearAllStorage()
}
function clearAllStorage() {
// 清除所有相关存储
uni.removeStorageSync(TokenKey)
uni.removeStorageSync('username')
uni.removeStorageSync('password')
uni.removeStorageSync('rememberMe')
}
export function removeTokenFather() {
return uni.removeStorageSync('Admin-Token')
}
// 保存用户名密码到本地
export function saveUserInfo(username, password, rememberMe) {
if (rememberMe) {
uni.setStorageSync('username', username)
uni.setStorageSync('password', encrypt(password)) // 加密存储密码
uni.setStorageSync('rememberMe', 'true')
} else {
removeUserInfo()
}
}
// 清除用户信息
export function removeUserInfo() {
uni.removeStorageSync('username')
uni.removeStorageSync('password')
uni.removeStorageSync('rememberMe')
}
// 获取用户信息
export function getUserInfo() {
const password = uni.getStorageSync('password') || ''
return {
username: uni.getStorageSync('username') || '',
password: password ? decrypt(password) : '', // 解密密码
rememberMe: uni.getStorageSync('rememberMe') === 'true'
}
}

View File

@@ -0,0 +1,94 @@
// 验证码相关API
// 注意这里使用uni.request进行封装与项目其他API保持一致
/**
* 获取验证图片和token
* @param {Object} data - 请求参数必须包含clientUid和ts
*/
export function reqGet(data) {
// 确保data对象存在
const requestData = { ...data };
// 如果没有提供clientUid生成一个
if (!requestData.clientUid) {
requestData.clientUid = 'slider-' + Date.now() + '-' + Math.random().toString(36).substring(2, 15);
}
// 如果没有提供ts使用当前时间戳
if (!requestData.ts) {
requestData.ts = Date.now();
}
return new Promise((resolve, reject) => {
uni.request({
url: 'http://10.160.0.5:8907/captcha/get',
method: 'POST',
data: requestData,
header: {
'Content-Type': 'application/json;charset=utf-8',
isToken: false
},
success: (res) => {
// 检查响应是否有效
if (res.statusCode === 200 && res.data) {
resolve(res.data);
} else {
reject(new Error('获取验证码图片失败:' + (res.statusCode || '未知错误')));
}
},
fail: (error) => {
console.error('验证码API请求失败:', error);
reject(new Error('网络请求失败,请检查网络连接'));
}
});
});
}
/**
* 滑动或点选验证
* @param {Object} data - 验证参数必须包含clientUid、ts和token
*/
export function reqCheck(data) {
// 确保data对象存在
const requestData = { ...data };
// 如果没有提供ts使用当前时间戳
if (!requestData.ts) {
requestData.ts = Date.now();
}
// 验证必要参数
if (!requestData.clientUid) {
return Promise.reject(new Error('缺少必要参数clientUid'));
}
if (!requestData.token) {
return Promise.reject(new Error('缺少必要参数token'));
}
if (!requestData.pointJson) {
return Promise.reject(new Error('缺少必要参数pointJson'));
}
return new Promise((resolve, reject) => {
uni.request({
url: 'http://10.160.0.5:8907/captcha/check',
method: 'POST',
data: requestData,
header: {
'Content-Type': 'application/json;charset=utf-8',
isToken: false
},
success: (res) => {
// 检查响应是否有效
if (res.statusCode === 200 && res.data) {
resolve(res.data);
} else {
reject(new Error('验证码验证失败:' + (res.statusCode || '未知错误')));
}
},
fail: (error) => {
console.error('验证码验证请求失败:', error);
reject(new Error('网络请求失败,请检查网络连接'));
}
});
});
}

149
packageRc/utils/request.js Normal file
View File

@@ -0,0 +1,149 @@
// 导入当前目录下的auth.js使用更具体的路径以避免混淆
import { getToken } from './auth.js';
// 配置API基础URL
const baseURL = 'http://10.160.0.5:8907/'
// 是否显示重新登录
export let isRelogin = { show: false }
/**
* 封装uni.request
* @param {Object} options - 请求配置
*/
export function request(options) {
// 显示加载状态
if (options.load) {
uni.showLoading({
title: '请稍候',
mask: true
})
}
return new Promise((resolve, reject) => {
// 是否需要设置token
const isToken = options.headers && options.headers.isToken === false
// 添加固定的Authorization token
if (!isToken) {
options.headers = options.headers || {}
options.headers['Authorization'] = 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJzeXNfdXNlcjoxIiwicm5TdHIiOiJsNDRvNmhxckdOOW1XcG1pWlpJcXZ0UXJMdGsyTlFhQSIsInVzZXJJZCI6MX0.K5H-Rpof9oI1CCIEtheEQ96XGAxPWS7tzyjPbXwAXrQ'
}
// 确保URL是字符串类型
let url = options.url;
console.log("options.url:", url)
if (typeof url !== 'string') {
console.error('URL must be a string:', url);
url = String(url);
}
// 发起请求
uni.request({
url: baseURL + url,
method: options.method || 'GET',
data: options.data || {},
header: options.headers || {
'Content-Type': 'application/json;charset=utf-8'
},
timeout: options.timeout || 60000,
success: (res) => {
// 二进制数据直接返回
if (res.header['content-type'] && res.header['content-type'].includes('application/octet-stream')) {
resolve(res.data)
return
}
// 处理状态码
const code = res.data.code || 200
// 401错误处理
if (code === 401) {
if (!isRelogin.show) {
isRelogin.show = true
uni.showModal({
title: '登录过期',
content: '登录状态已过期,是否重新登录?',
success: (res) => {
isRelogin.show = false
if (res.confirm) {
// 跳转到登录页面
uni.navigateTo({
url: '/packageRc/pages/login/login'
})
}
}
})
}
reject(new Error('登录过期,请重新登录'))
return
}
// 其他错误处理
if (code !== 200) {
uni.showToast({
title: res.data.msg || '请求失败',
icon: 'none'
})
reject(res.data)
return
}
resolve(res.data)
},
fail: (error) => {
uni.showToast({
title: '网络错误,请稍后重试',
icon: 'none'
})
reject(error)
},
complete: () => {
// 隐藏加载状态
if (options.load) {
uni.hideLoading()
}
}
})
})
}
// 封装GET请求
export function get(config) {
if (typeof config === 'string') {
// 兼容旧的调用方式: get(url, params, options)
const params = arguments[1] || {};
const options = arguments[2] || {};
return request({
url: config,
method: 'GET',
data: params,
...options
})
}
// 支持配置对象的调用方式: get({url, data, ...})
return request({
method: 'GET',
...config
})
}
// 封装POST请求
export function post(config) {
if (typeof config === 'string') {
// 兼容旧的调用方式: post(url, data, options)
const data = arguments[1] || {};
const options = arguments[2] || {};
return request({
url: config,
method: 'POST',
data,
...options
})
}
// 支持配置对象的调用方式: post({url, data, ...})
return request({
method: 'POST',
...config
})
}

View File

@@ -0,0 +1,34 @@
// 为了解决"For input string: OG"错误,我们需要确保加密输出格式正确
// 这里直接使用最简单的字符串处理方式,避免任何可能的格式问题
/**
* 简化的加密函数返回简单的字符串避免base64可能导致的格式问题
*/
export function encrypt(txt) {
try {
console.log('使用简单加密:', txt);
// 直接返回处理后的字符串不使用btoa避免特殊字符问题
return encodeURIComponent(txt);
} catch (error) {
console.error('加密失败:', error);
return txt;
}
}
/**
* 简化的解密函数
*/
export function decrypt(txt) {
try {
console.log('使用简单解密:', txt);
return decodeURIComponent(txt);
} catch (error) {
console.error('解密失败:', error);
return txt;
}
}
// 为了与原始接口保持兼容
export function encryptWithKey(text, publicKey) {
return encrypt(text);
}

View File

@@ -413,6 +413,54 @@
}
}
]
},
{
"root": "packageRc",
"pages": [
{
"path" : "pages/index/index",
"style" :
{
"navigationBarTitleText" : "高校毕业生智慧就业"
}
} , {
"path": "pages/personalList/personalList",
"style": {
"navigationBarTitleText": "添加帮扶"
}
},{
"path": "pages/daiban/daiban",
"style": {
"navigationBarTitleText": "待办任务"
// "navigationBarBackgroundColor": "#4778EC",
// "navigationBarTextStyle": "white"
}
},
{
"path": "pages/daiban/daibandetail",
"style": {
"navigationBarTitleText": "待办详情",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/demand/demandail",
"style": {
"navigationBarTitleText": "新增需求",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
} , {
"path": "pages/daiban/addbangfu",
"style": {
"navigationBarTitleText": "添加帮扶",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
}
]
}],
// "tabBar": {
// "custom": true,

View File

@@ -0,0 +1,51 @@
## 1.1.02025-08-19
- 新增 插槽 selected empty option
- 新增 mutiple 属性,支持多选功能
- 新增 wrap 属性,支持选中的文字超过一行显示
- 新增 align 属性,支持修改选中的文字显示的位置
- 新增 hideRight 属性,支持隐藏右侧所有按钮
- 新增 mode 属性,支持修改边框样式
- 新增 事件 open close clear
## 1.0.102025-04-14
- 修复 清除按钮不展示问题
## 1.0.92025-03-26
- 优化 默认背景为白色与整体组件保持风格统一
## 1.0.82024-03-28
- 修复 在vue2下:style动态绑定导致编译失败的bug
## 1.0.72024-01-20
- 修复 长文本回显超过容器的bug超过容器部分显示省略号
## 1.0.62023-04-12
- 修复 微信小程序点击时会改变背景颜色的 bug
## 1.0.52023-02-03
- 修复 禁用时会显示清空按钮
## 1.0.42023-02-02
- 优化 查询条件短期内多次变更只查询最后一次变更后的结果
- 调整 内部缓存键名调整为 uni-data-select-lastSelectedValue
## 1.0.32023-01-16
- 修复 不关联服务空间报错的问题
## 1.0.22023-01-14
- 新增 属性 `format` 可用于格式化显示选项内容
## 1.0.12022-12-06
- 修复 当where变化时数据不会自动更新的问题
## 0.1.92022-09-05
- 修复 微信小程序下拉框出现后选择会点击到蒙板后面的输入框
## 0.1.82022-08-29
- 修复 点击的位置不准确
## 0.1.72022-08-12
- 新增 支持 disabled 属性
## 0.1.62022-07-06
- 修复 pc端宽度异常的bug
## 0.1.5
- 修复 pc端宽度异常的bug
## 0.1.42022-07-05
- 优化 显示样式
## 0.1.32022-06-02
- 修复 localdata 赋值不生效的 bug
- 新增 支持 uni.scss 修改颜色
- 新增 支持选项禁用(数据选项设置 disabled: true 即禁用)
## 0.1.22022-05-08
- 修复 当 value 为 0 时选择不生效的 bug
## 0.1.12022-05-07
- 新增 记住上次的选项(仅 collection 存在时有效)
## 0.1.02022-04-22
- 初始化

View File

@@ -0,0 +1,837 @@
<template>
<view class="uni-stat__select">
<span v-if="label" class="uni-label-text hide-on-phone">{{label + ''}}</span>
<view class="uni-stat-box" :class="{'uni-stat__actived': current}">
<view class="uni-select" :class="{'uni-select--disabled':disabled, 'uni-select--wrap': shouldWrap , 'border-default': mode == 'default','border-bottom': mode == 'underline'}">
<view class="uni-select__input-box" @click="toggleSelector" :class="{'uni-select__input-box--wrap': shouldWrap}">
<view v-if="slotSelected" class="slot-content padding-top-bottom" :class="{'uni-select__input-text--wrap': shouldWrap}">
<slot name="selected" :selectedItems="getSelectedItems()"></slot>
</view>
<template v-else>
<view v-if="textShow" class="uni-select__input-text" :class="{'uni-select__input-text--wrap': shouldWrap}">
<view class="padding-top-bottom" :class="'align-'+align">{{textShow}}</view>
</view>
<view v-else class="uni-select__input-text uni-select__input-placeholder" :class="'align-'+align">{{typePlaceholder}}</view>
</template>
<view key="clear-button" v-if="!hideRight && shouldShowClear && clear && !disabled" @click.stop="clearVal">
<uni-icons type="clear" color="#c0c4cc" size="24" />
</view>
<view key="arrow-button" v-else-if="!hideRight">
<uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" />
</view>
</view>
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
<view class="uni-select__selector" :style="getOffsetByPlacement" v-if="showSelector">
<view :class="placement=='bottom'?'uni-popper__arrow_bottom':'uni-popper__arrow_top'"></view>
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
<template v-if="slotEmpty && mixinDatacomResData.length === 0">
<view class="uni-select__selector-empty">
<slot name="empty" :empty="emptyTips"></slot>
</view>
</template>
<template v-else>
<view v-if="mixinDatacomResData.length === 0" class="uni-select__selector-empty">
<text>{{emptyTips}}</text>
</view>
</template>
<template v-if="slotOption">
<view v-for="(itemData,index) in mixinDatacomResData" :key="index" @click="change(itemData)">
<slot name="option" :item="itemData" :itemSelected="multiple? getCurrentValues().includes(itemData.value):getCurrentValues() == itemData.value"></slot>
</view>
</template>
<template v-else>
<view v-if="!multiple && mixinDatacomResData.length > 0" class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData" :key="index"
@click="change(item)">
<text :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</text>
</view>
<view v-if="multiple && mixinDatacomResData.length > 0" >
<checkbox-group @change="checkBoxChange">
<label class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData" :key="index" >
<checkbox :value="index+''" :checked="getCurrentValues().includes(item.value)" :disabled="item.disable"></checkbox>
<view :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</view>
</label>
</checkbox-group>
</view>
</template>
</scroll-view>
</view>
</view>
</view>
</view>
</template>
<script>
/**
* DataChecklist 数据选择器
* @description 通过数据渲染的下拉框组件
* @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select
* @property {String|Array} value 默认值,多选时为数组
* @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}]
* @property {Boolean} clear 是否可以清空已选项
* @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
* @property {String} label 左侧标题
* @property {String} placeholder 输入框的提示文字
* @property {Boolean} disabled 是否禁用
* @property {Boolean} multiple 是否多选模式
* @property {Boolean} wrap 是否允许选中文本换行显示
* @property {String} placement 弹出位置
* @value top 顶部弹出
* @value bottom 底部弹出default)
* @property {String} align 选择文字的位置
* @value left 显示左侧
* @value center 显示中间
* @value right 显示 右侧
* @property {Boolean} hideRight 是否隐藏右侧按钮
* @property {String} mode 边框样式
* @value default 四周边框
* @value underline 下边框
* @value none 无边框
* @event {Function} change 选中发生变化触发
* @event {Function} open 选择框开启时触发
* @event {Function} close 选择框关闭时触发
* @event {Function} clear 点击清除按钮之后触发
*/
export default {
name: "uni-data-select",
mixins: [uniCloud.mixinDatacom || {}],
emits: [
'open',
'close',
'update:modelValue',
'input',
'clear',
'change'
],
model: {
prop: 'modelValue',
event: 'update:modelValue'
},
options: {
// #ifdef MP-TOUTIAO
virtualHost: false,
// #endif
// #ifndef MP-TOUTIAO
virtualHost: true
// #endif
},
props: {
localdata: {
type: Array,
default () {
return []
}
},
value: {
type: [String, Number, Array],
default: ''
},
modelValue: {
type: [String, Number, Array],
default: ''
},
label: {
type: String,
default: ''
},
placeholder: {
type: String,
default: '请选择'
},
emptyTips: {
type: String,
default: '无选项'
},
clear: {
type: Boolean,
default: true
},
defItem: {
type: Number,
default: 0
},
disabled: {
type: Boolean,
default: false
},
// 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}"
format: {
type: String,
default: ''
},
placement: {
type: String,
default: 'bottom'
},
multiple: {
type: Boolean,
default: false
},
wrap: {
type: Boolean,
default: false
},
align:{
type: String,
default: "left"
},
hideRight: {
type: Boolean,
default: false
},
mode:{
type: String,
default: 'default'
}
},
data() {
return {
showSelector: false,
current: '',
mixinDatacomResData: [],
apps: [],
channels: [],
cacheKey: "uni-data-select-lastSelectedValue",
};
},
created() {
this.debounceGet = this.debounce(() => {
this.query();
}, 300);
if (this.collection && !this.localdata.length) {
this.debounceGet();
}
},
computed: {
typePlaceholder() {
const text = {
'opendb-stat-app-versions': '版本',
'opendb-app-channels': '渠道',
'opendb-app-list': '应用'
}
const common = this.placeholder
const placeholder = text[this.collection]
return placeholder ?
common + placeholder :
common
},
valueCom() {
if (this.value === '') return this.modelValue
if (this.modelValue === '') return this.value
return this.value
},
textShow() {
// 长文本显示
if (this.multiple) {
const currentValues = this.getCurrentValues();
if (Array.isArray(currentValues) && currentValues.length > 0) {
const selectedItems = this.mixinDatacomResData.filter(item => currentValues.includes(item.value));
return selectedItems.map(item => this.formatItemName(item)).join(', ');
} else {
return ''; // 空数组时返回空字符串,显示占位符
}
} else {
return this.current;
}
},
shouldShowClear() {
if (this.multiple) {
const currentValues = this.getCurrentValues();
return Array.isArray(currentValues) && currentValues.length > 0;
} else {
return !!this.current;
}
},
shouldWrap() {
// 只有在多选模式、开启换行、且有内容时才应用换行样式
return this.multiple && this.wrap && !!this.textShow;
},
getOffsetByPlacement() {
switch (this.placement) {
case 'top':
return "bottom:calc(100% + 12px);";
case 'bottom':
return "top:calc(100% + 12px);";
}
},
slotSelected(){
// #ifdef VUE2
return this.$scopedSlots ? this.$scopedSlots.selected : false
// #endif
// #ifdef VUE3
return this.$slots ? this.$slots.selected : false
// #endif
},
slotEmpty(){
// #ifdef VUE2
return this.$scopedSlots ? this.$scopedSlots.empty : false
// #endif
// #ifdef VUE3
return this.$slots ? this.$slots.empty : false
// #endif
},
slotOption(){
// #ifdef VUE2
return this.$scopedSlots ? this.$scopedSlots.option : false
// #endif
// #ifdef VUE3
return this.$slots ? this.$slots.option : false
// #endif
}
},
watch: {
showSelector:{
handler(val,old){
val ? this.$emit('open') : this.$emit('close')
}
},
localdata: {
immediate: true,
handler(val, old) {
if (Array.isArray(val) && old !== val) {
this.mixinDatacomResData = val
}
}
},
valueCom(val, old) {
this.initDefVal()
},
mixinDatacomResData: {
immediate: true,
handler(val) {
if (val.length) {
this.initDefVal()
}
}
},
},
methods: {
getSelectedItems() {
const currentValues = this.getCurrentValues();
let _minxData = this.mixinDatacomResData
// #ifdef MP-WEIXIN || MP-TOUTIAO
_minxData = JSON.parse(JSON.stringify(this.mixinDatacomResData))
// #endif
if (this.multiple) {
return _minxData.filter(item => currentValues.includes(item.value)) || [];
} else {
return _minxData.filter(item => item.value === currentValues) || [];
}
},
debounce(fn, time = 100) {
let timer = null
return function(...args) {
if (timer) clearTimeout(timer)
timer = setTimeout(() => {
fn.apply(this, args)
}, time)
}
},
// 检查项目是否已选中
isSelected(item) {
if (this.multiple) {
const currentValues = this.getCurrentValues();
return Array.isArray(currentValues) && currentValues.includes(item.value);
} else {
return this.getCurrentValues() === item.value;
}
},
// 获取当前选中的值
getCurrentValues() {
if (this.multiple) {
return Array.isArray(this.valueCom) ? this.valueCom : (this.valueCom ? [this.valueCom] : []);
} else {
return this.valueCom;
}
},
// 执行数据库查询
query() {
this.mixinDatacomEasyGet();
},
// 监听查询条件变更事件
onMixinDatacomPropsChange() {
if (this.collection) {
this.debounceGet();
}
},
initDefVal() {
let defValue = this.multiple ? [] : ''
if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) {
defValue = this.valueCom
} else {
let strogeValue
if (this.collection) {
strogeValue = this.getCache()
}
if (strogeValue || strogeValue === 0) {
defValue = strogeValue
} else {
let defItem = this.multiple ? [] : ''
if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) {
defItem = this.multiple ? [this.mixinDatacomResData[this.defItem - 1].value] : this.mixinDatacomResData[this.defItem - 1].value
}
defValue = defItem
}
if (defValue || defValue === 0 || (this.multiple && Array.isArray(defValue) && defValue.length > 0)) {
this.emit(defValue)
}
}
if (this.multiple) {
const selectedValues = Array.isArray(defValue) ? defValue : (defValue ? [defValue] : []);
const selectedItems = this.mixinDatacomResData.filter(item => selectedValues.includes(item.value));
this.current = selectedItems.map(item => this.formatItemName(item));
} else {
const def = this.mixinDatacomResData.find(item => item.value === defValue)
this.current = def ? this.formatItemName(def) : ''
}
},
/**
* @param {[String, Number, Array]} value
* 判断用户给的 value 是否同时为禁用状态
*/
isDisabled(value) {
if (Array.isArray(value)) {
// 对于数组,如果任意一个值被禁用,则认为整体被禁用
return value.some(val => {
return this.mixinDatacomResData.some(item => item.value === val && item.disable);
});
} else {
let isDisabled = false;
this.mixinDatacomResData.forEach(item => {
if (item.value === value) {
isDisabled = item.disable
}
})
return isDisabled;
}
},
clearVal() {
const emptyValue = this.multiple ? [] : '';
this.emit(emptyValue)
this.current = this.multiple ? [] : ''
if (this.collection) {
this.removeCache()
}
this.$emit('clear')
},
checkBoxChange(res){
let range = res.detail.value
let currentValues = range && range.length > 0? range.map((item)=>{
const index = parseInt(item, 10);
if (isNaN(index)) {
console.error(`无效索引: ${item}`);
}
if (index < 0 || index >= this.mixinDatacomResData.length) {
console.error(`索引越界: ${index}`);
}
return this.mixinDatacomResData[index].value;
}) : []
const selectedItems = this.mixinDatacomResData.filter(dataItem => currentValues.includes(dataItem.value));
this.current = selectedItems.map(dataItem => this.formatItemName(dataItem));
this.emit(currentValues);
},
change(item) {
if (!item.disable) {
if (this.multiple) {
// 多选模式
let currentValues = this.getCurrentValues();
if (!Array.isArray(currentValues)) {
currentValues = currentValues ? [currentValues] : [];
}
const itemValue = item.value;
const index = currentValues.indexOf(itemValue);
if (index > -1) {
currentValues.splice(index, 1);
} else {
currentValues.push(itemValue);
}
const selectedItems = this.mixinDatacomResData.filter(dataItem => currentValues.includes(dataItem.value));
this.current = selectedItems.map(dataItem => this.formatItemName(dataItem));
this.emit(currentValues);
} else {
// 单选模式
this.showSelector = false
this.current = this.formatItemName(item)
this.emit(item.value)
}
}
},
emit(val) {
this.$emit('input', val)
this.$emit('update:modelValue', val)
this.$emit('change', val)
if (this.collection) {
this.setCache(val);
}
},
toggleSelector() {
if (this.disabled) {
return
}
this.showSelector = !this.showSelector
},
formatItemName(item) {
let {
text,
value,
channel_code
} = item
channel_code = channel_code ? `(${channel_code})` : ''
if (this.format) {
// 格式化输出
let str = "";
str = this.format;
for (let key in item) {
str = str.replace(new RegExp(`{${key}}`, "g"), item[key]);
}
return str;
} else {
return this.collection.indexOf('app-list') > 0 ?
`${text}(${value})` :
(
text ?
text :
`未命名${channel_code}`
)
}
},
// 获取当前加载的数据
getLoadData() {
return this.mixinDatacomResData;
},
// 获取当前缓存key
getCurrentCacheKey() {
return this.collection;
},
// 获取缓存
getCache(name = this.getCurrentCacheKey()) {
let cacheData = uni.getStorageSync(this.cacheKey) || {};
return cacheData[name];
},
// 设置缓存
setCache(value, name = this.getCurrentCacheKey()) {
let cacheData = uni.getStorageSync(this.cacheKey) || {};
cacheData[name] = value;
uni.setStorageSync(this.cacheKey, cacheData);
},
// 删除缓存
removeCache(name = this.getCurrentCacheKey()) {
let cacheData = uni.getStorageSync(this.cacheKey) || {};
delete cacheData[name];
uni.setStorageSync(this.cacheKey, cacheData);
},
}
}
</script>
<style lang="scss">
$uni-base-color: #6a6a6a !default;
$uni-main-color: #333 !default;
$uni-secondary-color: #909399 !default;
$uni-border-3: #e5e5e5;
$uni-primary: #2979ff !default;
$uni-success: #4cd964 !default;
$uni-warning: #f0ad4e !default;
$uni-error: #dd524d !default;
$uni-info: #909399 !default;
/* #ifndef APP-NVUE */
@media screen and (max-width: 500px) {
.hide-on-phone {
display: none;
}
}
/* #endif */
.uni-stat__select {
display: flex;
align-items: center;
// padding: 15px;
/* #ifdef H5 */
cursor: pointer;
/* #endif */
width: 100%;
flex: 1;
box-sizing: border-box;
}
.uni-stat-box {
background-color: #fff;
width: 100%;
flex: 1;
}
.uni-stat__actived {
width: 100%;
flex: 1;
// outline: 1px solid #2979ff;
}
.uni-label-text {
font-size: 14px;
font-weight: bold;
color: $uni-base-color;
margin: auto 0;
margin-right: 5px;
}
.border-bottom {
border-bottom: solid 1px $uni-border-3;
}
.border-default {
border: 1px solid $uni-border-3;
}
.uni-select {
font-size: 14px;
box-sizing: border-box;
border-radius: 4px;
padding: 0 5px;
padding-left: 10px;
position: relative;
/* #ifndef APP-NVUE */
display: flex;
user-select: none;
/* #endif */
flex-direction: row;
align-items: center;
width: 100%;
flex: 1;
min-height: 35px;
&--disabled {
background-color: #f5f7fa;
cursor: not-allowed;
}
&--wrap {
height: auto;
min-height: 35px;
// align-items: flex-start;
}
}
.uni-select__label {
font-size: 16px;
// line-height: 22px;
height: 35px;
padding-right: 10px;
color: $uni-secondary-color;
}
.uni-select__input-box {
// height: 35px;
width: 0px;
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex: 1;
flex-direction: row;
align-items: center;
&--wrap {
.uni-select__input-text {
margin-right: 8px;
}
}
.padding-top-bottom {
padding-top: 5px;
padding-bottom: 5px;
}
.slot-content {
width: 100%;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
}
.uni-select__input {
flex: 1;
font-size: 14px;
height: 22px;
line-height: 22px;
}
.uni-select__input-plac {
font-size: 14px;
color: $uni-secondary-color;
}
.uni-select__selector {
/* #ifndef APP-NVUE */
box-sizing: border-box;
/* #endif */
position: absolute;
left: 0;
width: 100%;
background-color: #FFFFFF;
border: 1px solid #EBEEF5;
border-radius: 6px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
z-index: 3;
padding: 4px 0;
}
.uni-select__selector-scroll {
/* #ifndef APP-NVUE */
max-height: 200px;
box-sizing: border-box;
/* #endif */
}
/* #ifdef H5 */
@media (min-width: 768px) {
.uni-select__selector-scroll {
max-height: 600px;
}
}
/* #endif */
.uni-select__selector-empty,
.uni-select__selector-item {
/* #ifndef APP-NVUE */
display: flex;
cursor: pointer;
/* #endif */
flex-direction: row;
align-items: center;
line-height: 35px;
font-size: 14px;
/* border-bottom: solid 1px $uni-border-3; */
padding: 0px 10px;
}
.uni-select__selector-item-check {
margin-left: auto;
}
.uni-select__selector-empty:last-child,
.uni-select__selector-item:last-child {
/* #ifndef APP-NVUE */
border-bottom: none;
/* #endif */
}
.uni-select__selector__disabled {
opacity: 0.4;
cursor: default;
}
/* picker 弹出层通用的指示小三角 */
.uni-popper__arrow_bottom,
.uni-popper__arrow_bottom::after,
.uni-popper__arrow_top,
.uni-popper__arrow_top::after {
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 6px;
}
.uni-popper__arrow_bottom {
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
top: -6px;
left: 10%;
margin-right: 3px;
border-top-width: 0;
border-bottom-color: #EBEEF5;
}
.uni-popper__arrow_bottom::after {
content: " ";
top: 1px;
margin-left: -6px;
border-top-width: 0;
border-bottom-color: #fff;
}
.uni-popper__arrow_top {
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
bottom: -6px;
left: 10%;
margin-right: 3px;
border-bottom-width: 0;
border-top-color: #EBEEF5;
}
.uni-popper__arrow_top::after {
content: " ";
bottom: 1px;
margin-left: -6px;
border-bottom-width: 0;
border-top-color: #fff;
}
.uni-select__input-text {
// width: 280px;
width: 100%;
color: $uni-main-color;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
overflow: hidden;
&--wrap {
white-space: normal;
text-overflow: initial;
-o-text-overflow: initial;
overflow: visible;
word-wrap: break-word;
word-break: break-all;
// line-height: 1.5;
}
}
.uni-select__input-placeholder {
color: $uni-base-color;
font-size: 12px;
margin: 1px 0;
}
.uni-select--mask {
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 0;
z-index: 2;
}
.align-left {
text-align: left;
}
.align-center {
text-align: center;
}
.align-right {
text-align: right;
}
</style>

View File

@@ -0,0 +1,106 @@
{
"id": "uni-data-select",
"displayName": "uni-data-select 下拉框选择器",
"version": "1.1.0",
"description": "通过数据驱动的下拉框选择器",
"keywords": [
"uni-ui",
"select",
"uni-data-select",
"下拉框",
"下拉选"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": "^3.1.1",
"uni-app": "^4.45",
"uni-app-x": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue",
"darkmode": "x",
"i18n": "x",
"widescreen": "x"
},
"uni_modules": {
"dependencies": [
"uni-load-more"
],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "√",
"aliyun": "√",
"alipay": "√"
},
"client": {
"uni-app": {
"vue": {
"vue2": "√",
"vue3": "√"
},
"web": {
"safari": "√",
"chrome": "√"
},
"app": {
"vue": "√",
"nvue": "-",
"android": "√",
"ios": "√",
"harmony": "√"
},
"mp": {
"weixin": "√",
"alipay": "√",
"toutiao": "√",
"baidu": "-",
"kuaishou": "-",
"jd": "-",
"harmony": "-",
"qq": "-",
"lark": "-"
},
"quickapp": {
"huawei": "-",
"union": "-"
}
},
"uni-app-x": {
"web": {
"safari": "-",
"chrome": "-"
},
"app": {
"android": "-",
"ios": "-",
"harmony": "-"
},
"mp": {
"weixin": "-"
}
}
}
}
}
}

View File

@@ -0,0 +1,8 @@
## DataSelect 下拉框选择器
> **组件名uni-data-select**
> 代码块: `uDataSelect`
当选项过多时,使用下拉菜单展示并选择内容
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-data-select)
#### 如使用过程中有任何问题或者您对uni-ui有一些好的建议欢迎加入 uni-ui 交流群871950839

View File

@@ -0,0 +1,10 @@
## 1.0.02021-11-19
- 优化 组件UI并提供设计资源详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-dateformat](https://uniapp.dcloud.io/component/uniui/uni-dateformat)
## 0.0.52021-07-08
- 调整 默认时间不再是当前时间,而是显示'-'字符
## 0.0.42021-05-12
- 新增 组件示例地址
## 0.0.32021-02-04
- 调整为uni_modules目录规范
- 修复 iOS 平台日期格式化出错的问题

View File

@@ -0,0 +1,200 @@
// yyyy-MM-dd hh:mm:ss.SSS 所有支持的类型
function pad(str, length = 2) {
str += ''
while (str.length < length) {
str = '0' + str
}
return str.slice(-length)
}
const parser = {
yyyy: (dateObj) => {
return pad(dateObj.year, 4)
},
yy: (dateObj) => {
return pad(dateObj.year)
},
MM: (dateObj) => {
return pad(dateObj.month)
},
M: (dateObj) => {
return dateObj.month
},
dd: (dateObj) => {
return pad(dateObj.day)
},
d: (dateObj) => {
return dateObj.day
},
hh: (dateObj) => {
return pad(dateObj.hour)
},
h: (dateObj) => {
return dateObj.hour
},
mm: (dateObj) => {
return pad(dateObj.minute)
},
m: (dateObj) => {
return dateObj.minute
},
ss: (dateObj) => {
return pad(dateObj.second)
},
s: (dateObj) => {
return dateObj.second
},
SSS: (dateObj) => {
return pad(dateObj.millisecond, 3)
},
S: (dateObj) => {
return dateObj.millisecond
},
}
// 这都n年了iOS依然不认识2020-12-12需要转换为2020/12/12
function getDate(time) {
if (time instanceof Date) {
return time
}
switch (typeof time) {
case 'string':
{
// 2020-12-12T12:12:12.000Z、2020-12-12T12:12:12.000
if (time.indexOf('T') > -1) {
return new Date(time)
}
return new Date(time.replace(/-/g, '/'))
}
default:
return new Date(time)
}
}
export function formatDate(date, format = 'yyyy/MM/dd hh:mm:ss') {
if (!date && date !== 0) {
return ''
}
date = getDate(date)
const dateObj = {
year: date.getFullYear(),
month: date.getMonth() + 1,
day: date.getDate(),
hour: date.getHours(),
minute: date.getMinutes(),
second: date.getSeconds(),
millisecond: date.getMilliseconds()
}
const tokenRegExp = /yyyy|yy|MM|M|dd|d|hh|h|mm|m|ss|s|SSS|SS|S/
let flag = true
let result = format
while (flag) {
flag = false
result = result.replace(tokenRegExp, function(matched) {
flag = true
return parser[matched](dateObj)
})
}
return result
}
export function friendlyDate(time, {
locale = 'zh',
threshold = [60000, 3600000],
format = 'yyyy/MM/dd hh:mm:ss'
}) {
if (time === '-') {
return time
}
if (!time && time !== 0) {
return ''
}
const localeText = {
zh: {
year: '年',
month: '月',
day: '天',
hour: '小时',
minute: '分钟',
second: '秒',
ago: '前',
later: '后',
justNow: '刚刚',
soon: '马上',
template: '{num}{unit}{suffix}'
},
en: {
year: 'year',
month: 'month',
day: 'day',
hour: 'hour',
minute: 'minute',
second: 'second',
ago: 'ago',
later: 'later',
justNow: 'just now',
soon: 'soon',
template: '{num} {unit} {suffix}'
}
}
const text = localeText[locale] || localeText.zh
let date = getDate(time)
let ms = date.getTime() - Date.now()
let absMs = Math.abs(ms)
if (absMs < threshold[0]) {
return ms < 0 ? text.justNow : text.soon
}
if (absMs >= threshold[1]) {
return formatDate(date, format)
}
let num
let unit
let suffix = text.later
if (ms < 0) {
suffix = text.ago
ms = -ms
}
const seconds = Math.floor((ms) / 1000)
const minutes = Math.floor(seconds / 60)
const hours = Math.floor(minutes / 60)
const days = Math.floor(hours / 24)
const months = Math.floor(days / 30)
const years = Math.floor(months / 12)
switch (true) {
case years > 0:
num = years
unit = text.year
break
case months > 0:
num = months
unit = text.month
break
case days > 0:
num = days
unit = text.day
break
case hours > 0:
num = hours
unit = text.hour
break
case minutes > 0:
num = minutes
unit = text.minute
break
default:
num = seconds
unit = text.second
break
}
if (locale === 'en') {
if (num === 1) {
num = 'a'
} else {
unit += 's'
}
}
return text.template.replace(/{\s*num\s*}/g, num + '').replace(/{\s*unit\s*}/g, unit).replace(/{\s*suffix\s*}/g,
suffix)
}

View File

@@ -0,0 +1,88 @@
<template>
<text>{{dateShow}}</text>
</template>
<script>
import {friendlyDate} from './date-format.js'
/**
* Dateformat 日期格式化
* @description 日期格式化组件
* @tutorial https://ext.dcloud.net.cn/plugin?id=3279
* @property {Object|String|Number} date 日期对象/日期字符串/时间戳
* @property {String} locale 格式化使用的语言
* @value zh 中文
* @value en 英文
* @property {Array} threshold 应用不同类型格式化的阈值
* @property {String} format 输出日期字符串时的格式
*/
export default {
name: 'uniDateformat',
props: {
date: {
type: [Object, String, Number],
default () {
return '-'
}
},
locale: {
type: String,
default: 'zh',
},
threshold: {
type: Array,
default () {
return [0, 0]
}
},
format: {
type: String,
default: 'yyyy/MM/dd hh:mm:ss'
},
// refreshRate使用不当可能导致性能问题谨慎使用
refreshRate: {
type: [Number, String],
default: 0
}
},
data() {
return {
refreshMark: 0
}
},
computed: {
dateShow() {
this.refreshMark
return friendlyDate(this.date, {
locale: this.locale,
threshold: this.threshold,
format: this.format
})
}
},
watch: {
refreshRate: {
handler() {
this.setAutoRefresh()
},
immediate: true
}
},
methods: {
refresh() {
this.refreshMark++
},
setAutoRefresh() {
clearInterval(this.refreshInterval)
if (this.refreshRate) {
this.refreshInterval = setInterval(() => {
this.refresh()
}, parseInt(this.refreshRate))
}
}
}
}
</script>
<style>
</style>

Some files were not shown because too many files have changed in this diff Show More