This commit is contained in:
冯辉
2025-11-10 15:27:36 +08:00
5 changed files with 318 additions and 207 deletions

View File

@@ -28,31 +28,31 @@
<!-- 帮扶类型下拉选择 -->
<view class="search-item">
<text class="label">帮扶类型</text>
<uni-data-select v-model="formData.helpType" :localdata="helpTypes" placeholder="请选择帮扶类型" @change="onHelpTypeChange"></uni-data-select>
<uni-data-select v-model="formData.taskType" :localdata="taskTypeOptions" placeholder="请选择帮扶类型" @change="onTaskTypeChange"></uni-data-select>
</view>
<!-- 帮扶人员 -->
<view class="search-item">
<text class="label">帮扶人员</text>
<uni-easyinput v-model="formData.helperName" placeholder="请输入帮扶人员姓名"></uni-easyinput>
<uni-easyinput v-model="formData.createByName" placeholder="请输入帮扶人员姓名"></uni-easyinput>
</view>
<!-- 所属区域下拉选择 -->
<view class="search-item">
<text class="label">所属区域</text>
<uni-data-picker class="picker" placeholder="请选择所属区域" popup-title="请选择所属区域" :localdata="regions" v-model="formData.helpArea"
<uni-data-picker ref="picker" class="picker" placeholder="请选择所属区域" popup-title="请选择所属区域" :localdata="regions" v-model="formData.helpArea"
@change="onchange" >
</uni-data-picker>
</view>
<!-- 开始时间 -->
<view class="search-item">
<view class="search-item" v-if="false">
<text class="label">开始时间</text>
<uni-datetime-picker type="date" placeholder="请选择开始时间" v-model="formData.startTime" @maskClick="onStartTimeChange" />
</view>
<!-- 结束时间 -->
<view class="search-item">
<view class="search-item" v-if="false">
<text class="label">结束时间</text>
<uni-datetime-picker type="date" placeholder="请选择结束时间" v-model="formData.endTime" @maskClick="onEndTimeChange" />
</view>
@@ -65,21 +65,20 @@
<view class="title-line" style="left: 70rpx;"></view>
</view>
<view class="title-total">
<text class="total-num">7</text>条记录
<text class="total-num">{{totalNum}}</text>条记录
</view>
</view>
<!-- v-if="dataList.length>0" -->
<view class="list-box" >
<view class="list-box" v-if="dataList.length>0">
<view class="con-box" v-for="(item,index) in dataList" :key="index">
<view class="form-title">
<view class="form-name">
{{item.name}}
</view>
<view class="form-type">
{{item.type}}
{{getTaskTypeLabelByValue(item.task_type)}}
</view>
</view>
<view class="form-item">
<view class="form-item" v-if="item.phone">
<view class="item-left">
<image class="item-img" :src="baseUrl+'/dispatch/tele.png'" mode=""></image>
<view class="item-label">
@@ -90,7 +89,7 @@
{{item.phone}}
</view>
</view>
<view class="form-item">
<view class="form-item" v-if="item.id_card">
<view class="item-left">
<image class="item-img" :src="baseUrl+'/dispatch/num.png'" mode=""></image>
<view class="item-label">
@@ -98,10 +97,10 @@
</view>
</view>
<view class="item-right">
{{item.idCard}}
{{item.id_card}}
</view>
</view>
<view class="form-item">
<view class="form-item" v-if="item.dept_name">
<view class="item-left">
<image class="item-img" :src="baseUrl+'/dispatch/base.png'" mode=""></image>
<view class="item-label">
@@ -109,10 +108,10 @@
</view>
</view>
<view class="item-right">
{{item.helpArea}}
{{item.dept_name}}
</view>
</view>
<view class="form-item">
<view class="form-item" v-if="item.create_by_name">
<view class="item-left">
<image class="item-img" :src="baseUrl+'/dispatch/person.png'" mode=""></image>
<view class="item-label">
@@ -120,10 +119,10 @@
</view>
</view>
<view class="item-right">
{{item.helperName}}
{{item.create_by_name}}
</view>
</view>
<view class="form-item">
<view class="form-item" v-if="item.create_by_dept_name">
<view class="item-left">
<image class="item-img" :src="baseUrl+'/dispatch/help.png'" mode=""></image>
<view class="item-label">
@@ -131,10 +130,10 @@
</view>
</view>
<view class="item-right">
{{item.helpUnit}}
{{item.create_by_dept_name}}
</view>
</view>
<view class="form-item">
<view class="form-item" v-if="item.follow_date">
<view class="item-left">
<image class="item-img" :src="baseUrl+'/dispatch/date.png'" mode=""></image>
<view class="item-label">
@@ -142,10 +141,10 @@
</view>
</view>
<view class="item-right">
{{item.assistanceDate}}
{{item.follow_date}}
</view>
</view>
<view class="form-item">
<view class="form-item" v-if="item.next_contact_date">
<view class="item-left">
<image class="item-img" :src="baseUrl+'/dispatch/next.png'" mode=""></image>
<view class="item-label">
@@ -153,7 +152,7 @@
</view>
</view>
<view class="item-right">
{{item.nextContact}}
{{item.next_contact_date}}
</view>
</view>
<view class="form-btns">
@@ -163,13 +162,13 @@
</view>
</view>
</view>
<!-- <empty v-else pdTop="200"></empty> -->
<empty v-else pdTop="200"></empty>
</view>
</AppLayout>
</template>
<script setup>
import { inject, ref, reactive } from 'vue';
import { inject, ref, reactive,onMounted } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
const { $api, navTo, navBack } = inject('globalFunction');
import config from "@/config.js"
@@ -179,23 +178,15 @@ const title = ref('');
const initialForm = {
name: '',
idCard: '',
helpType: '',
helperName: '',
helpArea: '',
taskType: '',
createByName: '',
helpArea: [],
startTime: '',
endTime: ''
endTime: '',
deptId:''
}
const formData = reactive({ ...initialForm });
// const formData = reactive({
// name: '',
// idCard: '',
// helpType:'',
// helperName: '',
// helpArea:'',
// startTime: '',
// endTime: ''
// })
const taskTypeOptions=ref([])
const dataList=ref([])
const pageSize=ref(10)
const pageNum=ref(1)
@@ -208,58 +199,15 @@ const getBackgroundStyle = (imageName) => ({
backgroundRepeat: 'no-repeat'
});
const trainVideoImgUrl=config.trainVideoImgUrl
// 帮扶类型选项
const helpTypes = [{
"value": 0,
"text": "经济帮扶"
}, {
"value": 1,
"text": "教育帮扶"
}, {
"value": 2,
"text": "医疗帮扶"
}, {
"value": 3,
"text": "就业帮扶"
}]
const picker = ref(null)
// 所属区域选项(可根据实际替换为动态数据)
const regions = [{
text: "一年级",
value: "1-0",
children: [{
text: "1.1班",
value: "1-1"
},
{
text: "1.2班",
value: "1-2"
}]
},
{
text: "二年级",
value: "2-0",
children: [{
text: "2.1班",
value: "2-1"
},
{
text: "2.2班",
value: "2-2"
}]
},
{
text: "三年级",
value: "3-0",
disable: true
}]
const regions = ref([])
// 事件处理
const onHelpTypeChange = (e) => {
formData.helpType=e
}
const onchange=(e)=>{
console.log("e",e)
const onTaskTypeChange = (e) => {
formData.taskType=e
}
const onStartTimeChange = (e) => {
formData.startTime = e.detail.value
@@ -271,86 +219,162 @@ const onEndTimeChange = (e) => {
const handleSearch = () => {
// 在这里调用接口进行搜索
getDataList('refresh')
}
const handleReset = () =>{
Object.assign(formData, initialForm);
getDataList('refresh')
}
onMounted(async () => {
await loadLevelData('201');
});
onLoad(() => {
getDictionary()
// getDeptOptions()
getDataList('refresh');
});
function getDictionary(){
$api.myRequest('/system/public/dict/data/type/assist_task_type').then((resData) => {
if(resData && resData.code == 200){
resData.data.forEach(item=>{
const obj = {
value: item.dictValue,
text: item.dictLabel
}
taskTypeOptions.value.push(obj)
})
}
});
}
function getTaskTypeLabelByValue(value) {
if (!Array.isArray(taskTypeOptions.value)) {
return ''
}
const item = taskTypeOptions.value.find(item => item.value === String(value))
return item ? item.text : '暂无帮扶类型'
}
// 加载某一级的数据parentId 为空表示根)
async function loadLevelData(parentId) {
let header = {
'Authorization': uni.getStorageSync('Padmin-Token'),
'Content-Type': "application/x-www-form-urlencoded"
};
let params = { parentId };
try {
const resData = await $api.myRequest('/dispatch/dept/list', params, 'get', 9100, header);
if(resData.data.length==0){
picker.value.hide()
return
}
const formatted = (resData.data || []).map(item => ({
text: item.deptName,
value: item.deptId,
children: []
}));
if (parentId === '201') {
// 第一层
regions.value = formatted;
} else {
// 找到父节点并注入 children
injectChildren(parentId, formatted);
}
} catch (error) {
console.error("加载部门数据失败:", error);
uni.showToast({ title: '加载失败', icon: 'none' });
}
}
// 将子级数据注入到对应的父节点
function injectChildren(parentValue, childrenData) {
const findAndInject = (nodes) => {
for (let node of nodes) {
if (node.value === parentValue) {
// 如果 children 已存在且非空,避免重复加载
if (!node.children || node.children.length === 0) {
node.children = childrenData;
}
return true;
}
if (node.children && node.children.length > 0) {
if (findAndInject(node.children)) return true;
}
}
return false;
}
// 获取视频列表
findAndInject(regions.value);
// 强制更新
}
// 当用户选择时触发注意change 在每级选择后都会触发)
function onchange(e) {
const selectedValues = e.detail.value;
formData.deptId=selectedValues.map(item => item.value).join(',');
if (selectedValues.length === 0) return;
// 获取最后一级选中的 value
const lastSelectedValue = selectedValues[selectedValues.length - 1];
// 查找该节点是否有 children如果没有则尝试加载
const node = findNodeByValue(regions.value, lastSelectedValue);
if (node && (!node.children || node.children.length === 0)) {
// 检查接口是否还有下一级(可通过接口返回判断,或先尝试加载)
// 这里我们直接尝试加载下一级
loadLevelData(lastSelectedValue.value);
picker.value.show()
}
}
// 工具函数:根据 value 查找节点
function findNodeByValue(nodes, value) {
for (let node of nodes) {
if (node.value === value.value) {
return node;
}
if (node.children && node.children.length > 0) {
const found = findNodeByValue(node.children, value);
if (found) return found;
}
}
return null;
}
function getDeptOptions(){
let header={
'Authorization':uni.getStorageSync('Padmin-Token'),
'Content-Type': "application/x-www-form-urlencoded"
}
let params={
parentId:''
}
$api.myRequest('/dispatch/dept/list', params,'get',9100,header).then((resData) => {
});
}
function getDataList(type = 'add') {
// let maxPage=Math.ceil(totalNum.value/pageSize.value)
// let params={}
// if (type === 'refresh') {
// pageNum.value = 1;
// params={
// category:'',
// hour:'',
// level:'',
// searchValue:searchKeyword.value,
// orderStr:'',
// pageSize:pageSize.value,
// pageNum:pageNum.value
// }
// $api.myRequest('/train/public/trainVideo/trainVideoList', params).then((resData) => {
// dataList.value=resData.rows
// totalNum.value=resData.total
// });
// }
// if (type === 'add' && pageNum.value < maxPage) {
// pageNum.value += 1;
// params={
// category:'',
// hour:'',
// level:'',
// searchValue:searchKeyword.value,
// orderStr:'',
// pageSize:pageSize.value,
// pageNum:pageNum.value
// }
// $api.myRequest('/train/public/trainVideo/trainVideoList', params).then((resData) => {
// dataList.value=dataList.value.concat(resData.rows)
// totalNum.value=resData.total
// });
let maxPage=Math.ceil(totalNum.value/pageSize.value)
let params=({...formData})
let header={
'Authorization':uni.getStorageSync('Padmin-Token'),
'Content-Type': "application/x-www-form-urlencoded"
}
if (type === 'refresh') {
pageNum.value = 1;
params.pageSize=pageSize.value
params.pageNum=pageNum.value
$api.myRequest('/dispatch/assist/records/pageRecords', params,'get',9100,header).then((resData) => {
if(resData&&resData.code == 200){
dataList.value=resData.rows
totalNum.value=resData.total
}
});
}
if (type === 'add' && pageNum.value < maxPage) {
pageNum.value += 1;
params.pageSize=pageSize.value
params.pageNum=pageNum.value
$api.myRequest('/dispatch/assist/records/pageRecords', params,'get',9100,header).then((resData) => {
dataList.value=dataList.value.concat(resData.rows)
});
// }
dataList.value=[
{
name: '王小明',
idCard: '370781199107166029',
helperName: '喀什',
startTime: '2025/11/24',
endTime: '2025/11/25',
phone:'18340050862',
helpArea:'喀什地区',
helpUnit:'新生社区',
type:'招聘单位推荐',
assistanceDate:'2025/11/25',
nextContact:'2025/11/30',
id:'1'
},
{
name: '王大明',
idCard: '370781199107166029',
helperName: '喀什',
startTime: '2025/11/24',
endTime: '2025/11/25',
phone:'18340050862',
helpArea:'喀什地区',
helpUnit:'新生社区',
type:'招聘单位推荐',
assistanceDate:'2025/11/25',
nextContact:'2025/11/30',
id:'2'
},
]
}
}
function goFollow(item) {
navTo(`/packageB/priority/helpFollow?id=${item.id}`);
navTo(`/packageB/priority/helpFollow?id=${item.goal_person_id}&&name=${item.name}&&taskType=${getTaskTypeLabelByValue(item.task_type)}`);
}
</script>
@@ -412,11 +436,13 @@ image
width: 160rpx
font-size: 28rpx
color: #404040
flex-shrink: 0
.input,
.picker
background: #FFFFFF
flex: 1
min-width: 0
.list-box
margin-top: 40rpx
.con-box
@@ -456,9 +482,13 @@ image
.item-label
font-size: 26rpx
color: #B3B3B3
width: 130rpx
.item-right
font-size: 26rpx
color: #737373
overflow: hidden
text-overflow: ellipsis
white-space: nowrap
.form-btns
margin-top:30rpx
.form-box-btn

View File

@@ -7,7 +7,7 @@
人员姓名
</view>
<view class="info-value">
王小美
{{personInfo.name}}
</view>
</view>
<view class="info-item">
@@ -16,7 +16,7 @@
帮扶类型
</view>
<view class="info-value">
招聘岗位推荐
{{personInfo.taskType}}
</view>
</view>
</view>
@@ -32,22 +32,22 @@
<uni-forms ref="formRef" v-model="formData" :rules="rules" validate-trigger="submit" >
<!-- 跟进日期 -->
<uni-forms-item label="跟进日期:" name="followDate" required >
<uni-datetime-picker class="picker-value" type="date" placeholder="请选择跟进日期" v-model="formData.followDate" @change="onDateChange" />
<uni-datetime-picker class="picker-value" type="date" placeholder="请选择跟进日期" v-model="formData.followDate" @change="onFollowDateChange" />
</uni-forms-item>
<!-- 跟进方式 -->
<uni-forms-item label="跟进方式:" name="followMethod" required >
<uni-data-select v-model="formData.followMethod" placeholder="请选择跟进方式" :localdata="followMethods" @change="onMethodChange"></uni-data-select>
<uni-forms-item label="跟进方式:" name="followWay" required >
<uni-data-select v-model="formData.followWay" placeholder="请选择跟进方式" :localdata="followWays" @change="onMethodChange"></uni-data-select>
</uni-forms-item>
<!-- 跟进内容 -->
<uni-forms-item label="跟进内容:" name="followContent" required>
<uni-easyinput type="textarea" v-model="formData.followContent" placeholder="请输入跟进内容"></uni-easyinput>
<uni-forms-item label="跟进内容:" name="content" required>
<uni-easyinput type="textarea" v-model="formData.content" placeholder="请输入跟进内容"></uni-easyinput>
</uni-forms-item>
<!-- 跟进结果 -->
<uni-forms-item label="跟进结果:" name="followResult" required>
<uni-easyinput type="textarea" v-model="formData.followResult" placeholder="请输入跟进结果"></uni-easyinput>
<uni-forms-item label="跟进结果:" name="result" required>
<uni-easyinput type="textarea" v-model="formData.result" placeholder="请输入跟进结果"></uni-easyinput>
</uni-forms-item>
<!-- 下一步计划 -->
@@ -75,12 +75,13 @@
<view class="title-line"></view>
</view>
<view class="title-total">
<text class="total-num">7</text>条记录
<text class="total-num">{{followListNum}}</text>条记录
</view>
</view>
<view class="list-box" >
<uni-steps :options="list2" active-color="#007AFF" :active="active" direction="column" />
<view class="list-box" v-if="followListNum>0">
<uni-steps :options="followList" active-color="#007AFF" :active="active" direction="column" />
</view>
<empty v-else pdTop="200"></empty>
</view>
</AppLayout>
</template>
@@ -93,39 +94,22 @@ import config from "@/config.js"
const title = ref('');
const formData = reactive({
goalPersonId:'',
followDate: '',
followMethod: '',
followContent: '',
followResult: '',
followWay: '',
content: '',
result: '',
nextPlan: '',
nextContactDate: ''
})
const followMethods = [{
"value": 0,
"text": "电话"
}, {
"value": 1,
"text": "面谈"
}, {
"value": 2,
"text": "微信"
}, {
"value": 3,
"text": "邮件"
}]
const list2=[{
title: '买家下单',
desc: '跟进方式:电话\n跟进人新生社区管理员\n跟进内容内容内容内容'
}, {
title: '卖家发货',
desc: '跟进方式:电话\n跟进人新生社区管理员\n跟进内容内容内容内容'
}, {
title: '买家签收',
desc: '跟进方式:电话\n跟进人新生社区管理员\n跟进内容内容内容内容'
}, {
title: '交易完成',
desc: '跟进方式:电话\n跟进人新生社区管理员\n跟进内容内容内容内容'
}]
const personInfo=ref({
goalPersonId:'',
name:'',
taskType:''
})
const followWays = ref([])
const followList = ref([])
const followListNum=ref(0)
const active=ref(null)
// 表单引用
const formRef = ref(null)
@@ -138,19 +122,19 @@ const rules = {
errorMessage: '请选择跟进日期'
}]
},
followMethod: {
followWay: {
rules: [{
required: true,
errorMessage: '请选择跟进方式'
}]
},
followContent: {
content: {
rules: [{
required: true,
errorMessage: '请填写跟进内容'
}]
},
followResult: {
result: {
rules: [{
required: true,
errorMessage: '请填写跟进结果'
@@ -164,31 +148,108 @@ const getBackgroundStyle = (imageName) => ({
backgroundPosition: 'center', // 居中
backgroundRepeat: 'no-repeat'
});
const trainVideoImgUrl=config.trainVideoImgUrl
// 事件处理
const onDateChange = (field, e) => {
formData[field] = e.detail.value
const onFollowDateChange = (e)=>{
formData.followDate=e
}
const onMethodChange = (e) => {
formData.followWay=e
}
// 事件处理
const onDateChange = ( e) => {
formData.nextContactDate=e
}
function getFollowList(){
let header={
'Authorization':uni.getStorageSync('Padmin-Token'),
'Content-Type': "application/x-www-form-urlencoded"
}
let params={
goalPersonId:personInfo.value.goalPersonId
}
$api.myRequest('/dispatch/assist/records/getFollowList', params,'get',9100,header).then((resData) => {
console.log("resData",resData)
if(resData && resData.code == 200){
if(resData.data && resData.data.length>0){
followListNum.value=resData.data.length
resData.data.forEach(item=>{
const obj={
title:item.followDate,
desc:`跟进方式:${getFollowWaysLabelByValue(item.followWay)}\n跟进人${item.createByName}\n跟进内容${item.content}`
}
followList.value.push(obj)
})
}
}
});
}
function getDictionary(){
$api.myRequest('/system/public/dict/data/type/assist_follow_way').then((resData) => {
if(resData && resData.code == 200){
resData.data.forEach(item=>{
const obj = {
value: item.dictValue,
text: item.dictLabel
}
followWays.value.push(obj)
})
}
});
}
function getFollowWaysLabelByValue(value) {
if (!Array.isArray(followWays.value)) {
return ''
}
const item = followWays.value.find(item => item.value === String(value))
return item ? item.text : '暂无跟进方式'
}
const handleSubmit = () => {
formRef.value?.validate()
.then(() => {
uni.showToast({ title: '校验通过', icon: 'success' });
let header={
'Authorization':uni.getStorageSync('Padmin-Token')
}
formData.goalPersonId=personInfo.value.goalPersonId
$api.myRequest('/dispatch/assist/records/addRecords', formData,'post',9100,header).then((resData) => {
console.log("resData",resData)
if(resData && resData.code == 200){
handleReset()
uni.showToast({
title: '保存成功',
icon: 'success',
duration: 2000
});
}else{
uni.showToast({
title: resData.msg,
icon: 'none',
duration: 2000
});
}
});
})
.catch((errors) => {
console.log('校验失败:', errors);
uni.showToast({ title: '请填写必填项', icon: 'none' });
});
};
const handleReset = () => {
formData.followDate = '';
formData.followWay = '';
formData.content = '';
formData.result = '';
formData.nextPlan = '';
formData.nextContactDate = '';
}
onLoad(() => {
onLoad((options) => {
personInfo.value.goalPersonId=options.id
personInfo.value.name=options.name
personInfo.value.taskType=options.taskType
getDictionary()
getFollowList()
});

View File

@@ -0,0 +1,9 @@
<template>
<div>错题本</div>
</template>
<script>
</script>
<style>
</style>