增加处理意见展示

This commit is contained in:
2025-10-08 16:14:19 +08:00
parent b95239812d
commit d66216c669
5 changed files with 482 additions and 27 deletions

View File

@@ -6,8 +6,18 @@
</image> </image>
<image class="line" src="../../static/step-line.png" mode="widthFix"></image> <image class="line" src="../../static/step-line.png" mode="widthFix"></image>
<view class="right"> <view class="right">
<text>{{step.taskName}}:</text> <view class="step-header">
<text>{{step.assigneeName}}</text> <text class="task-name">{{step.taskName}}:</text>
<text class="assignee-name">{{step.assigneeName}}</text>
</view>
<view v-if="step.comment && step.comment.comment" class="comment">
<text class="comment-label">处理意见</text>
<text class="comment-text">{{step.comment.comment}}</text>
</view>
<view v-if="step.finishTime" class="finish-time">
<text class="time-label">处理时间</text>
<text class="time-text">{{step.finishTime}}</text>
</view>
</view> </view>
</view> </view>
<view class="loading-more-top" v-if="stepList.length==0"> <view class="loading-more-top" v-if="stepList.length==0">
@@ -51,11 +61,12 @@
.step { .step {
display: flex; display: flex;
align-items: center; align-items: flex-start;
margin-bottom: 50rpx; margin-bottom: 50rpx;
.icon { .icon {
width: 35rpx; width: 35rpx;
margin-top: 5rpx;
} }
.line { .line {
@@ -66,9 +77,55 @@
.right { .right {
flex: 1.4; flex: 1.4;
text:first-child { .step-header {
display: flex;
align-items: center;
margin-bottom: 10rpx;
.task-name {
color: #9E9E9E; color: #9E9E9E;
margin-right: 10rpx; margin-right: 10rpx;
font-size: 28rpx;
}
.assignee-name {
color: #333;
font-size: 28rpx;
font-weight: 500;
}
}
.comment {
margin-bottom: 8rpx;
padding: 8rpx 12rpx;
background-color: #f8f9fa;
border-radius: 8rpx;
border-left: 3rpx solid #007aff;
.comment-label {
color: #666;
font-size: 24rpx;
margin-right: 8rpx;
}
.comment-text {
color: #333;
font-size: 26rpx;
line-height: 1.4;
}
}
.finish-time {
.time-label {
color: #999;
font-size: 22rpx;
margin-right: 8rpx;
}
.time-text {
color: #666;
font-size: 22rpx;
}
} }
} }
} }

View File

@@ -19,9 +19,11 @@
"@dcloudio/uni-migration": "^2.0.2-4070520250711001", "@dcloudio/uni-migration": "^2.0.2-4070520250711001",
"@dcloudio/uni-stat": "^2.0.2-4070520250711001", "@dcloudio/uni-stat": "^2.0.2-4070520250711001",
"@dcloudio/vue-cli-plugin-uni": "^2.0.2-4070520250711001", "@dcloudio/vue-cli-plugin-uni": "^2.0.2-4070520250711001",
"@dcloudio/webpack-uni-pages-loader": "^2.0.2-4070620250821001",
"@vue/cli-service": "^5.0.8", "@vue/cli-service": "^5.0.8",
"@wecom/jssdk": "^2.3.1", "@wecom/jssdk": "^2.3.1",
"axios": "^1.11.0", "axios": "^1.11.0",
"china-area-data": "^5.0.1",
"dompurify": "^3.2.6", "dompurify": "^3.2.6",
"markdown-it": "^14.1.0", "markdown-it": "^14.1.0",
"weixin-js-sdk": "^1.6.5" "weixin-js-sdk": "^1.6.5"

View File

@@ -363,11 +363,19 @@
this.getDicts(); this.getDicts();
}, },
methods: { methods: {
getDicts() { async getDicts() {
let res = getDicts("more_dept_name"); try {
let res = await getDicts("more_dept_name");
if (res.code == 200) { if (res.code == 200) {
console.log('res:',res) console.log('res:',res)
this.moreDeptList = [...res.data]; this.moreDeptList = [...res.data];
} else {
console.error('获取部门字典数据失败:', res);
this.moreDeptList = [];
}
} catch (error) {
console.error('获取部门字典数据异常:', error);
this.moreDeptList = [];
} }
}, },
async getOwnFamily() { async getOwnFamily() {
@@ -733,7 +741,19 @@
this.formData.className = this.ownClassName; this.formData.className = this.ownClassName;
this.formData.name = this.ownName; this.formData.name = this.ownName;
this.formData.stuNo = this.ownStuNo; this.formData.stuNo = this.ownStuNo;
this.formData.moreDeptName = this.moreDeptList.filter(x => x.dictValue.includes(this.ownDeptName))[0].dictValue;
// 安全检查确保moreDeptList存在且不为空并且能找到匹配的部门
if (this.moreDeptList && this.moreDeptList.length > 0 && this.ownDeptName) {
const matchedDept = this.moreDeptList.filter(x => x && x.dictValue && x.dictValue.includes(this.ownDeptName));
if (matchedDept.length > 0) {
this.formData.moreDeptName = matchedDept[0].dictValue;
} else {
// 如果没有找到匹配的部门,使用第一个部门或者设置为空
this.formData.moreDeptName = this.moreDeptList[0] && this.moreDeptList[0].dictValue ? this.moreDeptList[0].dictValue : '';
}
} else {
this.formData.moreDeptName = '';
}
} }
// console.log("doEdit", this.formData) // console.log("doEdit", this.formData)
// this.lookV = true; // this.lookV = true;

View File

@@ -128,7 +128,41 @@
<view class="card"> <view class="card">
<view class="form-item"> <view class="form-item">
<label>去向地</label> <label>去向地</label>
<u-input :disabled="formData.leaveStatus == 2" placeholder="请输入" v-model="formData.willAddr" /> <view class="location-selector">
<view class="location-row">
<view class="input-wrapper" @click="showProvinceSelector">
<u-input
:disabled="formData.leaveStatus == 2"
placeholder="请选择省份"
v-model="selectedProvinceName"
readonly
style="pointer-events: none;">
</u-input>
</view>
<view class="input-wrapper" @click="showCitySelector">
<u-input
:disabled="formData.leaveStatus == 2 || !tempProvince"
placeholder="请选择城市"
v-model="selectedCityName"
readonly
style="pointer-events: none;">
</u-input>
</view>
<view class="input-wrapper" @click="showCountySelector">
<u-input
:disabled="formData.leaveStatus == 2 || !tempCity"
placeholder="请选择区县"
v-model="selectedCountyName"
readonly
style="pointer-events: none;">
</u-input>
</view>
</view>
</view>
</view>
<view class="form-item">
<label>详细地址</label>
<u-input :disabled="formData.leaveStatus == 2" placeholder="请输入详细地址" v-model="formData.willDetailAddr" />
</view> </view>
<view class="form-item"> <view class="form-item">
<label>预计离校时间</label> <label>预计离校时间</label>
@@ -230,6 +264,18 @@
<u-picker :show="showDeptPicker" :columns="[moreDeptList.map(item => item.dictValue)]" @confirm="onDeptConfirm" <u-picker :show="showDeptPicker" :columns="[moreDeptList.map(item => item.dictValue)]" @confirm="onDeptConfirm"
@cancel="showDeptPicker = false"></u-picker> @cancel="showDeptPicker = false"></u-picker>
<!-- 省份选择弹窗 -->
<u-picker :show="showProvincePicker" :columns="[provinceList.map(item => item.label)]" @confirm="onProvinceConfirm"
@cancel="showProvincePicker = false"></u-picker>
<!-- 城市选择弹窗 -->
<u-picker :show="showCityPicker" :columns="[cityList.map(item => item.label)]" @confirm="onCityConfirm"
@cancel="showCityPicker = false"></u-picker>
<!-- 区县选择弹窗 -->
<u-picker :show="showCountyPicker" :columns="[countyList.map(item => item.label)]" @confirm="onCountyConfirm"
@cancel="showCountyPicker = false"></u-picker>
<!-- 日期范围 --> <!-- 日期范围 -->
<u-calendar :show="showCalendar" :mode="modeCalendar" @close="showCalendar=false" <u-calendar :show="showCalendar" :mode="modeCalendar" @close="showCalendar=false"
@confirm="confirmCalendar"></u-calendar> @confirm="confirmCalendar"></u-calendar>
@@ -239,24 +285,30 @@
<script> <script>
import DateTimePicker from "@/components/DateTimePicker.vue"; import DateTimePicker from "@/components/DateTimePicker.vue";
import {
stuGetRecordBySvId,
stuLeaveApply,
stuHomeUpdate,
} from '@/api/sur';
import { import {
getWxConfig getWxConfig
} from "@/api/common/wechat"; } from "@/api/common/wechat";
import { import {
getDicts stuGetRecordBySvId,
} from "@/api/system/dict/data.js"; stuHomeUpdate,
stuLeaveApply,
} from '@/api/sur';
import { import {
isEmpty, isEmpty,
isValidPhone isValidPhone
} from "@/api/helpFunc/index.js"; } from "@/api/helpFunc/index.js";
import {
getDicts
} from "@/api/system/dict/data.js";
import * as ww from '@wecom/jssdk' import {
getCitiesByProvince,
getCountiesByCity,
provinceData
} from "@/static/data/province-city-county.js";
import * as ww from '@wecom/jssdk';
export default { export default {
components: { components: {
DateTimePicker DateTimePicker
@@ -275,6 +327,25 @@
showDeptPicker: false, //院校选择器 showDeptPicker: false, //院校选择器
showCalendar: false, //离校日期选择器 showCalendar: false, //离校日期选择器
modeCalendar: "range", modeCalendar: "range",
// 省市县联动相关数据
provinceList: [],
cityList: [],
countyList: [],
selectedProvinceIndex: 0,
selectedCityIndex: 0,
selectedCountyIndex: 0,
// 省市县选择弹窗控制
showProvincePicker: false,
showCityPicker: false,
showCountyPicker: false,
// 显示的省市县名称
selectedProvinceName: '',
selectedCityName: '',
selectedCountyName: '',
// 临时存储选中的省市县信息
tempProvince: '',
tempCity: '',
tempCounty: '',
} }
}, },
computed: { computed: {
@@ -295,6 +366,7 @@
this.getstuGetRecordBySvId() this.getstuGetRecordBySvId()
} }
this.initWxConfig(); // 初始化微信配置 this.initWxConfig(); // 初始化微信配置
this.initLocationData(); // 初始化省市县数据
}, },
async onShow() { async onShow() {
this.getDicts(); this.getDicts();
@@ -446,7 +518,16 @@
if (isEmpty(sdata.willAddr)) { if (isEmpty(sdata.willAddr)) {
uni.showToast({ uni.showToast({
title: "请输入去向地", title: "请选择去向地",
icon: "none",
mask: true
});
return;
}
if (isEmpty(sdata.willDetailAddr)) {
uni.showToast({
title: "请输入详细地址",
icon: "none", icon: "none",
mask: true mask: true
}); });
@@ -575,6 +656,10 @@
that.formData = { that.formData = {
...res.data ...res.data
}; };
// 数据加载完成后,解析地址信息
if (that.formData.willAddr) {
that.parseAddressFromWillAddr(that.formData.willAddr);
}
that.$forceUpdate(); that.$forceUpdate();
} }
}); });
@@ -657,6 +742,174 @@
} }
}); });
}, },
// 初始化省市县数据
initLocationData() {
// 初始化省份列表
this.provinceList = provinceData.map(province => ({
label: province.label,
value: province.value
}));
// 如果formData中已有地址数据则初始化选中状态
if (this.formData.willAddr) {
this.initSelectedLocation();
}
},
// 初始化已选择的省市县
initSelectedLocation() {
// 如果willAddr已有值尝试解析省市县信息
if (this.formData.willAddr) {
this.parseAddressFromWillAddr(this.formData.willAddr);
}
},
// 从willAddr解析省市区县信息
parseAddressFromWillAddr(address) {
if (!address) return;
// 遍历省份数据,尝试匹配
for (let province of this.provinceList) {
if (address.includes(province.label)) {
// 找到匹配的省份
this.selectedProvinceName = province.label;
this.tempProvince = province.value;
// 更新城市列表
this.cityList = getCitiesByProvince(province.value);
// 尝试匹配城市
for (let city of this.cityList) {
if (address.includes(city.label)) {
// 找到匹配的城市
this.selectedCityName = city.label;
this.tempCity = city.value;
// 更新区县列表
this.countyList = getCountiesByCity(city.value);
// 尝试匹配区县
for (let county of this.countyList) {
if (address.includes(county.label)) {
// 找到匹配的区县
this.selectedCountyName = county.label;
this.tempCounty = county.value;
break;
}
}
break;
}
}
break;
}
}
},
// 合并省市县为完整地址
combineLocation() {
if (this.selectedProvinceName && this.selectedCityName && this.selectedCountyName) {
this.formData.willAddr = `${this.selectedProvinceName}${this.selectedCityName}${this.selectedCountyName}`;
} else if (this.selectedProvinceName && this.selectedCityName) {
this.formData.willAddr = `${this.selectedProvinceName}${this.selectedCityName}`;
} else if (this.selectedProvinceName) {
this.formData.willAddr = this.selectedProvinceName;
}
},
// 省份选择确认
onProvinceConfirm(e) {
const selectedLabel = e.value[0];
this.selectedProvinceName = selectedLabel;
// 根据选中的标签找到对应的省份数据
const selectedProvince = this.provinceList.find(province => province.label === selectedLabel);
if (selectedProvince) {
this.formData.willProvince = selectedProvince.label;
this.tempProvince = selectedProvince.value;
// 更新城市列表
this.cityList = getCitiesByProvince(selectedProvince.value);
// 重置城市和区县选择
this.selectedCityName = '';
this.selectedCountyName = '';
this.formData.willCity = '';
this.formData.willCounty = '';
this.tempCity = '';
this.tempCounty = '';
this.countyList = [];
// 合并地址
this.combineLocation();
}
this.showProvincePicker = false;
},
// 城市选择确认
onCityConfirm(e) {
const selectedLabel = e.value[0];
this.selectedCityName = selectedLabel;
// 根据选中的标签找到对应的城市数据
const selectedCity = this.cityList.find(city => city.label === selectedLabel);
if (selectedCity) {
this.formData.willCity = selectedCity.label;
this.tempCity = selectedCity.value;
// 更新区县列表
this.countyList = getCountiesByCity(selectedCity.value);
// 重置区县选择
this.selectedCountyName = '';
this.formData.willCounty = '';
this.tempCounty = '';
// 合并地址
this.combineLocation();
}
this.showCityPicker = false;
},
// 区县选择确认
onCountyConfirm(e) {
const selectedLabel = e.value[0];
this.selectedCountyName = selectedLabel;
// 根据选中的标签找到对应的区县数据
const selectedCounty = this.countyList.find(county => county.label === selectedLabel);
if (selectedCounty) {
this.formData.willCounty = selectedCounty.label;
this.tempCounty = selectedCounty.value;
// 合并地址
this.combineLocation();
}
this.showCountyPicker = false;
},
// 显示省份选择器
showProvinceSelector() {
this.showProvincePicker = true;
},
// 显示城市选择器
showCitySelector() {
if (this.cityList.length > 0) {
this.showCityPicker = true;
} else {
this.$u.toast('请先选择省份');
}
},
// 显示区县选择器
showCountySelector() {
if (this.countyList.length > 0) {
this.showCountyPicker = true;
} else {
this.$u.toast('请先选择城市');
}
},
} }
} }
</script> </script>
@@ -725,4 +978,34 @@
gap: 20rpx; gap: 20rpx;
align-items: center; align-items: center;
} }
.location-selector {
width: 100%;
.location-row {
display: flex;
gap: 10rpx;
align-items: center;
.input-wrapper {
flex: 1;
min-width: 0;
cursor: pointer;
}
.u-picker {
flex: 1;
min-width: 0;
}
}
.selected-location {
margin-top: 10rpx;
padding: 16rpx 24rpx;
background-color: #f5f5f5;
border-radius: 8rpx;
font-size: 28rpx;
color: #666;
}
}
</style> </style>

