增加处理意见展示
This commit is contained in:
@@ -363,11 +363,19 @@
|
||||
this.getDicts();
|
||||
},
|
||||
methods: {
|
||||
getDicts() {
|
||||
let res = getDicts("more_dept_name");
|
||||
if (res.code == 200) {
|
||||
console.log('res:',res)
|
||||
this.moreDeptList = [...res.data];
|
||||
async getDicts() {
|
||||
try {
|
||||
let res = await getDicts("more_dept_name");
|
||||
if (res.code == 200) {
|
||||
console.log('res:',res)
|
||||
this.moreDeptList = [...res.data];
|
||||
} else {
|
||||
console.error('获取部门字典数据失败:', res);
|
||||
this.moreDeptList = [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取部门字典数据异常:', error);
|
||||
this.moreDeptList = [];
|
||||
}
|
||||
},
|
||||
async getOwnFamily() {
|
||||
@@ -733,7 +741,19 @@
|
||||
this.formData.className = this.ownClassName;
|
||||
this.formData.name = this.ownName;
|
||||
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)
|
||||
// this.lookV = true;
|
||||
|
||||
@@ -128,7 +128,41 @@
|
||||
<view class="card">
|
||||
<view class="form-item">
|
||||
<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 class="form-item">
|
||||
<label>预计离校时间:</label>
|
||||
@@ -230,6 +264,18 @@
|
||||
<u-picker :show="showDeptPicker" :columns="[moreDeptList.map(item => item.dictValue)]" @confirm="onDeptConfirm"
|
||||
@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"
|
||||
@confirm="confirmCalendar"></u-calendar>
|
||||
@@ -240,23 +286,29 @@
|
||||
import DateTimePicker from "@/components/DateTimePicker.vue";
|
||||
|
||||
import {
|
||||
stuGetRecordBySvId,
|
||||
stuLeaveApply,
|
||||
stuHomeUpdate,
|
||||
} from '@/api/sur';
|
||||
import {
|
||||
getWxConfig
|
||||
} from "@/api/common/wechat";
|
||||
getWxConfig
|
||||
} from "@/api/common/wechat";
|
||||
import {
|
||||
stuGetRecordBySvId,
|
||||
stuHomeUpdate,
|
||||
stuLeaveApply,
|
||||
} from '@/api/sur';
|
||||
|
||||
import {
|
||||
getDicts
|
||||
} from "@/api/system/dict/data.js";
|
||||
isEmpty,
|
||||
isValidPhone
|
||||
} from "@/api/helpFunc/index.js";
|
||||
import {
|
||||
getDicts
|
||||
} from "@/api/system/dict/data.js";
|
||||
|
||||
import {
|
||||
isEmpty,
|
||||
isValidPhone
|
||||
} from "@/api/helpFunc/index.js";
|
||||
getCitiesByProvince,
|
||||
getCountiesByCity,
|
||||
provinceData
|
||||
} from "@/static/data/province-city-county.js";
|
||||
|
||||
import * as ww from '@wecom/jssdk'
|
||||
import * as ww from '@wecom/jssdk';
|
||||
export default {
|
||||
components: {
|
||||
DateTimePicker
|
||||
@@ -275,6 +327,25 @@
|
||||
showDeptPicker: false, //院校选择器
|
||||
showCalendar: false, //离校日期选择器
|
||||
modeCalendar: "range",
|
||||
// 省市县联动相关数据
|
||||
provinceList: [],
|
||||
cityList: [],
|
||||
countyList: [],
|
||||
selectedProvinceIndex: 0,
|
||||
selectedCityIndex: 0,
|
||||
selectedCountyIndex: 0,
|
||||
// 省市县选择弹窗控制
|
||||
showProvincePicker: false,
|
||||
showCityPicker: false,
|
||||
showCountyPicker: false,
|
||||
// 显示的省市县名称
|
||||
selectedProvinceName: '',
|
||||
selectedCityName: '',
|
||||
selectedCountyName: '',
|
||||
// 临时存储选中的省市县信息
|
||||
tempProvince: '',
|
||||
tempCity: '',
|
||||
tempCounty: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -295,6 +366,7 @@
|
||||
this.getstuGetRecordBySvId()
|
||||
}
|
||||
this.initWxConfig(); // 初始化微信配置
|
||||
this.initLocationData(); // 初始化省市县数据
|
||||
},
|
||||
async onShow() {
|
||||
this.getDicts();
|
||||
@@ -446,7 +518,16 @@
|
||||
|
||||
if (isEmpty(sdata.willAddr)) {
|
||||
uni.showToast({
|
||||
title: "请输入去向地",
|
||||
title: "请选择去向地",
|
||||
icon: "none",
|
||||
mask: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (isEmpty(sdata.willDetailAddr)) {
|
||||
uni.showToast({
|
||||
title: "请输入详细地址",
|
||||
icon: "none",
|
||||
mask: true
|
||||
});
|
||||
@@ -575,6 +656,10 @@
|
||||
that.formData = {
|
||||
...res.data
|
||||
};
|
||||
// 数据加载完成后,解析地址信息
|
||||
if (that.formData.willAddr) {
|
||||
that.parseAddressFromWillAddr(that.formData.willAddr);
|
||||
}
|
||||
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>
|
||||
@@ -725,4 +978,34 @@
|
||||
gap: 20rpx;
|
||||
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>
|
||||
Reference in New Issue
Block a user