|
@@ -0,0 +1,297 @@
|
|
|
+<script setup>
|
|
|
+import moment from "moment"
|
|
|
+import { computed, reactive,ref } from "vue"
|
|
|
+import ListClassify from './ListClassify.vue'
|
|
|
+import apiReport from '@/api/report'
|
|
|
+import {reportFrequencyOpts} from '../utils/config'
|
|
|
+import { showToast } from "vant"
|
|
|
+import {useEidtReportBaseInfo} from '../hooks/useEidtReportBaseInfo'
|
|
|
+
|
|
|
+
|
|
|
+const emits=defineEmits(['close'])
|
|
|
+
|
|
|
+// 基本数据
|
|
|
+const {reportBaseInfo} =useEidtReportBaseInfo()
|
|
|
+
|
|
|
+// 报告新增类型
|
|
|
+const showAddTypePop=ref(false)
|
|
|
+const addTypeOpts=[
|
|
|
+ {
|
|
|
+ value:1,
|
|
|
+ name:'新增报告'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value:2,
|
|
|
+ name:'继承报告'
|
|
|
+ }
|
|
|
+]
|
|
|
+function getAddTypeName(value){
|
|
|
+ return addTypeOpts.filter(item=>item.value===value)[0].name
|
|
|
+}
|
|
|
+function selectAddType(e){
|
|
|
+ reportBaseInfo.addType=e.value
|
|
|
+}
|
|
|
+
|
|
|
+// 报告所属分类
|
|
|
+const showClassifyPop=ref(false)
|
|
|
+const setClassifyVal=computed(()=>{
|
|
|
+ if(reportBaseInfo.classifyName.length===2){
|
|
|
+ return `${reportBaseInfo.classifyName[0].text}/${reportBaseInfo.classifyName[1].text}`
|
|
|
+ }
|
|
|
+ return '请选择分类'
|
|
|
+})
|
|
|
+function handleConfirmClassify({firstClassify,secondClassify}){
|
|
|
+ if(!firstClassify.id||!secondClassify.id){
|
|
|
+ showToast('请选择分类')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ reportBaseInfo.classifyName=[firstClassify,secondClassify]
|
|
|
+ showClassifyPop.value=false
|
|
|
+}
|
|
|
+
|
|
|
+// 研报作者
|
|
|
+const showAuthorPop=ref(false)
|
|
|
+const authorOpts=ref([])
|
|
|
+const temAuthorVal=ref([])
|
|
|
+function handleShowSelectAuthor(){
|
|
|
+ temAuthorVal.value=reportBaseInfo.author
|
|
|
+ showAuthorPop.value=true
|
|
|
+}
|
|
|
+function handleConfirmAuthor(){
|
|
|
+ reportBaseInfo.author=temAuthorVal.value
|
|
|
+ showAuthorPop.value=false
|
|
|
+}
|
|
|
+function getAuthorOpts(){
|
|
|
+ apiReport.reportAuthorList({}).then(res=>{
|
|
|
+ if(res.Ret===200){
|
|
|
+ authorOpts.value=res.Data?.List??[]
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+getAuthorOpts()
|
|
|
+
|
|
|
+// 报告频度
|
|
|
+const showFrequencyPop=ref(false)
|
|
|
+const temFrequencyVal=ref(['日度'])
|
|
|
+function handleConfirmFrequency(){
|
|
|
+ reportBaseInfo.frequency=temFrequencyVal.value
|
|
|
+ showFrequencyPop.value=false
|
|
|
+}
|
|
|
+
|
|
|
+// 创建日期
|
|
|
+const showCreateTimePop=ref(false)
|
|
|
+function handleConfirmCreatime(e){
|
|
|
+ reportBaseInfo.createtime=moment(e).format('YYYY-MM-DD')
|
|
|
+ showCreateTimePop.value=false
|
|
|
+}
|
|
|
+
|
|
|
+// 报告标题
|
|
|
+const showReportTitlePop=ref(false)
|
|
|
+const temReportTitleVal=ref('')
|
|
|
+function handleShowReportTitle(){
|
|
|
+ temReportTitleVal.value=reportBaseInfo.title
|
|
|
+ showReportTitlePop.value=true
|
|
|
+}
|
|
|
+function handleConfirmReportTitle(){
|
|
|
+ reportBaseInfo.title=temReportTitleVal.value
|
|
|
+ showReportTitlePop.value=false
|
|
|
+}
|
|
|
+
|
|
|
+// 摘要
|
|
|
+const showReportAbsPop=ref(false)
|
|
|
+const temReportAbsVal=ref('')
|
|
|
+function handleShowReportAbs(){
|
|
|
+ temReportAbsVal.value=reportBaseInfo.abstract
|
|
|
+ showReportAbsPop.value=true
|
|
|
+}
|
|
|
+function handleConfirmReportAbs(){
|
|
|
+ reportBaseInfo.abstract=temReportAbsVal.value
|
|
|
+ showReportAbsPop.value=false
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+function close(){
|
|
|
+ emits('close')
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <div class="report-baseinfo-wrap">
|
|
|
+ <van-cell-group>
|
|
|
+ <van-cell value-class="cell-con" required title="新增方式" :value="getAddTypeName(reportBaseInfo.addType)" is-link @click="showAddTypePop=true"/>
|
|
|
+ <van-cell value-class="cell-con" required title="分类" :value="setClassifyVal" is-link @click="showClassifyPop=true"/>
|
|
|
+ <van-cell value-class="cell-con" title="作者" :value="reportBaseInfo.author.join(',')" is-link @click="handleShowSelectAuthor"/>
|
|
|
+ <van-cell value-class="cell-con" title="频度" :value="reportBaseInfo.frequency.join('')" is-link @click="showFrequencyPop=true"/>
|
|
|
+ <van-cell value-class="cell-con" title="创建时间" :value="reportBaseInfo.createtime" is-link @click="showCreateTimePop=true"/>
|
|
|
+ </van-cell-group>
|
|
|
+
|
|
|
+ <van-cell-group style="margin:10px 0">
|
|
|
+ <van-cell required title="标题" :label="reportBaseInfo.title" is-link @click="handleShowReportTitle"/>
|
|
|
+ </van-cell-group>
|
|
|
+
|
|
|
+ <van-cell-group>
|
|
|
+ <van-cell title="摘要" :label="reportBaseInfo.abstract" is-link @click="handleShowReportAbs"/>
|
|
|
+ </van-cell-group>
|
|
|
+
|
|
|
+ <div class="bot-btns">
|
|
|
+ <van-button class="bot-btn" type="default" @click="close">取消</van-button>
|
|
|
+ <van-button class="bot-btn" type="primary">保存</van-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 新增方式 -->
|
|
|
+ <van-action-sheet
|
|
|
+ v-model:show="showAddTypePop"
|
|
|
+ cancel-text="取消"
|
|
|
+ close-on-click-action
|
|
|
+ :actions="addTypeOpts"
|
|
|
+ @select="selectAddType"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 分类 -->
|
|
|
+ <van-popup
|
|
|
+ v-model:show="showClassifyPop"
|
|
|
+ position="bottom"
|
|
|
+ round
|
|
|
+ >
|
|
|
+ <ListClassify
|
|
|
+ :hideDayWeek="1"
|
|
|
+ :firstClassifyDisabled="true"
|
|
|
+ @close="showClassifyPop=false"
|
|
|
+ @confirm="handleConfirmClassify"
|
|
|
+ />
|
|
|
+ </van-popup>
|
|
|
+
|
|
|
+ <!-- 作者 -->
|
|
|
+ <van-popup
|
|
|
+ v-model:show="showAuthorPop"
|
|
|
+ position="bottom"
|
|
|
+ :style="{ height: '100%' }"
|
|
|
+ >
|
|
|
+ <div class="select-author-pop">
|
|
|
+ <van-checkbox-group v-model="temAuthorVal">
|
|
|
+ <van-checkbox
|
|
|
+ v-for="item in authorOpts"
|
|
|
+ :key="item.Id"
|
|
|
+ :name="item.ReportAuthor"
|
|
|
+ >{{item.ReportAuthor}}</van-checkbox>
|
|
|
+ </van-checkbox-group>
|
|
|
+ <div class="bot-btns">
|
|
|
+ <van-button class="bot-btn" type="default" @click="showAuthorPop=false">取消</van-button>
|
|
|
+ <van-button class="bot-btn" type="primary" @click="handleConfirmAuthor">确定</van-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </van-popup>
|
|
|
+
|
|
|
+ <!-- 报告频度 -->
|
|
|
+ <van-popup
|
|
|
+ v-model:show="showFrequencyPop"
|
|
|
+ position="bottom"
|
|
|
+ round
|
|
|
+ >
|
|
|
+ <van-picker
|
|
|
+ v-model="temFrequencyVal"
|
|
|
+ title="选择频度"
|
|
|
+ :columns="reportFrequencyOpts"
|
|
|
+ @confirm="handleConfirmFrequency"
|
|
|
+ @cancel="showFrequencyPop=false"
|
|
|
+ />
|
|
|
+ </van-popup>
|
|
|
+
|
|
|
+ <!-- 创建日期 -->
|
|
|
+ <van-calendar
|
|
|
+ v-model:show="showCreateTimePop"
|
|
|
+ title="选择创建日期"
|
|
|
+ @confirm="handleConfirmCreatime"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 标题 -->
|
|
|
+ <van-popup
|
|
|
+ v-model:show="showReportTitlePop"
|
|
|
+ position="bottom"
|
|
|
+ :style="{ height: '100%' }"
|
|
|
+ >
|
|
|
+ <div class="input-report-title-pop">
|
|
|
+ <van-field v-model="temReportTitleVal" placeholder="请输入报告标题" />
|
|
|
+ <div class="bot-btns">
|
|
|
+ <van-button class="bot-btn" type="default" @click="showReportTitlePop=false">取消</van-button>
|
|
|
+ <van-button class="bot-btn" type="primary" :disabled="!temReportTitleVal" @click="handleConfirmReportTitle">确定</van-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </van-popup>
|
|
|
+
|
|
|
+ <!-- 摘要 -->
|
|
|
+ <van-popup
|
|
|
+ v-model:show="showReportAbsPop"
|
|
|
+ position="bottom"
|
|
|
+ :style="{ height: '100%' }"
|
|
|
+ >
|
|
|
+ <div class="input-report-title-pop">
|
|
|
+ <van-field type="textarea" autosize v-model="temReportAbsVal" placeholder="请输入报告摘要" />
|
|
|
+ <div class="bot-btns">
|
|
|
+ <van-button class="bot-btn" type="default" @click="showReportAbsPop=false">取消</van-button>
|
|
|
+ <van-button class="bot-btn" type="primary" :disabled="!temReportAbsVal" @click="handleConfirmReportAbs">确定</van-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </van-popup>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.report-baseinfo-wrap{
|
|
|
+ height: 100%;
|
|
|
+ position: relative;
|
|
|
+ background: #EDEDED;
|
|
|
+ :deep(.cell-con){
|
|
|
+ flex: 2;
|
|
|
+ }
|
|
|
+ .bot-btns{
|
|
|
+ position: absolute;
|
|
|
+ bottom: 48px;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+}
|
|
|
+.bot-btn{
|
|
|
+ width: 315px;
|
|
|
+ margin: 0 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.select-author-pop{
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ .van-checkbox-group{
|
|
|
+ padding: $page-padding;
|
|
|
+ flex: 1;
|
|
|
+ overflow-y: auto;
|
|
|
+ .van-checkbox{
|
|
|
+ :deep(.van-checkbox__label){
|
|
|
+ padding: 32px 0;
|
|
|
+ flex: 1;
|
|
|
+ border-bottom: 1px solid $border-color;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .bot-btns{
|
|
|
+ flex-shrink: 0;
|
|
|
+ padding: 20px 0;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+}
|
|
|
+.input-report-title-pop{
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: space-between;
|
|
|
+ background-color: $page-bg-grey;
|
|
|
+
|
|
|
+ .bot-btns{
|
|
|
+ flex-shrink: 0;
|
|
|
+ padding: 20px 0;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|