View File

@@ -0,0 +1,93 @@
// 使用china-area-data包提供完整的省市区数据
import areaData from 'china-area-data';
// 转换数据格式为我们需要的格式
function convertAreaData() {
const provinces = [];
// 遍历省份
Object.keys(areaData['86']).forEach(provinceCode => {
const provinceName = areaData['86'][provinceCode];
const province = {
value: provinceCode,
label: provinceName,
children: []
};
// 遍历城市
if (areaData[provinceCode]) {
Object.keys(areaData[provinceCode]).forEach(cityCode => {
const cityName = areaData[provinceCode][cityCode];
const city = {
value: cityCode,
label: cityName,
children: []
};
// 遍历区县
if (areaData[cityCode]) {
Object.keys(areaData[cityCode]).forEach(countyCode => {
const countyName = areaData[cityCode][countyCode];
city.children.push({
value: countyCode,
label: countyName
});
});
}
province.children.push(city);
});
}
provinces.push(province);
});
return provinces;
}
// 生成完整的省市区数据
const provinceData = convertAreaData();
// 根据省份代码获取城市列表
function getCitiesByProvince(provinceCode) {
const province = provinceData.find(p => p.value === provinceCode);
return province ? province.children : [];
}
// 根据城市代码获取区县列表
function getCountiesByCity(cityCode) {
for (const province of provinceData) {
const city = province.children.find(c => c.value === cityCode);
if (city) {
return city.children;
}
}
return [];
}
// 根据代码获取名称
function getNameByCode(code) {
// 查找省份
for (const province of provinceData) {
if (province.value === code) {
return province.label;
}
// 查找城市
for (const city of province.children) {
if (city.value === code) {
return city.label;
}
// 查找区县
if (city.children) {
for (const county of city.children) {
if (county.value === code) {
return county.label;
}
}
}
}
}
return '';
}
export { provinceData, getCitiesByProvince, getCountiesByCity, getNameByCode };