From 056ea576d820729878ffd62cd54cd7598e72d07e Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期二, 29 七月 2025 16:07:31 +0800 Subject: [PATCH] 新增图片超出限制,无法选中功能 --- src/views/overlay-clue/report/components/ClueReportQuestion.vue | 6 + src/api/clue/clueTaskApi.js | 15 +++ src/components/map/baseMapUtil.js | 4 src/views/overlay-clue/report/components/QuestionDetail.vue | 25 +++- src/components.d.ts | 4 src/views/overlay-clue/report/ClueReport.vue | 40 ++++++++ src/api/fysp/userApi.js | 2 src/api/clue/clueApi.js | 2 src/views/overlay-clue/list/ClueManage.vue | 34 +++++- src/test.js | 112 ++++++++++++++++++++++ src/views/overlay-clue/list/components/ClueList.vue | 14 ++ 11 files changed, 238 insertions(+), 20 deletions(-) diff --git a/src/api/clue/clueApi.js b/src/api/clue/clueApi.js index 7087fe9..a7b25b1 100644 --- a/src/api/clue/clueApi.js +++ b/src/api/clue/clueApi.js @@ -40,7 +40,7 @@ */ pushClue(clueId) { return $clue - .post(`clue/push?clueId=${clueId}`) + .post(`clue/push?clueId=${clueId}`, {}) .then((res) => res.data); } }; diff --git a/src/api/clue/clueTaskApi.js b/src/api/clue/clueTaskApi.js index 42c151e..906f61b 100644 --- a/src/api/clue/clueTaskApi.js +++ b/src/api/clue/clueTaskApi.js @@ -44,5 +44,20 @@ */ deleteClueTask(clueTask) { return $clue.post(`clue/task/delete`, clueTask); + }, + + /** + * 瀹屾垚绾跨储浠诲姟 + * @param {*} clueTaskId + * @returns + */ + finishClueTask(clueTaskId) { + return $clue.post( + `clue/task/finish`, + {}, + { + params: { clueTaskId } + } + ); } }; diff --git a/src/api/fysp/userApi.js b/src/api/fysp/userApi.js index 022c9be..bb6f58c 100644 --- a/src/api/fysp/userApi.js +++ b/src/api/fysp/userApi.js @@ -28,7 +28,7 @@ * 鑷姩鍒涘缓璐︽埛 */ autoCreateAccount(sId) { - return $fysp.post(`userinfo/create?sceneId=${sId}`).then((res) => res.data); + return $fysp.post(`userinfo/create?sceneId=${sId}`, {}).then((res) => res.data); }, /** * 鑾峰彇鍦烘櫙瀵瑰簲鐨勯缇界幆澧冪郴缁熺敤鎴穒d diff --git a/src/components.d.ts b/src/components.d.ts index 692e2b1..bfd7bab 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -23,6 +23,7 @@ ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElIcon: typeof import('element-plus/es')['ElIcon'] + ElImage: typeof import('element-plus/es')['ElImage'] ElImageViewer: typeof import('element-plus/es')['ElImageViewer'] ElInput: typeof import('element-plus/es')['ElInput'] ElOption: typeof import('element-plus/es')['ElOption'] @@ -47,4 +48,7 @@ RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] } + export interface ComponentCustomProperties { + vLoading: typeof import('element-plus/es')['ElLoadingDirective'] + } } diff --git a/src/components/map/baseMapUtil.js b/src/components/map/baseMapUtil.js index ce3ad05..faa0e95 100644 --- a/src/components/map/baseMapUtil.js +++ b/src/components/map/baseMapUtil.js @@ -184,12 +184,12 @@ } }, gpsConvert(gps) { - return new Promise((reject) => { + return new Promise((resolve) => { // 鍙傛暟璇存槑锛氶渶瑕佽浆鎹㈢殑鍧愭爣锛岄渶瑕佽浆鎹㈢殑鍧愭爣绫诲瀷锛岃浆鎹㈡垚鍔熷悗鐨勫洖璋冨嚱鏁� AMap.convertFrom(gps, 'baidu', function (status, result) { if (result.info === 'ok') { var lnglats = result.locations; // 杞崲鍚庣殑楂樺痉鍧愭爣 Array.<LngLat> - reject(lnglats[0]); + resolve(lnglats[0]); } }); }); diff --git a/src/test.js b/src/test.js new file mode 100644 index 0000000..dd8db77 --- /dev/null +++ b/src/test.js @@ -0,0 +1,112 @@ +const PI = 3.1415926535897932384626; +const a = 6378245.0; //闀垮崐杞� +const ee = 0.00669342162296594323; //鎵佺巼/*** GCJ02 杞崲涓� WGS84* @param lng* @param lat* @returns {*[]}*/ + +function transformlat(lng, lat) { + // lat = +lat lng = +lng + let ret = + -100.0 + + 2.0 * lng + + 3.0 * lat + + 0.2 * lat * lat + + 0.1 * lng * lat + + 0.2 * Math.sqrt(Math.abs(lng)); + ret += + ((20.0 * Math.sin(6.0 * lng * PI) + + 20.0 * Math.sin(2.0 * lng * PI)) * + 2.0) / + 3.0; + ret += + ((20.0 * Math.sin(lat * PI) + 40.0 * Math.sin((lat / 3.0) * PI)) * + 2.0) / + 3.0; + ret += + ((160.0 * Math.sin((lat / 12.0) * PI) + + 320 * Math.sin((lat * PI) / 30.0)) * + 2.0) / + 3.0; + return ret; +} + +function transformlng(lng, lat) { + // lat = +latlng = +lng + let ret = + 300.0 + + lng + + 2.0 * lat + + 0.1 * lng * lng + + 0.1 * lng * lat + + 0.1 * Math.sqrt(Math.abs(lng)); + ret += + ((20.0 * Math.sin(6.0 * lng * PI) + + 20.0 * Math.sin(2.0 * lng * PI)) * + 2.0) / + 3.0; + ret += + ((20.0 * Math.sin(lng * PI) + 40.0 * Math.sin((lng / 3.0) * PI)) * + 2.0) / + 3.0; + ret += + ((150.0 * Math.sin((lng / 12.0) * PI) + + 300.0 * Math.sin((lng / 30.0) * PI)) * + 2.0) / + 3.0; + return ret; +} + +/** + * 鍒ゆ柇鏄惁鍦ㄥ浗鍐咃紝涓嶅湪鍥藉唴鍒欎笉鍋氬亸绉� + * @param lng + * @param lat + * @returns {boolean} + */ +function out_of_china(lng, lat) { + // 绾害3.86~53.55,缁忓害73.66~135.05 + return !(lng > 73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55); +} + +/** + * 楂樺痉鍦板浘鍧愭爣杞珿PS鍧愭爣绠楁硶 + */ +function gcj02towgs84(_lng, _lat) { + // lat = +latlng = +lng + const lng = parseFloat(_lng); + const lat = parseFloat(_lat); + if (out_of_china(lng, lat)) { + return [lng, lat]; + } else { + let dlat = transformlat(lng - 105.0, lat - 35.0); + let dlng = transformlng(lng - 105.0, lat - 35.0); + let radlat = (lat / 180.0) * PI; + let magic = Math.sin(radlat); + magic = 1 - ee * magic * magic; + let sqrtmagic = Math.sqrt(magic); + dlat = + (dlat * 180.0) / (((a * (1 - ee)) / (magic * sqrtmagic)) * PI); + dlng = (dlng * 180.0) / ((a / sqrtmagic) * Math.cos(radlat) * PI); + let mglat = + Math.round((lat * 2 - lat - dlat) * 1000000) / 1000000; + let mglng = + Math.round((lng * 2 - lng - dlng) * 1000000) / 1000000; + return [mglng, mglat]; + } +} + +const coor = [ + [121.451515, 31.312769], + [121.472702, 31.243941], + [121.472912, 31.243879], + [121.475128, 31.245564], + [121.473722, 31.246219], + [121.474832, 31.259213], + [121.475602, 31.261579], + [121.474975, 31.260291], + [121.474381, 31.259773], + [121.47412, 31.261534], + [121.456066, 31.313411] +]; + +coor.forEach((e) => { + const res = gcj02towgs84(e[0], e[1]); + console.log(res); +}); diff --git a/src/views/overlay-clue/list/ClueManage.vue b/src/views/overlay-clue/list/ClueManage.vue index b43cc8f..413110d 100644 --- a/src/views/overlay-clue/list/ClueManage.vue +++ b/src/views/overlay-clue/list/ClueManage.vue @@ -13,11 +13,11 @@ >鎷夊彇绾跨储</el-button > </div> - <el-scrollbar height="70vh" class="p-h-1"> + <el-scrollbar height="70vh" class="p-h-1" v-loading="loading"> <ClueList :dataList="clueList" @itemSelected="selectClue"> </ClueList> </el-scrollbar> - <el-row justify="space-between" class="p-8"> + <el-scrollbar v-show="showPage" class="p-8"> <el-pagination size="small" v-model:current-page="currentPage" @@ -27,7 +27,7 @@ layout="total, sizes, pager" :total="total" /> - </el-row> + </el-scrollbar> </div> </template> @@ -37,7 +37,7 @@ import clueApi from '@/api/clue/clueApi'; import { onMapMounted } from '@/components/map/baseMap'; import moment from 'moment'; -import { ref, onMounted, reactive } from 'vue'; +import { ref, onMounted, reactive, watch } from 'vue'; const emits = defineEmits('itemSelected'); @@ -46,13 +46,23 @@ // 绾跨储娓呭崟 const clueList = ref([]); const currentPage = ref(1); -const pageSize = ref(100); +const pageSize = ref(50); const total = ref(0); +const showPage = ref(true); +const loading = ref(false); + +watch([currentPage, pageSize], (nV, oV) => { + if (nV[0] != oV[0] || nV[1] != oV[1]) { + getClues(); + } +}); /** * 鏌ヨ宸蹭笅鍙戠殑绾跨储娓呭崟 */ const getClues = function () { + showPage.value = true; + loading.value = true; let sTime; let eTime; if (updateTime.value) { @@ -71,16 +81,22 @@ .then((res) => { total.value = res.head.totalCount; clueList.value = res.data; - }); + }) + .finally(() => (loading.value = false)); }); }; function fetchRemoteClue() { + showPage.value = false; + loading.value = true; const time = moment(updateTime.value).format('YYYY-MM-DD HH:mm:ss'); onMapMounted(() => { - clueApi.fetchRemoteClue(time).then((res) => { - clueList.value = res; - }); + clueApi + .fetchRemoteClue(time) + .then((res) => { + clueList.value = res; + }) + .finally(() => (loading.value = false)); }); } diff --git a/src/views/overlay-clue/list/components/ClueList.vue b/src/views/overlay-clue/list/components/ClueList.vue index 0b1c0c2..eb788b1 100644 --- a/src/views/overlay-clue/list/components/ClueList.vue +++ b/src/views/overlay-clue/list/components/ClueList.vue @@ -33,10 +33,18 @@ <el-row align="middle"> <el-text type="info" size="small">缁撹锛�</el-text> <el-tag + v-if="!isInternal" :type="item.cuploaded ? 'success' : 'danger'" effect="dark" > {{ item.cuploaded ? '宸叉帹閫�' : '鏈帹閫�' }} + </el-tag> + <el-tag + v-else + :type="item.conclusionCount > 0 ? 'success' : 'danger'" + effect="dark" + > + {{ item.conclusionCount > 0 ? '宸插~鎶�' : '鏈~鎶�' }} </el-tag> </el-row> <el-divider direction="vertical" /> @@ -85,6 +93,12 @@ var _marker; export default { + inject: { + // 鏄惁鏄唴閮ㄧ嚎绱㈢浉鍏虫搷浣� + isInternal: { + default: false + } + }, props: { dataList: Array }, diff --git a/src/views/overlay-clue/report/ClueReport.vue b/src/views/overlay-clue/report/ClueReport.vue index d342985..b952e9b 100644 --- a/src/views/overlay-clue/report/ClueReport.vue +++ b/src/views/overlay-clue/report/ClueReport.vue @@ -25,6 +25,30 @@ </div> </el-button> <el-button + v-else-if="clueTask" + class="push-btn" + :type="clueTask.finished ? 'success' : 'danger'" + @click="finishTask" + :disabled="clueTask.finished" + > + <div class="flex-col"> + <template v-if="clueTask.finished"> + <el-icon><Check /></el-icon> + <div>浠�</div> + <div>鍔�</div> + <div>瀹�</div> + <div>鎴�</div> + </template> + <template v-else> + <el-icon><Upload /></el-icon> + <div>缁�</div> + <div>鏉�</div> + <div>浠�</div> + <div>鍔�</div> + </template> + </div> + </el-button> + <el-button class="task-btn" :type="clueTask ? 'success' : 'danger'" @click="publishTask" @@ -128,6 +152,7 @@ }, pushClue() { return clueApi.pushClue(this.clueData.cid).then((res) => { + this.finishTask(); this.$emit('pushed', res); }); }, @@ -153,6 +178,21 @@ handelClueTaskEdit() { this.getClueTask(); this.$emit('onClueTaskChange'); + }, + finishTask() { + useMessageBoxTip({ + confirmMsg: '鏄惁缁撴潫绾跨储浠诲姟锛�', + confirmTitle: '缁撴潫绾跨储浠诲姟', + onConfirm: () => { + return clueTaskApi + .finishClueTask(this.clueTask.guid) + .then((res) => { + if (res.data == 1) { + this.clueTask.finished = true; + } + }); + } + }); } } }; diff --git a/src/views/overlay-clue/report/components/ClueReportQuestion.vue b/src/views/overlay-clue/report/components/ClueReportQuestion.vue index 35740f2..87aed2d 100644 --- a/src/views/overlay-clue/report/components/ClueReportQuestion.vue +++ b/src/views/overlay-clue/report/components/ClueReportQuestion.vue @@ -26,9 +26,13 @@ label="闂鍚嶇О" :content="item.cqName" /> - <DescriptionsListItem + <!-- <DescriptionsListItem label="鎵�鍦ㄨ闀�" :content="item.cqStreet" + /> --> + <DescriptionsListItem + label="璇︾粏鍦板潃" + :content="item.cqAddress" /> <DescriptionsListItem label="闂鎻忚堪" diff --git a/src/views/overlay-clue/report/components/QuestionDetail.vue b/src/views/overlay-clue/report/components/QuestionDetail.vue index 7352c04..5e8e57b 100644 --- a/src/views/overlay-clue/report/components/QuestionDetail.vue +++ b/src/views/overlay-clue/report/components/QuestionDetail.vue @@ -90,9 +90,10 @@ <el-icon><Plus /></el-icon> <template #file="{ file }"> <div> - <img + <el-image class="el-upload-list__item-thumbnail" :src="file.url" + fit="cover" alt="" /> <span class="el-upload-list__item-actions"> @@ -122,7 +123,7 @@ <template #tip> <div class="el-upload__tip"> {{ - `璇烽�夋嫨灏忎簬500kb鐨刯pg/png鍥剧墖锛屾渶澶�${maxImageCount}寮燻 + `璇烽�夋嫨灏忎簬5MB鐨刯pg/png鍥剧墖锛屾渶澶�${maxImageCount}寮燻 }} </div> </template> @@ -150,9 +151,7 @@ <MapSearch v-model:show="mapDialogShow" :defaultCoor=" - formObj.coordinate - ? formObj.coordinate.split(',') - : undefined + formObj.coordinate ? formObj.coordinate.split(',') : undefined " @on-submit="selectAddress" ></MapSearch> @@ -166,6 +165,9 @@ import clueQuestionApi from '@/api/clue/clueQuestionApi'; import { $clue } from '@/api/index'; import MapSearch from '@/components/map/MapSearch.vue'; + +// 鍥剧墖闄愬畾澶у皬锛堝崟浣嶏細B锛� +const IMG_MAX_SIZE = 4 * 1024 * 1024; // 鍐冲畾褰撳墠鏄惁鏄唴閮ㄧ嚎绱㈢浉鍏虫搷浣� const isInternal = inject('isInternal', false); @@ -246,7 +248,18 @@ } function handleFileChange(file, files) { - fileList.value = files; + // console.log('fileSelect', file); + // 鍒ゆ柇 + if (file.size > IMG_MAX_SIZE) { + const index = files.indexOf(file); + files.splice(index, 1); + ElMessage({ + message: '鍥剧墖澶у皬瓒呰繃闄愬埗', + type: 'error' + }); + } else { + fileList.value = files; + } edit.value = true; } -- Gitblit v1.9.3