|
@@ -1,316 +0,0 @@
|
|
|
-<template>
|
|
|
- <el-dialog
|
|
|
- :title="$t('ReportManage.ReportList.information_title')"
|
|
|
- :visible.sync="show"
|
|
|
- :modal-append-to-body="false"
|
|
|
- :close-on-click-modal="false"
|
|
|
- :center="true"
|
|
|
- v-dialogDrag
|
|
|
- custom-class="dialogclass"
|
|
|
- width="440px"
|
|
|
- @close="handleClose"
|
|
|
- >
|
|
|
- <el-form
|
|
|
- :model="formData"
|
|
|
- :rules="rules"
|
|
|
- ref="baseinfoForm"
|
|
|
- class="baseinfo-form-wrap"
|
|
|
- >
|
|
|
- <el-form-item prop="type">
|
|
|
- <el-radio-group v-model="formData.type" :disabled="id" @change="handleUpdateBaseInfo">
|
|
|
- <el-radio :label="1">{{$t('ReportManage.ReportList.new_report_radio')}}</el-radio>
|
|
|
- <el-radio :label="2">{{$t('ReportManage.ReportList.inherit_report_radio')}}</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="classify">
|
|
|
- <el-cascader
|
|
|
- ref="cascader"
|
|
|
- :options="classifyArr"
|
|
|
- v-model="formData.classify"
|
|
|
- :placeholder="$t('ReportManage.ReportList.please_select_category')"
|
|
|
- size="medium"
|
|
|
- style="width:340px"
|
|
|
- @change="handleUpdateBaseInfo"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="title">
|
|
|
- <el-input :placeholder="$t('ReportManage.ReportList.input_title_please')" v-model="formData.title" style="width:340px"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="abstract">
|
|
|
- <el-input type="textarea" :placeholder="$t('ReportManage.ReportList.please_input_abstract')" v-model="formData.abstract" style="width:340px"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="author">
|
|
|
- <el-select
|
|
|
- v-model="formData.author"
|
|
|
- multiple
|
|
|
- :placeholder="$t('ReportManage.ReportList.please_select_author')"
|
|
|
- size="medium"
|
|
|
- style="width: 340px"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="(item, i) in authorlist"
|
|
|
- :key="i"
|
|
|
- :label="item.ReportAuthor"
|
|
|
- :value="item.ReportAuthor"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="frequency">
|
|
|
- <el-select
|
|
|
- v-model="formData.frequency"
|
|
|
- :placeholder="$t('ReportManage.ReportList.please_select_frequency')"
|
|
|
- size="medium"
|
|
|
- style="width: 340px"
|
|
|
- >
|
|
|
- <el-option :label="$t('ReportManage.smart_annually')" :value="$t('ReportManage.smart_annually')"></el-option>
|
|
|
- <el-option :label="$t('ReportManage.smart_semi_annually')" :value="$t('ReportManage.smart_semi_annually')"></el-option>
|
|
|
- <el-option :label="$t('ReportManage.smart_quarterly')" :value="$t('ReportManage.smart_quarterly')"></el-option>
|
|
|
- <el-option :label="$t('ReportManage.smart_monthly')" :value="$t('ReportManage.smart_monthly')"></el-option>
|
|
|
- <el-option :label="$t('ReportManage.smart_bi_weekly')" :value="$t('ReportManage.smart_bi_weekly')"></el-option>
|
|
|
- <el-option :label="$t('ReportManage.smart_weekly')" :value="$t('ReportManage.smart_weekly')"></el-option>
|
|
|
- <el-option :label="$t('ReportManage.smart_daily')" :value="$t('ReportManage.smart_daily')"></el-option>
|
|
|
- <el-option :label="$t('ReportManage.smart_irregularly')" :value="$t('ReportManage.smart_irregularly')"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="time">
|
|
|
- <el-date-picker
|
|
|
- v-model="formData.time"
|
|
|
- type="date"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- :placeholder="$t('ReportManage.ReportList.please_select_date')"
|
|
|
- size="medium"
|
|
|
- :clearable="false"
|
|
|
- style="width: 340px"
|
|
|
- ></el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <div style="text-align:center;margin-top:60px;margin-bottom:40px">
|
|
|
- <el-button type="primary" plain style="width:120px" @click="handleClose">{{$t('Dialog.cancel_btn')}}</el-button>
|
|
|
- <el-button type="primary" style="width:120px" @click="handleConfirm">{{$t('Dialog.confirm_btn')}}</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
-import {apiSmartReport} from '@/api/modules/smartReport'
|
|
|
-export default {
|
|
|
- name:"BaseInfo",
|
|
|
- model:{
|
|
|
- prop:'show',
|
|
|
- event:'showChange'
|
|
|
- },
|
|
|
- props:{
|
|
|
- show:{
|
|
|
- type:Boolean,
|
|
|
- default:false
|
|
|
- },
|
|
|
- id:{
|
|
|
- type:Number,
|
|
|
- default:0
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- show(n){
|
|
|
- if(!n){
|
|
|
- this.formData.type=1
|
|
|
- this.formData.classify=[]
|
|
|
- this.formData.title=''
|
|
|
- this.formData.abstract=''
|
|
|
- this.formData.author=['投研团队']
|
|
|
- this.formData.frequency='日度'
|
|
|
- this.formData.time=this.$moment().format('YYYY-MM-DD')
|
|
|
- }else{
|
|
|
- if(this.id){
|
|
|
- apiSmartReport.reportDetail({
|
|
|
- SmartReportId:Number(this.id)
|
|
|
- }).then(res=>{
|
|
|
- if(res.Ret===200){
|
|
|
- this.formData.type=res.Data.AddType
|
|
|
- this.formData.classify=[res.Data.ClassifyIdFirst,res.Data.ClassifyIdSecond]
|
|
|
- this.formData.title=res.Data.Title
|
|
|
- this.formData.abstract=res.Data.Abstract
|
|
|
- this.formData.author=res.Data.Author ? res.Data.Author.split(',') : []
|
|
|
- this.formData.frequency=res.Data.Frequency
|
|
|
- this.formData.time=res.Data.CreateTime
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
-
|
|
|
- formData:{
|
|
|
- type:1,
|
|
|
- classify:[],
|
|
|
- title:'',
|
|
|
- abstract:'',
|
|
|
- author:['投研团队'],
|
|
|
- frequency:'日度',
|
|
|
- time:this.$moment().format('YYYY-MM-DD')||''
|
|
|
- },
|
|
|
- classifyArr:[],
|
|
|
- authorlist:[]
|
|
|
- }
|
|
|
- },
|
|
|
- computed:{
|
|
|
- rules(){
|
|
|
- return {
|
|
|
- type:[{ required: true, message: this.$t('ReportManage.ReportList.please_report_type_select'), trigger: 'change' }],
|
|
|
- classify:[{ required: true, message: this.$t('ReportManage.ReportList.please_report_type_select'), trigger: 'change' }],
|
|
|
- title:[{ required: true, message: this.$t('ReportManage.ReportList.please_report_title_input'), trigger: 'blur' }],
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- handleClose(){
|
|
|
- this.$emit('showChange', false)
|
|
|
- },
|
|
|
-
|
|
|
- handleConfirm(){
|
|
|
- this.$refs.baseinfoForm.validate((valid)=>{
|
|
|
- if(valid){
|
|
|
-
|
|
|
- const params={
|
|
|
- AddType: this.formData.type,
|
|
|
- ClassifyIdFirst: this.formData.classify[0]?this.formData.classify[0]:0,
|
|
|
- ClassifyNameFirst: '',
|
|
|
- ClassifyIdSecond:this.formData.classify[1]?this.formData.classify[1]:0,
|
|
|
- ClassifyNameSecond:'',
|
|
|
- Title: this.formData.title,
|
|
|
- Abstract: this.formData.abstract,
|
|
|
- Author:
|
|
|
- this.formData.author.length > 0
|
|
|
- ? this.formData.author.join(',')
|
|
|
- : '',
|
|
|
- Frequency: this.formData.frequency,
|
|
|
- CreateTime: this.formData.time,
|
|
|
- }
|
|
|
- this.classifyArr.forEach(item=>{
|
|
|
- if(item.value===params.ClassifyIdFirst){
|
|
|
- params.ClassifyNameFirst=item.label
|
|
|
- const arr=item.children||[]
|
|
|
- arr.forEach(_item=>{
|
|
|
- if(_item.value===params.ClassifyIdSecond){
|
|
|
- params.ClassifyNameSecond=_item.label
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- // 编辑
|
|
|
- if(this.id){
|
|
|
- this.$emit('save',params)
|
|
|
- return
|
|
|
- }
|
|
|
- apiSmartReport.reportAdd(params).then(res=>{
|
|
|
- if(res.Ret===200){
|
|
|
- this.handleClose()
|
|
|
- let { href } = this.$router.resolve({
|
|
|
- path: "/smartReportEdit",
|
|
|
- query: { id: res.Data.SmartReportId },
|
|
|
- });
|
|
|
- window.open(href, "_blank");
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- handleUpdateBaseInfo(){
|
|
|
- if(this.formData.type===1){
|
|
|
- if(this.formData.classify.length===2){
|
|
|
- this.formData.title=this.getSelectClassifyName()[1]
|
|
|
- }
|
|
|
- return
|
|
|
- }
|
|
|
- //获取上次报告
|
|
|
- apiSmartReport.getLastReport({
|
|
|
- ClassifyIdFirst:this.formData.classify[0],
|
|
|
- ClassifyIdSecond:this.formData.classify[1]
|
|
|
- }).then(res=>{
|
|
|
- if(res.Ret!==200) return
|
|
|
- if (res.Data == null) {
|
|
|
- this.$message.warning(this.$t('ReportManage.ReportList.no_reports_msg'));
|
|
|
- return false;
|
|
|
- }
|
|
|
- this.formData.title=res.Data.Title
|
|
|
- this.formData.abstract=res.Data.Abstract
|
|
|
- this.formData.author=res.Data.Author ? res.Data.Author.split(',') : ''
|
|
|
- this.formData.frequency=res.Data.Frequency
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- // 获取选择的分类名称
|
|
|
- getSelectClassifyName(){
|
|
|
- let arr=[]
|
|
|
- this.classifyArr.forEach(item=>{
|
|
|
- if(this.formData.classify[0]&&item.value===this.formData.classify[0]){
|
|
|
- arr.push(item.label)
|
|
|
- if(item.children&&item.children.length>0){
|
|
|
- item.children.forEach(_item=>{
|
|
|
- if(this.formData.classify[1]&&_item.value===this.formData.classify[1]){
|
|
|
- arr.push(_item.label)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- return arr
|
|
|
- },
|
|
|
-
|
|
|
- // 获取分类
|
|
|
- getclassifylist() {
|
|
|
- let params = { Enabled:1, KeyWord: "",HideDayWeek:1,/*不显示晨报/周报*/ };
|
|
|
- apiSmartReport.classifyList(params).then((res) => {
|
|
|
- if (res.Ret == 200 && Array.isArray(res.Data.List)) {
|
|
|
- this.classifyArr = [];
|
|
|
- res.Data.List.forEach((item, index) => {
|
|
|
- let newitem = {
|
|
|
- label: item.ClassifyName,
|
|
|
- value: item.Id,
|
|
|
- };
|
|
|
- if (item.Child) {
|
|
|
- let childnode = [];
|
|
|
- item.Child.forEach((itemchild, i) => {
|
|
|
- childnode.push({
|
|
|
- label: itemchild.ClassifyName,
|
|
|
- value: itemchild.Id,
|
|
|
- });
|
|
|
- });
|
|
|
- newitem.children = childnode;
|
|
|
- }
|
|
|
- this.classifyArr.push(newitem);
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- // 获取作者
|
|
|
- getreportauthor() {
|
|
|
- apiSmartReport.reportAuthor({}).then((res) => {
|
|
|
- if (res.Ret == 200) {
|
|
|
- this.authorlist = res.Data.List || [];
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- },
|
|
|
- mounted(){
|
|
|
- this.getclassifylist()
|
|
|
- this.getreportauthor()
|
|
|
- },
|
|
|
-}
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="scss">
|
|
|
-.baseinfo-form-wrap{
|
|
|
- .el-input{
|
|
|
- width: 100%;
|
|
|
- }
|
|
|
- .el-form-item{
|
|
|
- width: 340px;
|
|
|
- margin-left: auto;
|
|
|
- margin-right: auto;
|
|
|
- }
|
|
|
-}
|
|
|
-</style>
|