|
@@ -1,9 +1,11 @@
|
|
|
<script setup name="AddReportInfo">
|
|
|
import moment from 'moment'
|
|
|
-import {ref,reactive} from 'vue'
|
|
|
+import {ref,reactive, computed} from 'vue'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
import apiReport from '@/api/report'
|
|
|
import { showToast } from 'vant'
|
|
|
+import ListClassify from './ListClassify.vue'
|
|
|
+import CooperUserSelect from './CooperUserSelect.vue'
|
|
|
|
|
|
|
|
|
const router=useRouter()
|
|
@@ -17,13 +19,24 @@ const props = defineProps({
|
|
|
type: Object
|
|
|
}
|
|
|
})
|
|
|
-const emit = defineEmits(['close'])
|
|
|
+const emit = defineEmits(['close','change'])
|
|
|
|
|
|
+const relationVarietyLabel = computed(() => {
|
|
|
+ if(!reportBaseInfo.relationVariety) return ''
|
|
|
+
|
|
|
+ return reportBaseInfo.relationVariety.map(_ => _.PermissionName).join(',')
|
|
|
+})
|
|
|
+
|
|
|
+const cooperationUsersLabel = computed(() => {
|
|
|
+ if(!reportBaseInfo.cooperationUsers) return ''
|
|
|
+
|
|
|
+ return reportBaseInfo.cooperationUsers.map(_ => _.NodeName).join(',')
|
|
|
+})
|
|
|
|
|
|
const reportBaseInfo=reactive({
|
|
|
type: 1,
|
|
|
inheritId: 0,//继承report id
|
|
|
- classify: [],
|
|
|
+ classifyIds: [],
|
|
|
classifyName:'',
|
|
|
relationVariety: [],
|
|
|
title: "",
|
|
@@ -36,93 +49,74 @@ const reportBaseInfo=reactive({
|
|
|
isPublcPublish: 1
|
|
|
})
|
|
|
|
|
|
-function getClassifyList() {
|
|
|
|
|
|
+const reportAuthor = ref([])
|
|
|
+// 获取作者
|
|
|
+function getReportauthor() {
|
|
|
+ apiReport.reportAuthorList().then((res) => {
|
|
|
+ if (res.Ret == 200) {
|
|
|
+ reportAuthor.value = res.Data.List || [];
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
+getReportauthor()
|
|
|
|
|
|
|
|
|
|
|
|
-// 报告标题
|
|
|
-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 showAuthorPop=ref(false)
|
|
|
-const temAuthorVal=ref('')
|
|
|
-function handleShowAuthor(){
|
|
|
- temAuthorVal.value=reportBaseInfo.author
|
|
|
- showAuthorPop.value=true
|
|
|
-}
|
|
|
-function handleConfirmAuthor(){
|
|
|
- reportBaseInfo.author=temAuthorVal.value
|
|
|
- showAuthorPop.value=false
|
|
|
+// 分类弹窗
|
|
|
+const showClassify=ref(false)
|
|
|
+// 分类筛选
|
|
|
+function handleShowClassify() {
|
|
|
+ // temReportTitleVal.value=reportBaseInfo.title
|
|
|
+ showClassify.value=true
|
|
|
}
|
|
|
+function handleConfirmClassify(arr){
|
|
|
+ reportBaseInfo.classifyName = arr.map(_=>_.text).join('/')
|
|
|
+ reportBaseInfo.classifyIds = arr.map(_=>_.id);
|
|
|
+ showClassify.value=false
|
|
|
|
|
|
-
|
|
|
-// 创建日期
|
|
|
-const minDate=new Date(2015, 0, 1)
|
|
|
-const defaultDate=ref(new Date())
|
|
|
-const showCreateTimePop=ref(false)
|
|
|
-function handleShowCreatetime(){
|
|
|
- defaultDate.value=new Date(reportBaseInfo.time.replace(/-/g,'/'))
|
|
|
- showCreateTimePop.value=true
|
|
|
-}
|
|
|
-function handleConfirmCreatime(e){
|
|
|
- reportBaseInfo.time=moment(e).format('YYYY-MM-DD')
|
|
|
- showCreateTimePop.value=false
|
|
|
+ getRelationPermission()
|
|
|
+ handleUpdateBaseInfo()
|
|
|
}
|
|
|
+/* 获取关联品种 */
|
|
|
+async function getRelationPermission() {
|
|
|
+ if(!reportBaseInfo.classifyIds.length) return
|
|
|
|
|
|
+ const res = await apiReport.classifyPermissionList({ClassifyId:reportBaseInfo.classifyIds[reportBaseInfo.classifyIds.length-1]})
|
|
|
|
|
|
- //分类变化 获取关联品种
|
|
|
-function handleChangeClassify(val) {
|
|
|
- this.getRelationPermission()
|
|
|
- this.handleUpdateBaseInfo()
|
|
|
+ if(res.Ret!==200) return
|
|
|
+ reportBaseInfo.relationVariety = res.Data || []
|
|
|
}
|
|
|
|
|
|
function handleUpdateBaseInfo() {
|
|
|
- this.formData.inheritId = 0;
|
|
|
+ reportBaseInfo.inheritId = 0;
|
|
|
|
|
|
- if (this.formData.type === 1) {
|
|
|
- if (this.formData.classify.length === 2) {
|
|
|
- this.formData.title = this.getSelectClassifyName()[1];
|
|
|
- }
|
|
|
- }
|
|
|
- if(!this.formData.classify.length) return
|
|
|
+ if(!reportBaseInfo.classifyIds.length) return
|
|
|
|
|
|
|
|
|
//获取上次报告
|
|
|
- reportV2Interface
|
|
|
- .getAuthReportList({
|
|
|
- ClassifyIdFirst: this.formData.classify[0],
|
|
|
- ClassifyIdSecond: this.formData.classify[1],
|
|
|
- ClassifyIdThird: this.formData.classify[3],
|
|
|
+ apiReport.getAuthReportList({
|
|
|
+ ClassifyIdFirst: reportBaseInfo.classifyIds[0],
|
|
|
+ ClassifyIdSecond: reportBaseInfo.classifyIds[1],
|
|
|
+ ClassifyIdThird: reportBaseInfo.classifyIds[3],
|
|
|
CurrentIndex: 1,
|
|
|
PageSize:1,
|
|
|
Keyword:''
|
|
|
}).then((res) => {
|
|
|
if (res.Ret !== 200) return;
|
|
|
if (!res.Data.List) {
|
|
|
- this.$message.warning(
|
|
|
- this.$t("ReportManage.ReportList.no_reports_msg")
|
|
|
- );
|
|
|
+ showToast('该分类暂无报告')
|
|
|
+
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if(this.formData.type===1) { //默认只带出作者
|
|
|
- this.formData.author = res.Data.List
|
|
|
- ? res.Data.List[0].Author.split(",")
|
|
|
- : [''];
|
|
|
+ if(reportBaseInfo.type===1) { //默认只带出作者
|
|
|
+ reportBaseInfo.author = res.Data.List
|
|
|
+ ? res.Data.List[0].Author
|
|
|
+ : '';
|
|
|
}else {
|
|
|
- this.chooseInheritReport(res.Data.List[0])
|
|
|
+ chooseInheritReport(res.Data.List[0])
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -131,16 +125,14 @@ function handleUpdateBaseInfo() {
|
|
|
async function chooseInheritReport(item) {
|
|
|
const { Id,Title,Abstract,Author,CollaborateType,ReportLayout,IsPublicPublish,ClassifyIdFirst,ClassifyIdSecond,ClassifyIdThird } = item;
|
|
|
|
|
|
- this.formData.title = Title;
|
|
|
- this.formData.abstract = Abstract;
|
|
|
- this.formData.author = Author
|
|
|
- ? Author.split(",")
|
|
|
- : "";
|
|
|
- this.formData.cooperationType = CollaborateType;
|
|
|
- this.formData.inheritId = Id;
|
|
|
- this.formData.reportLayout = ReportLayout;
|
|
|
- this.formData.isPublcPublish = IsPublicPublish;
|
|
|
- this.formData.classify = ClassifyIdThird
|
|
|
+ reportBaseInfo.title = Title;
|
|
|
+ reportBaseInfo.abstract = Abstract;
|
|
|
+ reportBaseInfo.author = Author;
|
|
|
+ reportBaseInfo.cooperationType = CollaborateType;
|
|
|
+ reportBaseInfo.inheritId = Id;
|
|
|
+ reportBaseInfo.reportLayout = ReportLayout;
|
|
|
+ reportBaseInfo.isPublcPublish = IsPublicPublish;
|
|
|
+ reportBaseInfo.classifyIds = ClassifyIdThird
|
|
|
? [ClassifyIdFirst,ClassifyIdSecond,ClassifyIdThird]
|
|
|
: ClassifyIdSecond
|
|
|
? [ClassifyIdFirst,ClassifyIdSecond]
|
|
@@ -148,14 +140,14 @@ async function chooseInheritReport(item) {
|
|
|
|
|
|
//继承的章节报告默认带出协作人
|
|
|
if(CollaborateType===1) {
|
|
|
- this.formData.cooperationUsers = [];
|
|
|
+ reportBaseInfo.cooperationUsers = [];
|
|
|
}else {
|
|
|
- const res = await reportV2Interface.getRportBase({
|
|
|
+ const res = await apiReport.getRportBase({
|
|
|
ReportId: Id
|
|
|
})
|
|
|
if(res.Ret!==200) return
|
|
|
|
|
|
- this.formData.cooperationUsers = res.Data.GrandAdminList
|
|
|
+ reportBaseInfo.cooperationUsers = res.Data.GrandAdminList
|
|
|
? res.Data.GrandAdminList.map(_ => ({
|
|
|
NodeId: _.AdminId,
|
|
|
NodeName: _.AdminName
|
|
@@ -164,17 +156,102 @@ async function chooseInheritReport(item) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+//作者弹窗
|
|
|
+const showAuthorPop=ref(false)
|
|
|
+const temAuthorVal=ref('')
|
|
|
+function handleShowAuthor(){
|
|
|
+ temAuthorVal.value=reportBaseInfo.author
|
|
|
+ showAuthorPop.value=true
|
|
|
+}
|
|
|
+function handleConfirmAuthor(){
|
|
|
+ reportBaseInfo.author=temAuthorVal.value
|
|
|
+ showAuthorPop.value=false
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// 创建日期
|
|
|
+const minDate=new Date(2015, 0, 1)
|
|
|
+const defaultDate=ref(new Date())
|
|
|
+const showCreateTimePop=ref(false)
|
|
|
+function handleShowCreatetime(){
|
|
|
+ defaultDate.value=new Date(reportBaseInfo.time.replace(/-/g,'/'))
|
|
|
+ showCreateTimePop.value=true
|
|
|
+}
|
|
|
+function handleConfirmCreatime(e){
|
|
|
+ reportBaseInfo.time=moment(e).format('YYYY-MM-DD')
|
|
|
+ showCreateTimePop.value=false
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/* 协作人弹窗 */
|
|
|
+const isChooseCooperaUserPop = ref(false)
|
|
|
//选择协作人
|
|
|
-function handleChooseCooper() {
|
|
|
- this.isChooseCooperaUser = true
|
|
|
+function handleShowCooperUser() {
|
|
|
+ isChooseCooperaUserPop.value = true
|
|
|
}
|
|
|
+function handleConfirmCooperaUser() {
|
|
|
+ isChooseCooperaUserPop.value = false
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
function close() {
|
|
|
emit('close')
|
|
|
}
|
|
|
-function handleSave() {
|
|
|
-
|
|
|
+async function handleSave() {
|
|
|
+
|
|
|
+ let classifyNameArr = reportBaseInfo.classifyName.split(',')
|
|
|
+ const params = {
|
|
|
+ AddType: reportBaseInfo.type,
|
|
|
+ ClassifyIdFirst: reportBaseInfo.classifyIds[0]
|
|
|
+ ? reportBaseInfo.classifyIds[0]
|
|
|
+ : 0,
|
|
|
+ ClassifyNameFirst: classifyNameArr[0]||'',
|
|
|
+ ClassifyIdSecond: reportBaseInfo.classifyIds[1]
|
|
|
+ ? reportBaseInfo.classifyIds[1]
|
|
|
+ : 0,
|
|
|
+ ClassifyNameSecond: classifyNameArr[1]||'',
|
|
|
+ ClassifyIdThird: reportBaseInfo.classifyIds[2]
|
|
|
+ ? reportBaseInfo.classifyIds[2]
|
|
|
+ : 0,
|
|
|
+ ClassifyNameThird: classifyNameArr[2]||'',
|
|
|
+ Title: reportBaseInfo.title,
|
|
|
+ Abstract: reportBaseInfo.abstract,
|
|
|
+ Author: reportBaseInfo.author,
|
|
|
+ CreateTime: reportBaseInfo.time,
|
|
|
+ ReportLayout: reportBaseInfo.reportLayout,
|
|
|
+ CollaborateType: reportBaseInfo.cooperationType,
|
|
|
+ IsPublicPublish: reportBaseInfo.isPublcPublish,
|
|
|
+ InheritReportId: reportBaseInfo.inheritId,
|
|
|
+ GrantAdminIdList: reportBaseInfo.cooperationUsers.map(_ => _.NodeId)
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ // 编辑
|
|
|
+ if (props.id) {
|
|
|
+ emit("change", params);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ apiReport.reportAdd(params).then((res) => {
|
|
|
+ if (res.Ret === 200) {
|
|
|
+
|
|
|
+ let { href } = router.resolve({
|
|
|
+ path: reportBaseInfo.reportLayout===1
|
|
|
+ ? '/report/edit'
|
|
|
+ : "/smpartReportEditV2",
|
|
|
+ query: {
|
|
|
+ id: res.Data.ReportId,
|
|
|
+ coopType: params.CollaborateType
|
|
|
+ },
|
|
|
+ });
|
|
|
+ window.open(href, "_blank");
|
|
|
+
|
|
|
+ close();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
</script>
|
|
@@ -183,7 +260,12 @@ function handleSave() {
|
|
|
<van-cell-group>
|
|
|
<van-field name="radio" label="报告类型">
|
|
|
<template #input>
|
|
|
- <van-radio-group v-model="reportBaseInfo.type" direction="horizontal">
|
|
|
+ <van-radio-group
|
|
|
+ v-model="reportBaseInfo.type"
|
|
|
+ direction="horizontal"
|
|
|
+ @change="handleUpdateBaseInfo"
|
|
|
+ :disabled="id"
|
|
|
+ >
|
|
|
<van-radio :name="1">新增</van-radio>
|
|
|
<van-radio :name="2">继承</van-radio>
|
|
|
</van-radio-group>
|
|
@@ -196,34 +278,43 @@ function handleSave() {
|
|
|
title="报告分类"
|
|
|
:label="reportBaseInfo.classifyName"
|
|
|
is-link
|
|
|
+ @click="handleShowClassify"
|
|
|
/>
|
|
|
</van-cell-group>
|
|
|
- <van-cell-group>
|
|
|
+ <van-cell-group v-if="reportBaseInfo.relationVariety.length">
|
|
|
<van-cell
|
|
|
- required
|
|
|
- title="报告标题"
|
|
|
- :label="reportBaseInfo.title"
|
|
|
- is-link
|
|
|
- @click="handleShowReportTitle"
|
|
|
+ title="关联品种"
|
|
|
+ :label="relationVarietyLabel"
|
|
|
/>
|
|
|
</van-cell-group>
|
|
|
<van-cell-group>
|
|
|
- <van-cell
|
|
|
- required
|
|
|
- title="报告摘要"
|
|
|
- :label="reportBaseInfo.abstract"
|
|
|
- is-link
|
|
|
- @click="handleShowReportTitle"
|
|
|
+ <van-field
|
|
|
+ v-model="reportBaseInfo.title"
|
|
|
+ label="报告标题"
|
|
|
+ placeholder="请输入报告标题"
|
|
|
+ input-align="right"
|
|
|
+ />
|
|
|
+ </van-cell-group>
|
|
|
+ <van-cell-group>
|
|
|
+ <van-field
|
|
|
+ v-model="reportBaseInfo.abstract"
|
|
|
+ rows="2"
|
|
|
+ autosize
|
|
|
+ label="报告摘要"
|
|
|
+ type="textarea"
|
|
|
+ placeholder="请输入摘要"
|
|
|
+ input-align="right"
|
|
|
/>
|
|
|
</van-cell-group>
|
|
|
<van-cell-group>
|
|
|
<van-cell
|
|
|
required
|
|
|
title="报告作者"
|
|
|
- :label="reportBaseInfo.author"
|
|
|
+ :value="reportBaseInfo.author"
|
|
|
is-link
|
|
|
@click="handleShowAuthor"
|
|
|
/>
|
|
|
+
|
|
|
</van-cell-group>
|
|
|
<van-cell-group>
|
|
|
<van-cell
|
|
@@ -237,17 +328,33 @@ function handleSave() {
|
|
|
<van-cell-group>
|
|
|
<van-field name="radio" label="协作方式">
|
|
|
<template #input>
|
|
|
- <van-radio-group v-model="reportBaseInfo.cooperationType" direction="horizontal">
|
|
|
+ <van-radio-group
|
|
|
+ v-model="reportBaseInfo.cooperationType"
|
|
|
+ direction="horizontal"
|
|
|
+ :disabled="id||reportBaseInfo.type===2"
|
|
|
+ >
|
|
|
<van-radio :name="1">个人</van-radio>
|
|
|
<van-radio :name="2">多人协作</van-radio>
|
|
|
</van-radio-group>
|
|
|
</template>
|
|
|
</van-field>
|
|
|
</van-cell-group>
|
|
|
+ <van-cell-group>
|
|
|
+ <van-cell
|
|
|
+ title="协作人"
|
|
|
+ :value="cooperationUsersLabel"
|
|
|
+ is-link
|
|
|
+ @click="handleShowCooperUser"
|
|
|
+ />
|
|
|
+ </van-cell-group>
|
|
|
<van-cell-group>
|
|
|
<van-field name="radio" label="报告布局">
|
|
|
<template #input>
|
|
|
- <van-radio-group v-model="reportBaseInfo.reportLayout" direction="horizontal">
|
|
|
+ <van-radio-group
|
|
|
+ v-model="reportBaseInfo.reportLayout"
|
|
|
+ direction="horizontal"
|
|
|
+ :disabled="id||reportBaseInfo.type===2"
|
|
|
+ >
|
|
|
<van-radio :name="1">常规布局</van-radio>
|
|
|
<van-radio :name="2">智能布局</van-radio>
|
|
|
</van-radio-group>
|
|
@@ -276,32 +383,6 @@ function handleSave() {
|
|
|
</div>
|
|
|
|
|
|
|
|
|
- <!-- 标题 -->
|
|
|
- <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="showCreateTimePop"
|
|
@@ -345,6 +426,26 @@ function handleSave() {
|
|
|
</div>
|
|
|
</div>
|
|
|
</van-popup>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 分类弹窗 -->
|
|
|
+ <van-popup
|
|
|
+ v-model:show="showClassify"
|
|
|
+ :position="width>650?'center':'bottom'"
|
|
|
+ :style="width>650?{ width: '400px'}:''"
|
|
|
+ round
|
|
|
+ >
|
|
|
+ <ListClassify @close="showClassify=false" @confirm="handleConfirmClassify"/>
|
|
|
+ </van-popup>
|
|
|
+
|
|
|
+ <!-- 协作人弹窗 -->
|
|
|
+ <van-popup
|
|
|
+ v-model:show="isChooseCooperaUserPop"
|
|
|
+ :position="width>650?'center':'bottom'"
|
|
|
+ :style="width>650?{ width: '400px'}:''"
|
|
|
+ >
|
|
|
+ <CooperUserSelect @close="isChooseCooperaUserPop=false" @confirm="handleConfirmCooperaUser"/>
|
|
|
+ </van-popup>
|
|
|
</template>
|
|
|
<style scoped lang="scss">
|
|
|
.reportInfo-page{
|