|
@@ -9,8 +9,9 @@
|
|
|
<div class="filtratebox-phase">
|
|
|
<span class="filtratebox-phase-title">{{$t(`product.dataTarget`)}}:</span>
|
|
|
<div class="filtratebox-phase-content">
|
|
|
- <div class="phase-item" :class="[clickNum.target==='school' ? 'filter-click':'' ]" @click="clickNum.target='school'">school</div>
|
|
|
- <div class="phase-item" :class="[clickNum.target==='tmid' ? 'filter-click':'' ]" @click="clickNum.target='tmid'">tmid</div>
|
|
|
+ <div class="phase-item" :class="[clickNum.target==='school' ? 'filter-click':'' ]" @click="clickNum.target='school'">{{$t(`product.school`)}}</div>
|
|
|
+ <div class="phase-item" :class="[clickNum.target==='tmid' ? 'filter-click':'' ]" @click="clickNum.target='tmid'">{{$t(`product.tmid`)}}</div>
|
|
|
+ <div class="phase-item" :class="[clickNum.target==='geo' ? 'filter-click':'' ]" @click="clickNum.target='geo'">{{$t(`product.geo`)}}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!--产品类型-->
|
|
@@ -42,13 +43,10 @@
|
|
|
<div class="select-result">
|
|
|
<!--目标范围-->
|
|
|
<div v-show="clickNum.filter === 0">
|
|
|
- <div class="filtratebox-phase">
|
|
|
+ <div class="filtratebox-phase" v-show="clickNum.target==='school'">
|
|
|
<span class="filtratebox-phase-title subclass">{{productData.sourceName}}:</span>
|
|
|
<div class="filtratebox-phase-content">
|
|
|
<div class="phase-item" v-for="(items,index) in productData.source" :key="items.value" :class="[index ===clickNum.subject ? 'filter-click':'' ]" @click="(clickNum.subject=index,optionsValue='')">{{items.name}}</div>
|
|
|
- <!-- <div class="phase-item filter-click">456456</div>
|
|
|
- <div class="phase-item">456456</div>
|
|
|
- <div class="phase-item">456456</div> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="filtratebox-phase">
|
|
@@ -60,7 +58,7 @@
|
|
|
<div class="filtratebox-phase">
|
|
|
<span class="filtratebox-phase-title subclass">{{$t(`product.accurateSelect`)}}:</span>
|
|
|
<div class="filtratebox-phase-content precise">
|
|
|
- <div v-if="(clickNum.subject === 0 || clickNum.subject === 2) && clickNum.filter===0" class="schoolclass">
|
|
|
+ <div v-if="clickNum.target==='school' && (clickNum.subject === 0 || clickNum.subject === 2) && clickNum.filter===0" class="schoolclass">
|
|
|
<el-cascader v-model="optionsValue" :options="options" :props="props2" :collapse-tags=true :collapse-tags-tooltip=true filterable :filter-method="keywords" :placeholder="$t(`product.pleaseSelect`)">
|
|
|
</el-cascader>
|
|
|
<div class="addschoolbtn" @click="(adddialog=true,addvalue='',searchInit())">
|
|
@@ -875,15 +873,15 @@ function dataInit () {
|
|
|
ElMessage.error(proxy.$t(`product.apiErrpr`) + ',' + proxy.$t(`product.basicDataError`))
|
|
|
})
|
|
|
}
|
|
|
-function serachToresult(startTime, endTime, product, schools, unit, target) {
|
|
|
+function serachToresult(startTime, endTime, product, schools, unit, target, geo=null) {
|
|
|
// let data = { "dateFrom": "2023-04-12", "dateTo": "2023-04-19", "prod": "HiTeach", "schoolIds": ["tbslgb", "habook"], "dateUnit": "Day" }
|
|
|
if (!startTime || !endTime) {
|
|
|
ElMessage.info(proxy.$t(`product.timeRangeSelectError`))
|
|
|
return
|
|
|
}
|
|
|
searchLoading.value = true;
|
|
|
- let data = { "dateFrom": startTime, "dateTo": endTime, "prod": product, "schoolIds": schools, "dateUnit": unit, "target": target }
|
|
|
- console.log(data, '内容')
|
|
|
+ let data = { "dateFrom": startTime, "dateTo": endTime, "prod": product, "schoolIds": schools, "dateUnit": unit, "target": target, "geo": geo }
|
|
|
+ console.log(data, 'serachToresult data内容')
|
|
|
console.log(clickNum.value.time, '数字')
|
|
|
postData.value = data
|
|
|
proxy.$api.getUseproduct(data).then(async (res) => {
|
|
@@ -1065,7 +1063,7 @@ function timeChange (value) {
|
|
|
}
|
|
|
//整理数据内容
|
|
|
async function searchData () {
|
|
|
- console.log(optionsValue.value)
|
|
|
+ console.log(optionsValue.value) //國省市
|
|
|
console.log(productData.value.timevalue)
|
|
|
console.log(clickNum.value.filter, 'NUM')
|
|
|
console.log(clickNum.value.target, 'target')
|
|
@@ -1077,6 +1075,7 @@ async function searchData () {
|
|
|
let times = { start: productData.value.timevalue[0], end: productData.value.timevalue[1] }
|
|
|
let yearValues=''
|
|
|
let target = clickNum.value.target
|
|
|
+ let geo = null
|
|
|
clickNum.value.time === 2 ? (yearValues=productData.value.timevalue.slice(0,4),times.start=productData.value.timevalue,times.end=yearValues+'-12-31'):''
|
|
|
if (clickNum.value.filter === 0 && searchValue) { // 篩選類型 => 來源類型
|
|
|
if (clickNum.value.subject === 0) {// 目标范围 => 學校
|
|
@@ -1106,7 +1105,35 @@ async function searchData () {
|
|
|
console.log(optionsValue.value, '城市关键值')
|
|
|
console.log(typeof optionsValue.value, 'type')
|
|
|
let state = ''
|
|
|
+ geo = { "countryId": null, "provinceId": null, "cityId": null }
|
|
|
typeof optionsValue.value == 'string' ? state = 'province' : state = 'city'
|
|
|
+ if (state === 'province') {
|
|
|
+ if (siteValue === 'cn') {
|
|
|
+ geo.countryId = 'CN'
|
|
|
+ geo.provinceId = optionsData.find((obj) => obj.name === optionsValue.value).code;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ geo.countryId = optionsData.find((obj) => obj.name === optionsValue.value).code;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (state === 'city') {
|
|
|
+ if (siteValue === 'cn') {
|
|
|
+ geo.countryId = 'CN'
|
|
|
+ let provinceId = optionsData.find((obj) => obj.name === optionsValue.value[0]).code;
|
|
|
+ geo.provinceId = provinceId
|
|
|
+ let cityDic = optionsData.find((obj) => obj.code === provinceId).children;
|
|
|
+ let cityId = cityDic.find((obj) => obj.name === optionsValue.value[1]).code;
|
|
|
+ geo.cityId = cityId
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ let countryId = optionsData.find((obj) => obj.name === optionsValue.value[0]).code;
|
|
|
+ geo.countryId = countryId;
|
|
|
+ geo.provinceId = null;
|
|
|
+ let cityDic = optionsData.find((obj) => obj.code === countryId).children;
|
|
|
+ let cityId = cityDic.find((obj) => obj.name === optionsValue.value[1]).code;
|
|
|
+ geo.cityId = cityId
|
|
|
+ }
|
|
|
+ }
|
|
|
let resultData = await filterDistrict(state, optionsValue.value)
|
|
|
schoolArr = resultData
|
|
|
console.log(resultData, state, '省级查询及状态')
|
|
@@ -1123,17 +1150,23 @@ async function searchData () {
|
|
|
console.log(schoolArr, dateUnits, times, '结果')
|
|
|
!searchValue ? schoolArr = [] : ''
|
|
|
schoolArr = [...new Set(schoolArr)]
|
|
|
- serachToresult(times.start, times.end, "HiTeach", schoolArr, dateUnits, target)
|
|
|
+ serachToresult(times.start, times.end, "HiTeach", schoolArr, dateUnits, target, geo)
|
|
|
}
|
|
|
function serarchInit (value) {
|
|
|
let filterKey = value
|
|
|
- console.log(filterKey)
|
|
|
- if (filterKey === 0) {
|
|
|
+ if (clickNum.value.target === 'geo') { //取得對象:地理位置
|
|
|
+ filterKey = 1;
|
|
|
+ clickNum.value.filter = 1;
|
|
|
+ if (clickNum.value.district === 2) { //地區選擇若為"學區" => 改選"城市"
|
|
|
+ clickNum.value.district = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (filterKey === 0) { //篩選類型:來源類型
|
|
|
// dataSource.value.composite=
|
|
|
console.log(clickNum.value.subject, '0学区值0')
|
|
|
options.value = dataSource.value.composite
|
|
|
clickNum.value.subject === 2 ? options.value = optionsData : ''
|
|
|
- } else if (filterKey === 1) {
|
|
|
+ } else if (filterKey === 1) { //篩選類型:地區城市
|
|
|
options.value = optionsData
|
|
|
console.log(clickNum.value.district, '1学区值1')
|
|
|
clickNum.value.district === 2 ? options.value = dataSource.value.composite : ''
|