master
xy 2 years ago
parent f612399e92
commit 6fab0c4474

@ -94,21 +94,23 @@
<view class="sub-form1__row">
<view class="sub-form1__col1">
<u-input
disabled
v-model="flatForm[`${currentBatch.id}-${item.id}-${school.id}-code`]"
:height="50"
border
border-color="#e0e0e0"
input-align="center"
:clearable="false"
@click="forSchoolName = { needSpec: (school.specialty && school.specialty.length > 0), code: `${currentBatch.id}-${item.id}-${school.id}-code`, value: `${currentBatch.id}-${item.id}-${school.id}-value` },isShowSchoolSelect = true"></u-input>
@click="forSchoolName = { needSpec: (school.specialty && school.specialty.length > 0), code: `${currentBatch.id}-${item.id}-${school.id}-code`, value: `${currentBatch.id}-${item.id}-${school.id}-value` },getSchools(item.id),isShowSchoolSelect = true"></u-input>
</view>
<view class="sub-form1__col2">
<u-input
disabled
v-model="flatForm[`${currentBatch.id}-${item.id}-${school.id}-value`]"
:height="50" border border-color="#e0e0e0"
input-align="center"
:clearable="false"
@click="forSchoolName = { needSpec: (school.specialty && school.specialty.length > 0),code: `${currentBatch.id}-${item.id}-${school.id}-code`, value: `${currentBatch.id}-${item.id}-${school.id}-value` },isShowSchoolSelect = true"></u-input>
@click="forSchoolName = { needSpec: (school.specialty && school.specialty.length > 0), code: `${currentBatch.id}-${item.id}-${school.id}-code`, value: `${currentBatch.id}-${item.id}-${school.id}-value` },getSchools(item.id),isShowSchoolSelect = true"></u-input>
</view>
</view>
</view>
@ -132,6 +134,7 @@
</view>
<view class="sub-form2__col2">
<u-input
disabled
v-model="flatForm[`${currentBatch.id}-${item.id}-${school.id}-${specIndex}-code`]"
:height="50"
border
@ -142,6 +145,7 @@
</view>
<view class="sub-form2__col3">
<u-input
disabled
v-model="flatForm[`${currentBatch.id}-${item.id}-${school.id}-${specIndex}-value`]"
:height="50"
border
@ -260,6 +264,7 @@ export default {
},
isShowSchoolSelect: false,
schoolList: [],
schoolMap: new Map(),
isShowSpecSelect: false,
forSpecName: {
code: '',
@ -317,6 +322,23 @@ export default {
console.log(e)
if (e[0]) {
const { label, value, extra } = e[0]
const findSameSchoolName = Object.entries(this.flatForm).filter(([key, val]) => val === label)
let flag = false
const comparePrefix = (str1, str2) => {
const parts1 = str1.split('-');
const parts2 = str2.split('-');
return parts1[0] === parts2[0] && parts1[1] === parts2[1];
}
findSameSchoolName.forEach(([key, value]) => {
if (comparePrefix(key, this.forSchoolName.value)) {
flag = true
}
})
if (flag) {
this.$u.toast("选择学校重复")
return
}
if (this.forSchoolName.code) {
this.flatForm[this.forSchoolName.code] = value
}
@ -341,18 +363,23 @@ export default {
console.error(err)
}
},
async getSchools() {
async getSchools(batchSubId) {
try {
const { list } = await this.$u.api.schoolList({
page: 1,
page_size: 9999,
group: this.aspiration.group
})
this.schoolList = list.data.map(school => ({
this.schoolList = this.schoolMap.get(batchSubId)?.map(school => ({
value: school.code,
label: school.name,
extra: school.id
}))
})) || []
// const { list } = await this.$u.api.schoolList({
// page: 1,
// page_size: 9999,
// group: this.aspiration.group
// })
// this.schoolList = list.data.map(school => ({
// value: school.code,
// label: school.name,
// extra: school.id
// }))
// this.schoolList = this.areaList.map(area => ({
// id: area.id,
// value: area.id,
@ -381,6 +408,9 @@ export default {
try {
const { batchSubs } = await this.$u.api.batchDetail({ id: batchId })
this.batchSub[batchId] = batchSubs
batchSubs.forEach(batchSub => {
this.schoolMap.set(batchSub.id, batchSub.school)
})
const formBatch = this.subForm.find(i => i.batchId === batchId)
formBatch.batchSubs = batchSubs.map(resSub => ({
@ -457,10 +487,20 @@ export default {
this.form.aspiration_id = list[0].id
this.aspiration = list[0]
if (this.aspiration.image_id && this.aspiration.image) {
this.$u.route({
url: '/package_sub/pages/LoadImage/LoadImage',
params: {
src: this.aspiration.image.url
}
})
return
}
this.setTitle()
} else {
this.$u.toast("暂未获取到当年模版")
this.stepClick('prev')
return 1
}
} catch (err) {
console.error(err)
@ -468,16 +508,18 @@ export default {
},
async stepClick(type='next') {
if (type === 'next') {
let notConfig
if (this.step === 1 && !this.config) {
await this.getConfig()
await this.getSchools()
notConfig = await this.getConfig()
// await this.getSchools()
}
if (this.step < (1 + this.batches.length)) {
if (this.step < (1 + this.batches.length) && !notConfig) {
this.step = this.step + 1
}
} else if (type === 'prev') {
if (this.step === 1) {
this.form.group = ''
this.aspiration = null
this.config = null
}
else if (this.step > 1) {
@ -592,7 +634,7 @@ export default {
},
created() {
this.getArea().then(_ => {
this.getSchools()
// this.getSchools()
})
},
}

@ -0,0 +1,22 @@
<template>
<view>
<u-image :src="src" mode="widthFix"></u-image>
</view>
</template>
<script>
export default {
data() {
return {
src: ''
};
},
onLoad(options) {
this.src = options.src
}
}
</script>
<style lang="scss">
</style>

@ -106,15 +106,19 @@
{
"path": "pages/webview/webview",
"style": {
"navigationBarTitleText": "页面",
"enablePullDownRefresh": true
"navigationBarTitleText": "页面"
}
},
{
"path": "pages/RecommendForm/RecommendForm",
"style": {
"navigationBarTitleText": "冲、稳、保",
"enablePullDownRefresh": true
"navigationBarTitleText": "冲、稳、保"
}
},
{
"path": "pages/LoadImage/LoadImage",
"style": {
"navigationBarTitleText": " "
}
}
]

Loading…
Cancel
Save