From cca8d423c4805665bbd48a47e4d9218b16d14ebb Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 28 三月 2025 17:42:35 +0800
Subject: [PATCH] 新增自动评估监测数据上传功能(待完成)
---
src/views/fysp/check/components/ArbitraryPhoto.vue | 357 ++--------------------------------------------------------
1 files changed, 16 insertions(+), 341 deletions(-)
diff --git a/src/views/fysp/check/components/ArbitraryPhoto.vue b/src/views/fysp/check/components/ArbitraryPhoto.vue
index ee39f50..52034e9 100644
--- a/src/views/fysp/check/components/ArbitraryPhoto.vue
+++ b/src/views/fysp/check/components/ArbitraryPhoto.vue
@@ -1,39 +1,19 @@
<template>
<FYImageSelectDialog
+ v-loading="loading"
+ title="鍦烘櫙鍥剧墖"
:typeList="typesList"
:typeImgMap="typesMap"
- :readonly="readonly"
- :maxSelect="3"
></FYImageSelectDialog>
</template>
<script>
-import problemApi from '@/api/fysp/problemApi.js';
import mediafileApi from '@/api/fysp/mediafileApi.js';
import { $fysp } from '@/api/index.js';
export default {
props: {
- filters: Map,
- // 鏄惁浠ュ彧璇荤殑褰㈠紡鏌ョ湅褰撳墠椤甸潰
- readonly: {
- type: Boolean,
- default: false
- },
subtask: {
type: Object,
efault: {}
- },
- inspectionGuid: {
- type: String,
- default: ''
- },
- defaultFile: {
- type: Array,
- default: () => []
- },
- // 鍥剧墖鍙�夋暟閲忥紝褰撲紶鍏ユ暟瀛楁椂锛屼唬琛ㄥ浘鐗囨暟閲�
- maxSelect: {
- type: Number,
- default: 3
}
},
data() {
@@ -41,94 +21,19 @@
// 鏃犳暟鎹�
typesList: [],
typesMap: new Map(),
- isEmpty: false,
- isClose: false,
- isAll: false,
- activeId: '',
- typeList: [
- // { businesstypeid: 5, businesstype: '甯歌璁板綍' },
- // { businesstypeid: 3, businesstype: '鐩戞祴璁惧' },
- // { businesstypeid: 7, businesstype: '閾墝' },
- // { businesstypeid: 51, businesstype: '鎵╁睍绫讳竴' },
- // { businesstypeid: 52, businesstype: '鎵╁睍绫讳簩' },
- // { businesstypeid: 53, businesstype: '鎵╁睍绫讳笁' },
- // { businesstypeid: 54, businesstype: '鎵╁睍绫诲洓' },
- // { businesstypeid: 55, businesstype: '鎵╁睍绫讳簲' },
- // { businesstypeid: 56, businesstype: '鎵╁睍绫诲叚' },
- // { businesstypeid: 57, businesstype: '鎵╁睍绫讳竷' },
- // { businesstypeid: 58, businesstype: '鎵╁睍绫诲叓' },
- // { businesstypeid: 59, businesstype: '鎵╁睍绫讳節' },
- // { businesstypeid: 60, businesstype: '鎵╁睍绫诲崄' }
- ],
- typeImgMap: new Map(),
- imgUrlList: [],
- selectedImgUrlList: []
+ loading: true,
};
},
- watch: {
- subtask: {
- handler(nV, oV) {
- if (nV != oV && nV) {
- this.getAllImgList();
- }
- },
- immediate: true
- },
- defaultFile: {
- handler(newFileList, oldFileList) {
- if (this.isClose) {
- return;
- }
- },
- deep: true
- },
- typeImgMap: {
- handler(newMap, oldMap) {
- if (this.isClose || newMap.get(this.activeId) == undefined) {
- return;
- }
- newMap.get(this.activeId).forEach((i) => {
- if (i.isSelect == true) {
- return;
- }
- this.defaultFile.forEach((imgItem) => {
- if (imgItem.url == i.url) {
- i.isSelect = true;
- this.selectedImgUrlList.push(i);
- }
- });
- });
- }
- }
- },
mounted() {
- // if (this.subtask) {
- // this.getAllImgList();
- // }
this.getGroupImgs();
},
methods: {
- onImageSelectSubmit(value) {
- this.$emit('selectByAnyPhonoEvent', value);
- },
// 鍥剧墖鍒嗙被
getGroupImgs() {
mediafileApi.getRoutineByStGuid(this.subtask.stGuid).then((res) => {
+ this.loading = true
let typeList = [];
let typeMap = new Map();
- function hasThisTypeName(typeName) {
- return typeList.map((item) => item.typeName).indexOf(typeName) != -1;
- }
- function addNewType(typeId, typeName, img) {
- typeList.push({
- typeId: typeId,
- typeName: typeName
- });
- typeMap.set(typeId, [img]);
- }
- function addToThisType(typeId, img) {
- typeMap.get(typeId).push(img);
- }
const data = res.data;
for (const e of data) {
let img = {
@@ -136,254 +41,24 @@
};
const businesstype = e.businesstype;
const businesstypeid = e.businesstypeid;
- if (hasThisTypeName(businesstype)) {
- addToThisType(businesstypeid, img);
+ if (
+ typeList.find((item) => item.typeName == businesstype) != undefined
+ ) {
+ typeMap.get(businesstypeid).push(img);
} else {
- addNewType(businesstypeid, businesstype, img);
+ typeList.push({
+ typeId: businesstypeid,
+ typeName: businesstype
+ });
+ typeMap.set(businesstypeid, [img]);
}
}
-
this.typesList = typeList;
this.typesMap = typeMap;
- });
- },
- // 鍒濆鍖栧垰寮�濮嬮�変腑鐨勬爣绛�
- initSelectedTab() {
- if (this.typeList.length > 0) {
- this.activeId = this.typeList[0].businesstypeid;
- }
- },
- getAllImgList() {
- // for(var k of this.typeImgMap.keys()) {
- // this.typeImgMap.set(k, [])
- // }
- this.typeImgMap.clear();
- this.typeList = [];
-
- const imgMap = new Map();
- const _typeList = [];
- mediafileApi.getRoutineByStGuid(this.subtask.stGuid).then((res) => {
- this.isEmpty = false;
- let data = res.data;
- if (data.length == 0) {
- this.isEmpty = true;
- }
- for (const e of data) {
- let list;
- let businesstypeid = e.businesstypeid;
- let businesstype = e.businesstype;
- let hasThisType = false;
- imgMap.forEach((v, k, m) => {
- if (k == businesstypeid) {
- hasThisType = true;
- var isAlreadyHas = false;
- if (v != undefined && v != null) {
- for (let index = 0; index < v.length; index++) {
- const element = v[index];
- if (element.guid == e.guid) {
- isAlreadyHas = true;
- break;
- }
- }
- }
- if (!isAlreadyHas) {
- v.push(e);
- }
- }
- });
- if (!hasThisType) {
- imgMap.set(businesstypeid, Array.of(e));
- _typeList.push(e);
- }
- this.imgUrlList.push(e);
- // TODO imgUrl鍏ㄥ眬閰嶇疆
- e.url = $fysp.imgUrl + e.extension1 + e.guid + '.jpg';
- e.isSelect = false;
- }
- this.typeImgMap = imgMap;
- this.typeList = _typeList;
- this.initSelectedTab();
- });
- },
- getInitImgList() {
- mediafileApi.getRoutineByStGuid(this.subtask.stGuid).then((res) => {
- let data = res.data;
- for (const e of data) {
- let list;
- let businesstypeid = e.businesstypeid;
- let businesstype = e.businesstype;
- let hasThisType = false;
- this.typeImgMap.forEach((v, k, m) => {
- if (k == businesstypeid) {
- hasThisType = true;
- if (v.length < 3) {
- v.push(e);
- }
- }
- });
- if (!hasThisType) {
- this.typeImgMap.set(businesstypeid, Array.of(e));
- this.typeList.push(e);
- }
- this.imgUrlList.push(e);
- // TODO imgUrl鍏ㄥ眬閰嶇疆
- e.url = $fysp.imgUrl + e.extension1 + e.guid + '.jpg';
- // e.url = "http://47.100.191.150:9005/images/" + e.extension1 + e.guid + '.jpg'
- e.isSelect = false;
- }
- if (this.typeList.length > 0) {
- this.activeId = this.typeList[0].businesstypeid;
- }
- });
- },
- onSelect(img, i) {
- if (this.readonly) {
- return;
- }
- const index = this.selectedImgUrlList.indexOf(img);
- if (index == -1) {
- if (this.maxSelect == 1) {
- img.isSelect = true;
- this.selectedImgUrlList.push(img);
- if (this.selectedImgUrlList.length > 1) {
- this.selectedImgUrlList.splice(0, 1).forEach((e) => {
- e.isSelect = false;
- });
- }
- } else if (this.maxSelect > 1) {
- if (this.selectedImgUrlList.length < this.maxSelect) {
- img.isSelect = true;
- this.selectedImgUrlList.push(img);
- }
- }
- } else {
- this.selectedImgUrlList.splice(index, 1);
- img.isSelect = false;
- }
-
- // img.isSelect = !img.isSelect;
- },
- sendSelectedImg(isOk) {
- let result = [];
- if (!isOk) {
- this.$emit('selectByAnyPhonoEvent', result);
- } else {
- for (const item of this.imgUrlList) {
- if (item.isSelect == true) {
- result.push(item);
- }
- }
- this.isClose = true;
- this.$emit('selectByAnyPhonoEvent', result);
- }
+ }).finally(() => (this.loading = false));
}
}
};
</script>
-<style scoped>
-.center {
- display: flex;
- flex-direction: column;
- align-items: center;
-}
-.text {
- padding: 20px;
-}
-
-.main {
- margin: 0 auto; /* 浣跨埗鍏冪礌灞呬腑 */
- height: 100%;
- width: 100%;
-}
-
-.btns {
- /* height: 10%; */
-}
-/*
-.img_types {
- margin: 0 auto;
- height: 440px;
- width: 900px;
- flex-grow: 1;
- overflow-y: hidden ;
- padding: 3%;
- flex-wrap: wrap;
- overflow: hidden;
-} */
-
-.imgs {
- height: 50vh;
- width: 90%;
- min-height: 100px !important;
- /* border-style:solid;
- border-radius: 1px; */
- /* height: 100%; */
- flex-grow: 1 !important;
- overflow-y: auto !important;
- /* 鍐呭鐨勫唴杈硅窛 */
- display: flex !important;
- flex-wrap: wrap !important;
- /* overflow: hidden; */
-}
-
-.image {
- margin: 5px;
- height: 210px;
- width: 200px;
- border-radius: 4px;
-}
-
-.active {
- padding: 5px;
- width: 20%;
- height: 200px;
- border: 0.5rem outset rgb(52, 155, 4);
-}
-
-.selected {
- margin: 3px;
- color: #4abe84;
- box-shadow: 0 2px 7px 0 rgba(85, 110, 97, 0.35);
- border: 2px solid rgba(74, 190, 132, 1);
-}
-
-.selected:before {
- content: '';
- position: absolute;
- right: 0;
- bottom: 0;
- border: 17px solid #4abe84;
- border-top-color: transparent;
- border-left-color: transparent;
-}
-
-.selected:after {
- content: '';
- width: 5px;
- height: 12px;
- position: absolute;
- right: 6px;
- bottom: 6px;
- border: 2px solid #fff;
- border-top-color: transparent;
- border-left-color: transparent;
- transform: rotate(45deg);
-}
-
-.noActive {
- /* padding: 5px; */
-}
-
-.blurry {
- filter: blur(3px);
-}
-.filters {
- display: flex;
- padding: 5px;
-}
-
-::v-deep .el-dialog__body {
- height: 60vh;
- padding: 10px calc(var(--el-dialog-padding-primary) + 10px) !important;
-}
-</style>
+<style scoped></style>
+
\ No newline at end of file
--
Gitblit v1.9.3