Jelajahi Sumber

Merge branch 'eta1.8' into debug

Karsa 1 bulan lalu
induk
melakukan
f68ccb1c33

+ 22 - 2
src/views/report/components/AddReportBaseInfoV2.vue

@@ -7,6 +7,7 @@ import { showToast } from 'vant'
 import { useWindowSize } from '@vueuse/core'
 import ListClassify from './ListClassify.vue'
 import CooperUserSelect from './CooperUserSelect.vue'
+import InheritReportSearch from './InheritReportSearch.vue'
 
 
 const router=useRouter()
@@ -228,6 +229,9 @@ function handleConfirmCooperaUser(e) {
 }
 
 
+/* 继承报告弹窗 */
+const isChooseInherReportPop = ref(false)
+
 
 
 function close() {
@@ -347,7 +351,11 @@ async function handleSave() {
         label="报告标题"
         placeholder="请输入报告标题"
         input-align="right"
-      />
+      >
+        <template #button v-if="reportBaseInfo.addType===2&&!id">
+          <van-button size="small" type="primary" @click="isChooseInherReportPop=true">选择继承报告</van-button>
+        </template>
+      </van-field>
     </van-cell-group>
     <van-cell-group>
       <van-field
@@ -497,7 +505,6 @@ async function handleSave() {
       position="bottom"
       :style="{height: '100%'}"
   >
-      <!-- :position="width>650?'center':'bottom'" -->
       <CooperUserSelect
         v-if="isChooseCooperaUserPop"
         :defaultVal="reportBaseInfo.cooperationUsers"
@@ -505,6 +512,19 @@ async function handleSave() {
         @confirm="handleConfirmCooperaUser"
       />
   </van-popup>
+
+  <!-- 继承报告弹窗 -->
+  <van-popup 
+      v-model:show="isChooseInherReportPop"
+      position="bottom"
+      :style="{height: '100%'}"
+  >
+      <InheritReportSearch
+        v-if="isChooseInherReportPop"
+        @close="isChooseInherReportPop=false" 
+        @confirm="chooseInheritReport"
+      />
+  </van-popup>
 </template>
 <style scoped lang="scss">
 .reportInfo-page{

+ 213 - 0
src/views/report/components/InheritReportSearch.vue

@@ -0,0 +1,213 @@
+<script setup name="InheritReportSearch">
+import {ref,reactive} from 'vue'
+import apiReport from '@/api/report'
+import { showToast } from 'vant'
+import moment from 'moment'
+import { useRouter } from 'vue-router'
+
+const emit = defineEmits(['close','confirm'])
+
+const router=useRouter()
+
+
+const keyword=ref('')
+const selectItem = ref({})
+const listState = reactive({
+    list:[],
+    page:1,
+    pageSize:20,
+    finished:false,
+    loading:false
+})
+async function getList(){
+    const res=await apiReport.getAuthReportList({
+        CurrentIndex:listState.page,
+        PageSize:listState.pageSize,
+        Keyword:keyword.value
+    })
+    if(res.Ret===200){
+        listState.loading=false
+        if(!res.Data){
+            listState.finished=true
+            return
+        }
+        
+        listState.finished=res.Data.Paging.IsEnd
+        const arr=res.Data.List||[]
+        listState.list=[...listState.list,...arr]
+    }
+}
+function onLoad(){
+    console.log('onload');
+    listState.page++
+    getList()
+}
+
+function handleSearch(){
+    if(!keyword.value){
+        showToast('请输入关键词')
+        return
+    }
+    listState.page=1
+    listState.list=[]
+    listState.finished=false
+    getList()
+}
+
+
+function handleCancle() {
+  emit('close')
+}
+function handleConfirm() {
+  handleCancle()
+	emit('confirm',selectItem.value)
+}
+</script>
+
+<template>
+    <div class="report-search-page">
+        <div class="search-box">
+            <van-search 
+                shape="round"
+                placeholder="请输入报告标题"
+                v-model="keyword"
+                @search="handleSearch"
+            />
+        </div>
+        
+
+        <img v-if="listState.list.length==0&&listState.finished&&keyword" class="list-empty-img" src="https://hzstatic.hzinsights.com/static/ETA_mobile/empty_img.png" alt="">
+        <template v-if="keyword">
+        <van-list
+            v-model:loading="listState.loading"
+            :finished="listState.finished"
+            :finished-text="listState.list.length>0?'没有更多了':'暂无报告'"
+            :immediate-check="false"
+            @load="onLoad"
+        >
+            <ul class="list-wrap">
+                <li 
+                    v-for="item in listState.list"
+                    :key="item.Id"
+                    :class="[
+                      'item',
+                      {'active': selectItem?.Id===item.Id}
+                    ]" 
+                    @click="selectItem=item"
+                >
+                    <h2 :class="['van-ellipsis title',item.Title.startsWith('【')?'inline-title':'']">{{item.Title}}</h2>
+                    <p class="van-multi-ellipsis--l2 des">{{item.Abstract}}</p>
+                    <div class="bot-info">
+                        <div>
+                            <span style="margin-right:10px">{{moment(item.ModifyTime).format('YYYY-MM-DD HH:mm:ss')}}</span>
+                            <span>(第{{item.Stage}}期)</span>
+                        </div>
+                        <div>{{item.ClassifyNameFirst}}</div>
+                    </div>
+                </li>
+            </ul>
+        </van-list>
+        </template>
+
+
+      <div class="bot-btns">
+          <van-button class="bot-btn" type="default" @click="handleCancle">取消</van-button>
+          <van-button class="bot-btn" type="primary" @click="handleConfirm">确定</van-button>
+      </div>
+    </div>
+</template>
+
+<style lang="scss" scoped>
+.list-wrap{
+    padding: 30px 34px;
+    .item{
+        padding: 20px;
+        margin-bottom: 20px;
+        border: 1px solid $border-color;
+        box-shadow: 0px 3px 12px rgba(52, 75, 120, 0.08);
+        border-radius: 8px;
+        .title{
+            font-size: 32px;
+            line-height: 44px;
+            margin: 0;
+        }
+        .inline-title{
+            margin-left: -14px;
+        }
+        .des{
+            margin-top: 10px;
+            margin-bottom: 20px;
+            font-size: 28px;
+            color: $font-grey;
+            min-height: 60px;
+        }
+        .bot-info{
+            display: flex;
+            justify-content: space-between;
+            color: $font-grey;
+            font-size: 28px;
+            .active-status{
+                color: $font-success;
+            }
+        }
+        &.active {
+          border-color: $theme-color;
+        }
+    }
+}
+.report-search-page{
+    padding-bottom: 130px;
+    .search-box{
+        position: sticky;
+        top: 0;
+        z-index: 99;
+        background-color: #fff;
+    }
+}
+.bot-btns{
+  width: 100%;
+  height: 130px;
+  position: fixed;
+  bottom: 0;
+  flex-shrink: 0;
+  padding: 20px 0;
+  text-align: center;
+  background-color: #fff;
+  .bot-btn {
+    width: 315px;
+    margin: 0 10px;
+  }
+}
+
+@media screen and (min-width:$media-width){
+    .list-wrap{
+        padding: 30px;
+        .item{
+            padding: 20px;
+            margin-bottom: 20px;
+            border-radius: 4px;
+            .title{
+                font-size: 16px;
+                line-height: 22px;
+            }
+            .inline-title{
+                margin-left: -14px;
+            }
+            .des{
+                margin-top: 5px;
+                margin-bottom: 10px;
+                font-size: 14px;
+                min-height: 30px;
+            }
+            .bot-info{
+                font-size: 14px;
+            }
+        }
+    }
+    .report-search-page{
+        .search-box{
+            top: 60px;
+        }
+    }
+}
+</style>