From 2527a643d7ac70c7a4742b297972d46c8b1495a4 Mon Sep 17 00:00:00 2001 From: hcong <1050828145@qq.com> Date: 星期二, 12 十一月 2024 10:50:09 +0800 Subject: [PATCH] 问题审核bug修改 --- src/views/fysp/check/components/ArbitraryPhoto.vue | 98 ++++++++++++++++++++++++------------------------ 1 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/views/fysp/check/components/ArbitraryPhoto.vue b/src/views/fysp/check/components/ArbitraryPhoto.vue index 058136a..ee39f50 100644 --- a/src/views/fysp/check/components/ArbitraryPhoto.vue +++ b/src/views/fysp/check/components/ArbitraryPhoto.vue @@ -1,52 +1,10 @@ <template> - <div class="main"> - <el-row justify="end" class="btns" v-if="!readonly"> - <el-text size="small" type="info" class="m-r-8" - >鏈�澶氶�夋嫨{{ maxSelect }}寮犲浘鐗�</el-text - > - <el-button - size="small" - type="primary" - @click="sendSelectedImg(true)" - :disabled="selectedImgUrlList.length == 0" - >纭畾</el-button - > - <el-button size="small" type="primary" @click="sendSelectedImg(false)" - >鍙栨秷</el-button - > - </el-row> - - <div class="center"> - <!-- <el-descriptions> - <el-descriptions-item label="鎬绘暟"> - <span>{{ this.imgUrlList.length }}</span> - </el-descriptions-item> - </el-descriptions> --> - <el-tabs v-model="activeId" type="card"> - <el-tab-pane - v-for="item in typeList" - :key="item.businesstypeid" - :label=" - item.businesstype + ' (' + typeImgMap.get(activeId).length + ')' - " - :name="item.businesstypeid" - > - </el-tab-pane> - </el-tabs> - <el-empty v-if="isEmpty" description="鏆傛棤璁板綍" /> - <el-scrollbar class="imgs"> - <el-image - v-for="(img, i) in typeImgMap.get(activeId)" - :key="i" - :class="[Boolean(img.isSelect) ? 'selected' : 'noActive', 'image']" - fit="cover" - :src="img.url" - lazy - @click="onSelect(img, i)" - /> - </el-scrollbar> - </div> - </div> + <FYImageSelectDialog + :typeList="typesList" + :typeImgMap="typesMap" + :readonly="readonly" + :maxSelect="3" + ></FYImageSelectDialog> </template> <script> import problemApi from '@/api/fysp/problemApi.js'; @@ -81,6 +39,8 @@ data() { return { // 鏃犳暟鎹� + typesList: [], + typesMap: new Map(), isEmpty: false, isClose: false, isAll: false, @@ -138,15 +98,55 @@ } }); }); - }, + } } }, mounted() { // if (this.subtask) { // this.getAllImgList(); // } + this.getGroupImgs(); }, methods: { + onImageSelectSubmit(value) { + this.$emit('selectByAnyPhonoEvent', value); + }, + // 鍥剧墖鍒嗙被 + getGroupImgs() { + mediafileApi.getRoutineByStGuid(this.subtask.stGuid).then((res) => { + 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 = { + url: $fysp.imgUrl + e.extension1 + e.guid + '.jpg' + }; + const businesstype = e.businesstype; + const businesstypeid = e.businesstypeid; + if (hasThisTypeName(businesstype)) { + addToThisType(businesstypeid, img); + } else { + addNewType(businesstypeid, businesstype, img); + } + } + + this.typesList = typeList; + this.typesMap = typeMap; + }); + }, // 鍒濆鍖栧垰寮�濮嬮�変腑鐨勬爣绛� initSelectedTab() { if (this.typeList.length > 0) { -- Gitblit v1.9.3