ChartDetail.vue 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651
  1. <script setup>
  2. import {ref,nextTick, reactive,computed} from 'vue'
  3. import apiChart from '@/api/chart'
  4. import apiETAChart from '@/api/chart'
  5. import apiFutureChart from '@/api/futureChart'
  6. import apiCorrelationChart from '@/api/correlationChart'
  7. import apiLineEquationChart from '@/api/lineEquationChart'
  8. import apiStatisticFeatureChart from '@/api/statisticFeatureChart'
  9. import apiCrossVarietyChart from '@/api/crossVarietyChart'
  10. import apiMyETAChart from '@/api/myETA'
  11. import apiDataEDB from '@/api/dataEDB'
  12. import apiSheet from '@/api/sheet'
  13. import apiIntervalAnalysis from '@/api/intervalAnalysis'
  14. import apiETAForum from '@/api/etaForum'
  15. import { useRoute, useRouter } from 'vue-router'
  16. import {useChartRender} from '@/hooks/chart/render'
  17. import {yearSelectOpt,sameOptionType} from '@/hooks/chart/config'
  18. import EDBInfo from './components/EDBInfo.vue'
  19. import moment from 'moment'
  20. import { showToast,showDialog} from 'vant'
  21. import ChartSaveOther from './components/ChartSaveOther.vue'
  22. import _ from 'lodash';
  23. import { useWindowSize } from '@vueuse/core'
  24. import {setClipboardData} from '@/hooks/common'
  25. import { getChartShareExpireToken } from '@/views/chartETA/hooks/useChartSharedToken'
  26. import SetChartEnName from '@/components/SetChartEnName.vue'
  27. import {useCachedViewsStore} from '@/store/modules/cachedViews'
  28. import AddChartToMyETA from '@/views/chartETA/components/AddChartToMyETA.vue'
  29. import { setExtremumDate } from '@/hooks/chart/commonFun.js'
  30. import {myETABtn,useAuthBtn} from '@/hooks/useAuthBtn'
  31. import {usePublicSettingStore} from '@/store/modules/publicSetting'
  32. import { useNoAuth } from '@/hooks/useNoAuth'
  33. import SaveToMaterial from '@/components/SaveToMaterial.vue'
  34. const {checkAuthBtn} = useAuthBtn()
  35. const publicSettingStore = usePublicSettingStore()
  36. const isMoreActionShow = computed(()=>{
  37. return checkAuthBtn(myETABtn.myChart_refresh)
  38. || checkAuthBtn(myETABtn.myChart_share)
  39. || checkAuthBtn(myETABtn.myChart_move)
  40. || checkAuthBtn(myETABtn.myChart_copyTo)
  41. || checkAuthBtn(myETABtn.myChart_otherSave)
  42. || (checkAuthBtn(myETABtn.myChart_copyWechat)&&checkAuthBtn(myETABtn.myChart_copyOffice))
  43. || checkAuthBtn(myETABtn.myChart_enNameSetting)
  44. || checkAuthBtn(myETABtn.myChart_del)
  45. })
  46. const { width, height } = useWindowSize()
  47. const cachedViewsStore=useCachedViewsStore()
  48. const {options,axisLimitState,chartRender,setLimitData,isUseSelfLimit}=useChartRender()
  49. const route=useRoute()
  50. const router=useRouter()
  51. let chartCode=route.query.code
  52. const isETAForumChart=ref(route.query.isETAForumChart=='true'?true:false)
  53. let CHARTINS=null//图表实例
  54. // 获取当前图表所在分类下的所有图表数据 用于上一张下一张切换
  55. let allChartList=ref([])
  56. async function getAllChartList(){
  57. // 如果是从ETA指标库的指标关联的图列表跳转来的
  58. if(route.query.from==='edbRelationChart'){
  59. const res=await apiDataEDB.edbRelationChartList({
  60. PageSize:1000000,
  61. CurrentIndex:1,
  62. EdbInfoId:route.query.edbInfoId
  63. })
  64. if(res.Ret===200){
  65. allChartList.value=res.Data.List||[]
  66. }
  67. return
  68. }
  69. // 我的图库列表跳转来的
  70. if(!route.query.cid) return
  71. const res=await apiMyETAChart.myChartList({
  72. CurrentIndex:1,
  73. PageSize:1000000,
  74. MyChartClassifyId:Number(route.query.cid)
  75. })
  76. if(res.Ret===200){
  77. allChartList.value=res.Data.List||[]
  78. }
  79. }
  80. getAllChartList()
  81. // 切换图上一张下一张
  82. function handleSwitchChart(type){
  83. const index=allChartList.value.findIndex((item)=>item.UniqueCode==chartCode)
  84. let item=null
  85. if(type==='prev'){
  86. item=index===0?allChartList.value[allChartList.value.length-1]:allChartList.value[index-1]
  87. }else{
  88. item=index===allChartList.value.length-1?allChartList.value[0]:allChartList.value[index+1]
  89. }
  90. chartCode=item.UniqueCode
  91. getChartInfo()
  92. }
  93. // 是否面积图堆叠百分比
  94. function isChartHeap(info){
  95. let tag=true
  96. if(info.ChartType==3&&info.ExtraConfig){
  97. let ExtraConfig=JSON.parse(info.ExtraConfig)
  98. tag=ExtraConfig.HeapWay==2?false:true
  99. }
  100. return tag
  101. }
  102. // 获取图详情
  103. let chartInfoData=null
  104. let chartInfo=ref(null)
  105. let edbList=ref([])//指标数据
  106. async function getChartInfo(){
  107. const res=isETAForumChart.value?await apiETAForum.getChartDetail({UniqueCode:chartCode}) : await apiETAChart.chartInfoByCode({UniqueCode:chartCode})
  108. if(res.Ret!==200) return
  109. chartInfoData=res.Data
  110. chartInfo.value=res.Data.ChartInfo
  111. if(!res.Data.ChartInfo.HaveOperaAuth) return
  112. if([2,5].includes(res.Data.ChartInfo.Source)){
  113. edbList.value=[res.Data.EdbInfoList[0]]
  114. }else{
  115. edbList.value=res.Data.EdbInfoList
  116. }
  117. // 设置 起始日期 和 最新日期
  118. const extremumDate= setExtremumDate(edbList.value)
  119. minDate = new Date(extremumDate.earliestDate)
  120. earliestDate.value = extremumDate.earliestDate
  121. latestDate.value = extremumDate.latestDate
  122. chartState.yearVal=res.Data.ChartInfo.DateType
  123. if(res.Data.ChartInfo.DateType===5){
  124. chartState.startTime=res.Data.ChartInfo.StartDate
  125. chartState.endTime=res.Data.ChartInfo.EndDate
  126. temStartTime.value=res.Data.ChartInfo.StartDate.split('-')
  127. temEndTime.value=res.Data.ChartInfo.EndDate.split('-')
  128. }
  129. if(res.Data.ChartInfo.DateType===6){
  130. chartState.startTime=res.Data.ChartInfo.StartDate
  131. temStartTime.value=res.Data.ChartInfo.StartDate.split('-')
  132. }
  133. if(res.Data.ChartInfo.DateType===20){
  134. // 最近几年
  135. let latestYear = parseInt(latestDate.value.substring(0,4))
  136. chartState.startTime = `${latestYear-chartState.startYear+1}-01-01`
  137. chartState.endTime = `${latestYear}-12-31`
  138. chartState.startTime=res.Data.ChartInfo.StartDate
  139. chartState.endTime=res.Data.ChartInfo.EndDate
  140. temStartTime.value=chartState.startTime.split('-')
  141. temEndTime.value=chartState.endTime.split('-')
  142. }
  143. //仅ETA图库图表需要初始化上下限
  144. if(res.Data.ChartInfo.Source===1&&![7,10,11,12].includes(res.Data.ChartInfo.ChartType)){
  145. isUseSelfLimit.value = true
  146. setLimitData(res.Data)
  147. }else{
  148. isUseSelfLimit.value = false
  149. }
  150. nextTick(()=>{
  151. CHARTINS=chartRender({
  152. data:res.Data,
  153. renderId:'chart-box',
  154. lang:'zh',
  155. changeLangIsCheck:false,
  156. showChartTitle:false,
  157. shouldUseSelfLimit:true,
  158. })
  159. })
  160. }
  161. function openDateSelect(){
  162. // 回显
  163. switch (chartState.yearVal) {
  164. case 3:
  165. temStartTime.value = [2015,1,1]
  166. temEndTime.value = latestDate.value.split('-')
  167. break;
  168. case 9:
  169. temStartTime.value = [2020,1,1]
  170. temEndTime.value = latestDate.value.split('-')
  171. break;
  172. case 4:
  173. temStartTime.value = [2021,1,1]
  174. temEndTime.value = latestDate.value.split('-')
  175. break;
  176. case 11:
  177. temStartTime.value = [2022,1,1]
  178. temEndTime.value = latestDate.value.split('-')
  179. break;
  180. case '':
  181. temStartTime.value = earliestDate.value.split('-')
  182. temEndTime.value = latestDate.value.split('-')
  183. break;
  184. default:
  185. temStartTime.value = chartState.startTime.split('-')
  186. temEndTime.value = chartState.endTime.split('-')
  187. break;
  188. }
  189. chartState.showTimePop=true
  190. }
  191. getChartInfo()
  192. // 选择项发生变化时 非配置项 获取新的图表数据
  193. async function reloadChartInfo(){
  194. const params=sameOptionType.includes(chartInfo.value.ChartType)?{
  195. ChartInfoId: chartInfo.value.ChartInfoId,
  196. DateType: chartState.yearVal,
  197. StartDate: chartState.startTime,
  198. EndDate: chartState.endTime,
  199. }:{
  200. ChartInfoId: chartInfo.value.ChartInfoId,
  201. DateType: chartState.yearVal,
  202. Calendar: chartState.calendarType,//this.calendar_type
  203. StartDate: chartState.startTime,
  204. EndDate:chartState.endTime ,
  205. }
  206. const res=await apiETAChart.chartInfoById(params)
  207. if(res.Ret!==200) return
  208. chartInfo.value=res.Data.ChartInfo
  209. CHARTINS=chartRender({
  210. data:{
  211. ...res.Data,
  212. ChartInfo:{
  213. ...res.Data.ChartInfo,
  214. Calendar:chartState.calendarType||'公历'
  215. }
  216. },
  217. renderId:'chart-box',
  218. lang:'zh',
  219. changeLangIsCheck:false,
  220. showChartTitle:false,
  221. shouldUseSelfLimit:true,
  222. })
  223. }
  224. let minDate=new Date(1970, 0, 1)
  225. const maxDate=new Date(2050, 11, 31)
  226. const cYear=moment().format('YYYY')
  227. const cMonth=moment().format('MM')
  228. const cDay=moment().format('dd')
  229. let temStartTime=ref([cYear,cMonth,cDay])
  230. let temEndTime=ref([cYear,cMonth,cDay])
  231. const earliestDate=ref('')
  232. const latestDate=ref('')
  233. let chartState=reactive({
  234. showTimePop:false,
  235. startTime:'',
  236. endTime:'',
  237. yearVal:'',
  238. calendarType:'公历',
  239. startYear:5
  240. })
  241. // 切换年份选项
  242. function handleYearChange(item){
  243. chartState.yearVal=item.value
  244. chartState.startTime=''
  245. chartState.endTime=''
  246. reloadChartInfo()
  247. }
  248. // 确定日期筛选
  249. function handleTimeChange(){
  250. chartState.startTime=temStartTime.value.join('-')
  251. chartState.endTime=temEndTime.value.join('-')
  252. chartState.yearVal=5
  253. reloadChartInfo()
  254. chartState.showTimePop=false
  255. }
  256. // 季节图公历\农历切换
  257. function handleSeasonTypeChange(type){
  258. chartState.calendarType=type
  259. reloadChartInfo()
  260. }
  261. // 上下限调整
  262. let showLimitPop=ref(false)
  263. let axisLimitDataTem=reactive({//左右轴极值
  264. min:'-99999999999999999',
  265. leftMin:0,
  266. leftMax:0,
  267. rightMin:0,
  268. rightMax:0,
  269. rightTwoMin:0,
  270. rightTwoMax:0,
  271. xMin:0,
  272. xMax:0,
  273. })
  274. function handleShowAxisLimitOpt(){
  275. axisLimitDataTem.leftMin=axisLimitState.leftMin
  276. axisLimitDataTem.leftMax=axisLimitState.leftMax
  277. axisLimitDataTem.rightMin=axisLimitState.rightMin
  278. axisLimitDataTem.rightMax=axisLimitState.rightMax
  279. axisLimitDataTem.rightTwoMin=axisLimitState.rightTwoMin
  280. axisLimitDataTem.rightTwoMax=axisLimitState.rightTwoMax
  281. axisLimitDataTem.xMin=axisLimitState.xMin
  282. axisLimitDataTem.xMax=axisLimitState.xMax
  283. showLimitPop.value=true
  284. }
  285. // 极限修改确定
  286. function handleConfirmLimitChange(){
  287. const data=_.cloneDeep(chartInfoData)
  288. // 修改左轴极限
  289. if(axisLimitState.hasLeftAxis){
  290. if(axisLimitState.leftIndex!==-1){
  291. axisLimitState.leftMin = axisLimitDataTem.leftMin
  292. axisLimitState.leftMax = axisLimitDataTem.leftMax
  293. }else{
  294. // 柱形图 取的ChartInfo中的极值
  295. if(data.ChartInfo.ChartType ===7){
  296. data.ChartInfo.LeftMin=axisLimitDataTem.leftMin
  297. data.ChartInfo.LeftMax=axisLimitDataTem.leftMax
  298. }
  299. // 商品价格曲线
  300. if([2,5].includes(data.ChartInfo.Source)){
  301. data.ChartInfo.LeftMin=axisLimitDataTem.leftMin
  302. data.ChartInfo.LeftMax=axisLimitDataTem.leftMax
  303. }
  304. // 截面散点 取的DataResp
  305. if(data.ChartInfo.ChartType ===10){
  306. data.DataResp.YMinValue=axisLimitDataTem.leftMin
  307. data.DataResp.YMaxValue=axisLimitDataTem.leftMax
  308. }
  309. // 跨品种分析
  310. if(data.ChartInfo.Source===10){
  311. data.ChartInfo.LeftMin = axisLimitDataTem.leftMin
  312. data.ChartInfo.LeftMax = axisLimitDataTem.leftMax
  313. }
  314. }
  315. }
  316. // 修改右轴极限
  317. if(axisLimitState.hasRightAxis){
  318. if(axisLimitState.rightIndex!==-1){
  319. axisLimitState.rightMin = axisLimitDataTem.rightMin
  320. axisLimitState.rightMax = axisLimitDataTem.rightMax
  321. }
  322. }
  323. //修改右2轴极限
  324. if(axisLimitState.hasRightTwoAxis){
  325. if(axisLimitState.rightTwoIndex!==-1){
  326. axisLimitState.rightMin = axisLimitDataTem.rightTwoMin
  327. axisLimitState.rightMax = axisLimitDataTem.rightTwoMax
  328. }
  329. }
  330. // 修改X轴极限
  331. if(axisLimitState.hasXAxis){
  332. // 截面散点 取的DataResp
  333. if(data.ChartInfo.ChartType ===10){
  334. data.DataResp.XMinValue=axisLimitDataTem.xMin
  335. data.DataResp.XMaxValue=axisLimitDataTem.xMax
  336. }
  337. // 跨品种分析
  338. if(data.ChartInfo.Source===10){
  339. data.ChartInfo.XMin = axisLimitDataTem.xMin
  340. data.ChartInfo.XMax = axisLimitDataTem.xMax
  341. }
  342. }
  343. CHARTINS=chartRender({
  344. data:data,
  345. renderId:'chart-box',
  346. lang:'zh',
  347. changeLangIsCheck:false,
  348. showChartTitle:false,
  349. shouldUseSelfLimit:true,
  350. })
  351. showLimitPop.value=false
  352. }
  353. // 显示指标详情
  354. let showEDB=ref(false)
  355. let showEDBData=ref({})
  356. function handleShowEDBInfo(item){
  357. showEDBData.value=item
  358. showEDB.value=true
  359. }
  360. // 获取指标数据
  361. async function getItemEDBInfo(item){
  362. const params={
  363. EdbInfoId: item.EdbInfoId,
  364. DateType: chartState.yearVal,
  365. StartDate: chartState.startTime,
  366. EndDate: chartState.endTime,
  367. EdbInfoType: item.EdbInfoType,
  368. LeadValue: item.EdbInfoType ? 0 : item.LeadValue,
  369. LeadUnit: item.EdbInfoType ? '' : item.LeadUnit,
  370. }
  371. return apiETAChart.EDBInfo(params)
  372. }
  373. // 指标配置项修改更新图
  374. async function handleUpdateRender(val,isEdit){
  375. const index=edbList.value.findIndex(_=>_.EdbInfoId==val.EdbInfoId)
  376. // 如果修改过 领先指标\标准指标则重新获取指标数据
  377. if(isEdit){
  378. edbList.value[index]=val
  379. const asyncTasks=edbList.value.map(_item=> getItemEDBInfo(_item))
  380. const results=await Promise.all(asyncTasks)
  381. console.log(results);
  382. results.forEach((item,index)=>{
  383. if(item.Ret==200){
  384. edbList.value[index].DataList=item.Data.EdbInfo.DataList
  385. if(item.Data.EdbInfo.EdbInfoCategoryType===1){
  386. edbList.value[index].LatestDate=item.Data.EdbInfo.LatestDate
  387. }
  388. }
  389. })
  390. }else{
  391. edbList.value[index]=val
  392. }
  393. CHARTINS=chartRender({
  394. data:{
  395. ...chartInfoData,
  396. EdbInfoList:edbList.value
  397. },
  398. renderId:'chart-box',
  399. lang:'zh',
  400. changeLangIsCheck:false,
  401. showChartTitle:false,
  402. shouldUseSelfLimit:true,
  403. })
  404. showEDB.value=false
  405. showEDBData.value={}
  406. }
  407. // 更多操作弹窗
  408. let showMoreAction=ref(false)
  409. // 复制到
  410. let myChartClassifyList=[]//我的图库中的所有分类
  411. async function getMyChartClassifyList(){
  412. const res=await apiMyETAChart.myClassifyList()
  413. if(res.Ret===200){
  414. myChartClassifyList=res.Data.List||[]
  415. }
  416. }
  417. getMyChartClassifyList()
  418. let showCopyTo=ref(false)
  419. let copyToOpt=ref([])
  420. async function handleShowCopyTo(){
  421. const res=await apiMyETAChart.chartInMyClassifyList({ChartInfoId:chartInfo.value.ChartInfoId})
  422. if(res.Ret===200){
  423. const arr=res.Data||[]
  424. copyToOpt.value=myChartClassifyList.map(e=>{
  425. return {
  426. ...e,
  427. select:false
  428. }
  429. }).filter((x) => !arr.includes(x.MyChartClassifyId))
  430. showCopyTo.value=true
  431. }
  432. }
  433. async function handleConfirmCopy(){
  434. const arr=[]
  435. copyToOpt.value.map(item=>{
  436. if(item.select){
  437. arr.push(item.MyChartClassifyId)
  438. }
  439. })
  440. if(arr.length===0){
  441. showToast('请选择分类')
  442. return
  443. }
  444. const res=await apiMyETAChart.chartAddToClassify({
  445. ChartInfoId:chartInfo.value.ChartInfoId,
  446. MyChartClassifyId:arr
  447. })
  448. if(res.Ret===200){
  449. showToast('复制成功')
  450. showCopyTo.value=false
  451. }
  452. }
  453. // 移除图表
  454. function handleRemoveChart(){
  455. if(!route.query.cid){
  456. showToast('当前图表所属多个分类,请选中具体分类移出')
  457. return
  458. }
  459. showDialog({
  460. title: '提示',
  461. message: '是否确认移出?',
  462. showCancelButton:true
  463. }).then(() => {
  464. // on close
  465. apiMyETAChart.myChartRemove({
  466. MyChartClassifyId:Number(route.query.cid),
  467. MyChartId:chartInfo.value.MyChartId
  468. }).then(res=>{
  469. if(res.Ret===200){
  470. showToast('移出成功')
  471. cachedViewsStore.removeCaches('MyETAIndex')
  472. cachedViewsStore.removeCaches('MyETASearchList')
  473. setTimeout(() => {
  474. router.back()
  475. }, 1500)
  476. }
  477. })
  478. }).catch(()=>{})
  479. }
  480. //删除图表
  481. function handleDeleteChart(){
  482. showDialog({
  483. title: '提示',
  484. message: '删除后该图表将不能再引用,确认删除吗?',
  485. showCancelButton:true
  486. }).then(async () => {
  487. // on close
  488. const res=chartInfo.value.Source===11?await apiSheet.balanceSheetChartDel({
  489. ChartInfoId:chartInfo.value.ChartInfoId
  490. }):await apiMyETAChart.chartDel({
  491. ChartInfoId:chartInfo.value.ChartInfoId
  492. })
  493. if(res.Ret===200){
  494. showToast('删除成功')
  495. cachedViewsStore.removeCaches('MyETAIndex')
  496. cachedViewsStore.removeCaches('MyETASearchList')
  497. setTimeout(() => {
  498. router.back()
  499. }, 1500)
  500. }
  501. }).catch(()=>{})
  502. }
  503. // 另存为
  504. let showSaveChartOther=ref(false)
  505. // 刷新
  506. async function handleChartRefresh(){
  507. const { Source,ChartInfoId,UniqueCode } = chartInfo.value
  508. let res=null
  509. if(Source===1){
  510. res= await apiETAChart.chartRefresh({ ChartInfoId })
  511. }else if([2,5].includes(Source)){
  512. res=await apiFutureChart.refreshChart({ ChartInfoId })
  513. }else if([3,4].includes(Source)){
  514. res=await apiCorrelationChart.refreshChart({ ChartInfoId })
  515. }else if(Source===6){
  516. res=await apiLineEquationChart.refreshChart({ ChartInfoId })
  517. }else if([7,8,9].includes(Source)) {
  518. res=await apiStatisticFeatureChart.refreshChart({ ChartInfoId })
  519. }else if(Source===10) {
  520. res=await apiCrossVarietyChart.refreshChart({ ChartInfoId })
  521. }else if(Source===11){
  522. res=await apiSheet.sheetRefresh({ChartInfoId})
  523. }else if(Source===12){
  524. res=await apiIntervalAnalysis.chartRefresh({ChartInfoId})
  525. }
  526. if(res.Ret!==200)return
  527. showToast('刷新成功')
  528. showMoreAction.value=false
  529. Source===1?reloadChartInfo():getChartInfo()
  530. }
  531. //分享
  532. async function handleChartShare(){
  533. // const url=import.meta.env.VITE_CHART_LINK+`?code=${chartInfo.value.UniqueCode}&fromType=share&lang=ch`
  534. //临时权限token
  535. const res = await getChartShareExpireToken(chartInfo.value.UniqueCode);
  536. if(res.Ret !== 200) return
  537. const url=publicSettingStore.publicSetting.ChartViewUrl+`/chartshow?code=${chartInfo.value.UniqueCode}&fromType=share&lang=ch&authToken=${res.Data}`
  538. setClipboardData(url)
  539. }
  540. //保存图表:目前myETA里能保存的只有ETA图库的图和商品价格曲线图
  541. function handleChartSave(){
  542. const sourceMap = {
  543. 1: saveChartHandle,
  544. 2: saveCommodityChart,//商品价格曲线
  545. 5: saveCommodityChart,//利润曲线
  546. 10: saveCrossVarietyChart
  547. }
  548. sourceMap[chartInfo.value.Source]&&sourceMap[chartInfo.value.Source]();
  549. }
  550. function saveChartHandle(){
  551. //获取每条线的指标配置
  552. let arr = edbList.value.map((item)=>{
  553. return {
  554. ChartColor: item.ChartColor,
  555. PredictChartColor: item.PredictChartColor,
  556. ChartStyle: item.ChartStyle,
  557. ChartWidth: Number(item.ChartWidth),
  558. EdbInfoId: item.EdbInfoId,
  559. EdbInfoType: item.EdbInfoType,
  560. IsAxis: item.IsAxis,
  561. IsOrder: item.IsOrder,
  562. LeadUnit: item.EdbInfoType ? '' : item.LeadUnit,
  563. LeadValue: item.EdbInfoType ? 0 : Number(item.LeadValue),
  564. MaxData: Number(item.MaxData),
  565. MinData: Number(item.MinData),
  566. }
  567. })
  568. //所有图表的公共参数
  569. let public_param = {
  570. ChartClassifyId: chartInfo.value.ChartClassifyId,
  571. ChartInfoId: chartInfo.value.ChartInfoId,
  572. ChartEdbInfoList: arr,
  573. }
  574. //根据ChartType决定剩余参数
  575. let type_param = {}
  576. switch(chartInfo.value.ChartType){
  577. case 2:
  578. type_param = {
  579. DateType: chartState.yearVal,
  580. StartYear:chartState.startYear || 0,
  581. Calendar: chartState.calendarType,
  582. StartDate: chartState.startTime||'',
  583. EndDate: chartState.endTime||'',
  584. }
  585. break
  586. case 7:
  587. case 11:
  588. type_param = {
  589. DateType: 6,
  590. LeftMin: String(axisLimitState.leftMin),
  591. LeftMax: String(axisLimitState.leftMax),
  592. }
  593. break
  594. case 10:
  595. type_param = {
  596. DateType: 6,
  597. Calendar: "公历",
  598. ExtraConfig: JSON.stringify({
  599. ...JSON.parse(chartInfo.value.ExtraConfig),
  600. XMinValue: String(axisLimitState.xMin),
  601. XMaxValue: String(axisLimitState.xMax),
  602. YMinValue: String(axisLimitState.leftMin),
  603. YMaxValue: String(axisLimitState.leftMax),
  604. })
  605. }
  606. break
  607. }
  608. if(sameOptionType.includes(chartInfo.value.ChartType)){
  609. type_param = {
  610. DateType: chartState.yearVal,
  611. StartYear:chartState.startYear || 0,
  612. StartDate:chartState.yearVal === 5 || chartState.yearVal === 6
  613. ? chartState.startTime
  614. : '',
  615. EndDate: chartState.yearVal === 5 ? chartState.endTime : '',
  616. }
  617. }
  618. let params = {...public_param,...type_param}
  619. if(![7,10,11].includes(chartInfo.value.ChartType)){
  620. params = {
  621. ...params,
  622. LeftMin:axisLimitState.leftMin+'',
  623. LeftMax:axisLimitState.leftMax+'',
  624. RightMin:axisLimitState.rightMin+'',
  625. RightMax:axisLimitState.rightMax+'',
  626. Right2Min:axisLimitState.rightTwoMin+'',
  627. Right2Max:axisLimitState.rightTwoMax+'',
  628. //手动保存视为更改过上下限
  629. MinMaxSave:1
  630. }
  631. }
  632. //保存
  633. apiChart.chartSave(params).then(async res=>{
  634. if(res.Ret!==200) return
  635. showToast("保存成功")
  636. setChartImage()
  637. })
  638. }
  639. function saveCommodityChart(){
  640. apiMyETAChart.myETASaveChart({
  641. ChartInfoId:chartInfo.value.ChartInfoId,
  642. LeftMin:String(axisLimitState.leftMin),
  643. LeftMax:String(axisLimitState.leftMax),
  644. }).then(res=>{
  645. if(res.Ret!==200) return
  646. showToast("保存成功")
  647. setChartImage()
  648. })
  649. }
  650. function saveCrossVarietyChart() {
  651. apiCrossVarietyChart.myETASaveChart({
  652. ChartInfoId:chartInfo.value.ChartInfoId,
  653. LeftMin:String(axisLimitState.leftMin),
  654. LeftMax:String(axisLimitState.leftMax),
  655. XMin: String(axisLimitState.xMin),
  656. XMax: String(axisLimitState.xMax),
  657. }).then(res=>{
  658. if(res.Ret!==200) return
  659. showToast("保存成功")
  660. setChartImage()
  661. })
  662. }
  663. //更新缩略图
  664. async function setChartImage(){
  665. //打开保存图片弹窗
  666. const svgData = CHARTINS.getSVG({
  667. chart: {
  668. width: 340,
  669. height: 230,
  670. }
  671. })
  672. let form = new FormData();
  673. form.append('Img', svgData);
  674. let {Data,Ret} = await apiETAChart.uploadChartImg(form)
  675. if(Ret!==200||!Data) return
  676. await apiETAChart.setChartImg({
  677. ChartInfoId:Number(chartInfo.value.ChartInfoId),
  678. ImageUrl:Data.ResourceUrl
  679. })
  680. }
  681. //保存图片
  682. let savePicDialogShow = ref(false)
  683. let savePicSrc = ref('')
  684. function handleChartSavePicture(){
  685. const {chartWidth,chartHeight} = CHARTINS
  686. const svgData = CHARTINS.getSVG({
  687. chart: {
  688. width: chartWidth,
  689. height: chartHeight,
  690. }
  691. })
  692. console.log(chartWidth,chartHeight);
  693. const canvas = document.createElement('canvas')
  694. const ctx = canvas.getContext('2d')
  695. canvas.width = chartWidth*2
  696. canvas.height = chartHeight*2
  697. const image = new Image()
  698. image.src = 'data:image/svg+xml;charset=utf-8,'+encodeURIComponent(svgData)
  699. image.onload = ()=>{
  700. ctx.drawImage(image, 0, 0,chartWidth*2,chartHeight*2);
  701. savePicSrc.value = canvas.toDataURL('image/png');
  702. savePicDialogShow.value = true
  703. }
  704. }
  705. // 显示修改英文名称弹窗
  706. let showEidtEnName=ref(false)
  707. function handleShowEditEnName(){
  708. showEidtEnName.value=true
  709. }
  710. function handleEditEnNameSuccess(){
  711. chartInfo.value.Source===1?reloadChartInfo():getChartInfo()
  712. }
  713. // 加入我的图库
  714. const isShowAddToMyETADialog=ref(false)
  715. // 保存至素材库
  716. const showSaveToMaterial=ref(false)
  717. </script>
  718. <template>
  719. <div class="chart-detail-page" v-if="chartInfo">
  720. <template v-if="chartInfo.HaveOperaAuth">
  721. <div
  722. class="chart-title"
  723. :style="chartInfo.ChartThemeStyle?`
  724. text-align:${JSON.parse(chartInfo.ChartThemeStyle).titleOptions.align};
  725. font-size:${JSON.parse(chartInfo.ChartThemeStyle).titleOptions.style.fontSize}px;
  726. color:${JSON.parse(chartInfo.ChartThemeStyle).titleOptions.style.color}
  727. `:''"
  728. >
  729. {{chartInfo.ChartName}}
  730. </div>
  731. <!-- 一般曲线图选择时间区间或者季节图选择日期 -->
  732. <div
  733. class="select-time-box"
  734. v-if="!isETAForumChart&&((sameOptionType.includes(chartInfo.ChartType)&& chartInfo.Source===1)||chartInfo.ChartType===2)"
  735. @click="openDateSelect"
  736. >
  737. <img class="left-icon" src="@/assets/imgs/icon_calendar.png" alt="">
  738. <span :class="['val-box',!chartState.startTime?'val-box_grey':'']">{{chartState.startTime||'开始日期'}} ~ {{chartState.startTime&&!chartState.endTime?'至今':chartState.endTime||'结束日期'}}</span>
  739. <van-icon class="right-icon" name="arrow" />
  740. </div>
  741. <!-- pad端时间和操作按钮模块 -->
  742. <div class="pad-time-action-wrap" v-if="!isETAForumChart">
  743. <div class="left-time-box" >
  744. <template v-if="sameOptionType.includes(chartInfo.ChartType)&& chartInfo.Source===1">
  745. <span :class="['item',chartState.yearVal==''?'active':'']" @click="handleYearChange({value:''})">全部</span>
  746. <span
  747. :class="['item',chartState.yearVal==item.value?'active':'']"
  748. v-for="item in yearSelectOpt"
  749. :key="item.value"
  750. @click="handleYearChange(item)"
  751. >{{item.name}}</span>
  752. </template>
  753. <span
  754. class="time-box"
  755. v-if="(sameOptionType.includes(chartInfo.ChartType)&& chartInfo.Source===1)||chartInfo.ChartType===2"
  756. @click="openDateSelect"
  757. >{{chartState.startTime?chartState.startTime+'~'+(chartState.endTime?chartState.endTime:'至今'):'请选择时间段'}}</span>
  758. </div>
  759. <div class="right-action-box">
  760. <div class="item" @click="handleShowAxisLimitOpt" v-if="[1,2,5,10,12].includes(chartInfo.Source)&&checkAuthBtn(myETABtn.myChart_editLimit)&&isChartHeap(chartInfo)">
  761. <img src="@/assets/imgs/myETA/icon_limit2.png" alt="">
  762. <span>上下限设置</span>
  763. </div>
  764. <div class="item" @click="showMoreAction=true" v-if="isMoreActionShow||$route.query.from==='edbRelationChart'">
  765. <img src="@/assets/imgs/chartETA/more-icon.png" alt="">
  766. <span>更多设置</span>
  767. </div>
  768. </div>
  769. </div>
  770. <!-- 图渲染区域 -->
  771. <div class="chart-render-wrap">
  772. <!-- pad 切换上一张\下一张 -->
  773. <img class="pad-change-chart-btn" src="@/assets/imgs/icon_arrow2.png" alt="" @click="handleSwitchChart('prev')" v-if="allChartList.length>0">
  774. <img class="pad-change-chart-btn pad-change-chart-next-btn" src="@/assets/imgs/icon_arrow2.png" alt="" @click="handleSwitchChart('next')" v-if="allChartList.length>0">
  775. <div class="chart-box" id="chart-box"></div>
  776. <!-- 底部来源,图表说明 -->
  777. <div class="chart-bottom-insruction-info"
  778. v-if="(chartInfo.SourcesFrom&&JSON.parse(chartInfo.SourcesFrom).isShow) || (chartInfo.Instructions&&JSON.parse(chartInfo.Instructions).isShow)">
  779. <div
  780. class="chart-source"
  781. v-if="chartInfo.SourcesFrom&&JSON.parse(chartInfo.SourcesFrom).isShow"
  782. :style="`
  783. color: ${ JSON.parse(chartInfo.SourcesFrom).color };
  784. font-size: ${ JSON.parse(chartInfo.SourcesFrom).fontSize }px;
  785. `"
  786. >
  787. 数据来源:{{JSON.parse(chartInfo.SourcesFrom).text}}
  788. </div>
  789. <!-- 图表说明 -->
  790. <div
  791. class="chart-instruction text_oneLine"
  792. v-if="chartInfo.Instructions&&JSON.parse(chartInfo.Instructions).isShow"
  793. v-text="JSON.parse(chartInfo.Instructions).text"
  794. :style="`
  795. color: ${JSON.parse(chartInfo.Instructions).color};
  796. font-size: ${ JSON.parse(chartInfo.Instructions).fontSize }px
  797. `"
  798. ></div>
  799. </div>
  800. </div>
  801. <!-- 一般曲线图选择时间区间 -->
  802. <div class="select-year-box" v-if="!isETAForumChart&&sameOptionType.includes(chartInfo.ChartType)&& chartInfo.Source===1">
  803. <span :class="['item',chartState.yearVal==''?'active':'']" @click="handleYearChange({value:''})">全部</span>
  804. <span
  805. :class="['item',chartState.yearVal==item.value?'active':'']"
  806. v-for="item in yearSelectOpt"
  807. :key="item.value"
  808. @click="handleYearChange(item)"
  809. >{{item.name}}</span>
  810. </div>
  811. <!-- 季节图切换公/农历 -->
  812. <div class="calendar-type-box" v-if="!isETAForumChart&&chartInfo.ChartType === 2">
  813. <span
  814. :class="chartState.calendarType=='公历'?'active':''"
  815. @click="handleSeasonTypeChange('公历')"
  816. >公历</span>
  817. <span
  818. :class="chartState.calendarType=='农历'?'active':''"
  819. @click="handleSeasonTypeChange('农历')"
  820. >农历</span>
  821. </div>
  822. <!-- 指标模块 -->
  823. <div class="edb-list-box">
  824. <div class="list-box">
  825. <div class="list-item" v-for="item in edbList" :key="item.EdbInfoId" @click="handleShowEDBInfo(item)">
  826. <span class="date">{{item.LatestDate}}</span>
  827. <span class="edb-name van-ellipsis" :style="{color:item.ChartColor}">{{item.EdbName}}</span>
  828. <span class="value">{{item.LatestValue}}</span>
  829. </div>
  830. </div>
  831. </div>
  832. <!-- 底部悬浮操作模块 -->
  833. <div class="fix-bot-action-box">
  834. <div class="item" @click="handleSwitchChart('prev')" v-if="allChartList.length>0">
  835. <img class="icon" src="@/assets/imgs/icon_arrow.png" alt="">
  836. <div>上一张</div>
  837. </div>
  838. <div class="item" @click="handleSwitchChart('next')" v-if="allChartList.length>0">
  839. <img class="icon" style="transform: rotate(180deg);" src="@/assets/imgs/icon_arrow.png" alt="">
  840. <div>下一张</div>
  841. </div>
  842. <div class="item" @click="handleShowAxisLimitOpt" v-if="[1,2,5,10].includes(chartInfo.Source)&&checkAuthBtn(myETABtn.myChart_editLimit)&&isChartHeap(chartInfo)">
  843. <img class="icon" src="@/assets/imgs/myETA/icon_limit.png" alt="">
  844. <div>上下限</div>
  845. </div>
  846. <div class="item" @click="showMoreAction=true" v-if="!isETAForumChart&&(isMoreActionShow||$route.query.from==='edbRelationChart')">
  847. <img class="icon" src="@/assets/imgs/myETA/icon_menu.png" alt="">
  848. <div>更多</div>
  849. </div>
  850. </div>
  851. </template>
  852. <div class="noAuth" v-if="chartInfo.HaveOperaAuth===false">
  853. <img class="img" :src="useNoAuth().noAuthImg" alt="">
  854. <div>{{useNoAuth().chart}}</div>
  855. </div>
  856. </div>
  857. <!-- 选择日期弹窗 -->
  858. <van-popup
  859. v-model:show="chartState.showTimePop"
  860. :position="width>650?'center':'bottom'"
  861. :style="width>650?{ width: '400px'}:''"
  862. >
  863. <div class="time-picker-wrap">
  864. <van-picker-group
  865. title="选择起始时间"
  866. :tabs="['开始时间', '结束时间']"
  867. @cancel="chartState.showTimePop=false"
  868. @confirm="handleTimeChange"
  869. >
  870. <van-date-picker
  871. v-model="temStartTime"
  872. :min-date="minDate"
  873. :max-date="maxDate"
  874. :columns-type="['year','month','day']"
  875. />
  876. <van-date-picker
  877. v-model="temEndTime"
  878. :min-date="minDate"
  879. :max-date="maxDate"
  880. :columns-type="['year','month','day']"
  881. />
  882. </van-picker-group>
  883. </div>
  884. </van-popup>
  885. <!-- 指标信息弹窗 -->
  886. <van-popup
  887. v-model:show="showEDB"
  888. :position="width>650?'right':'bottom'"
  889. :round="width>650?false:true"
  890. closeable
  891. :style="width>650?{ width: '400px', height: '100%' }:''"
  892. >
  893. <EDBInfo
  894. :show="showEDB"
  895. :data="showEDBData"
  896. :tableData="edbList"
  897. :chartInfo="chartInfo"
  898. @change="handleUpdateRender"
  899. />
  900. </van-popup>
  901. <!-- 上下限调整弹窗 -->
  902. <van-popup
  903. v-model:show="showLimitPop"
  904. :position="width>650?'center':'bottom'"
  905. round
  906. closeable
  907. :style="width>650?{ width: '400px'}:''"
  908. >
  909. <div class="global-pop-wrap_mobile chart-set-limit-wrap">
  910. <div class="head-box">
  911. <div class="title">上下限设置</div>
  912. </div>
  913. <div class="content">
  914. <!-- 左轴 -->
  915. <div class="item-box" v-if="axisLimitState.hasLeftAxis">
  916. <span class="lable-text">左轴</span>
  917. <div class="input-box">
  918. <div class="item">
  919. <div class="type-text">上限</div>
  920. <div class="step-box">
  921. <van-stepper input-width="60px" :min="axisLimitDataTem.min" v-model.number="axisLimitDataTem.leftMax" />
  922. </div>
  923. </div>
  924. <div class="item">
  925. <div class="type-text">下限</div>
  926. <div class="step-box">
  927. <van-stepper input-width="60px" :min="axisLimitDataTem.min" v-model.number="axisLimitDataTem.leftMin" />
  928. </div>
  929. </div>
  930. </div>
  931. </div>
  932. <!-- 右轴 -->
  933. <div class="item-box" v-if="axisLimitState.hasRightAxis">
  934. <span class="lable-text">右轴</span>
  935. <div class="input-box">
  936. <div class="item">
  937. <div class="type-text">上限</div>
  938. <div class="step-box">
  939. <van-stepper input-width="60px" :min="axisLimitDataTem.min" v-model.number="axisLimitDataTem.rightMax" />
  940. </div>
  941. </div>
  942. <div class="item">
  943. <div class="type-text">下限</div>
  944. <div class="step-box">
  945. <van-stepper input-width="60px" :min="axisLimitDataTem.min" v-model.number="axisLimitDataTem.rightMin" />
  946. </div>
  947. </div>
  948. </div>
  949. </div>
  950. <!-- 右二轴 -->
  951. <div class="item-box" v-if="axisLimitState.hasRightTwoAxis">
  952. <span class="lable-text">右2轴</span>
  953. <div class="input-box">
  954. <div class="item">
  955. <div class="type-text">上限</div>
  956. <div class="step-box">
  957. <van-stepper input-width="60px" :min="axisLimitDataTem.min" v-model.number="axisLimitDataTem.rightTwoMax" />
  958. </div>
  959. </div>
  960. <div class="item">
  961. <div class="type-text">下限</div>
  962. <div class="step-box">
  963. <van-stepper input-width="60px" :min="axisLimitDataTem.min" v-model.number="axisLimitDataTem.rightTwoMin" />
  964. </div>
  965. </div>
  966. </div>
  967. </div>
  968. <!-- x轴 -->
  969. <div class="item-box" v-if="axisLimitState.hasXAxis">
  970. <span class="lable-text">X轴</span>
  971. <div class="input-box">
  972. <div class="item">
  973. <div class="type-text">上限</div>
  974. <div class="step-box">
  975. <van-stepper input-width="60px" :min="axisLimitDataTem.min" v-model.number="axisLimitDataTem.xMax" />
  976. </div>
  977. </div>
  978. <div class="item">
  979. <div class="type-text">下限</div>
  980. <div class="step-box">
  981. <van-stepper input-width="60px" :min="axisLimitDataTem.min" v-model.number="axisLimitDataTem.xMin" />
  982. </div>
  983. </div>
  984. </div>
  985. </div>
  986. </div>
  987. <div class="bot-btn-box" @click="handleConfirmLimitChange">确定</div>
  988. </div>
  989. </van-popup>
  990. <!-- 更多操作弹窗 -->
  991. <van-popup
  992. v-model:show="showMoreAction"
  993. :position="width>650?'center':'bottom'"
  994. :style="width>650?{ width: '400px'}:''"
  995. round
  996. >
  997. <div class="more-action-wrap">
  998. <div class="van-ellipsis title-box">{{chartInfo.ChartName}}</div>
  999. <div class="item" @click.stop="handleChartRefresh" v-permission="myETABtn.myChart_refresh">
  1000. 刷新
  1001. </div>
  1002. <div class="item" @click.stop="handleChartShare" v-if="!chartInfo.Disabled&&checkAuthBtn(myETABtn.myChart_share)">
  1003. 分享
  1004. </div>
  1005. <div class="item" @click.stop="handleChartSave" v-if="[1,2,5,10].includes(chartInfo.Source)&&checkAuthBtn(myETABtn.myChart_save)">
  1006. 保存
  1007. </div>
  1008. <div class="item" @click.stop="handleRemoveChart" v-if="$route.query.iscommon!='true'&&checkAuthBtn(myETABtn.myChart_move)">
  1009. 移出
  1010. </div>
  1011. <div class="item" @click.stop="handleShowCopyTo" v-if="$route.query.iscommon!='true'&&checkAuthBtn(myETABtn.myChart_copyTo)">
  1012. 复制到
  1013. </div>
  1014. <div class="item" @click.stop="isShowAddToMyETADialog=true" v-if="$route.query.from==='edbRelationChart'">
  1015. 加入我的图库
  1016. </div>
  1017. <div class="item" @click.stop="showSaveChartOther=true" v-if="chartInfo.Button.IsCopy&&checkAuthBtn(myETABtn.myChart_otherSave)&&chartInfo.Source!==11">
  1018. 另存为
  1019. </div>
  1020. <div class="item" @click.stop="handleChartSavePicture" v-if="!chartInfo.Disabled&&checkAuthBtn(myETABtn.myChart_copyWechat)&&checkAuthBtn(myETABtn.myChart_copyOffice)">
  1021. 保存至相册
  1022. </div>
  1023. <div class="item" @click.stop="showSaveToMaterial=true" v-if="checkAuthBtn(myETABtn.myChart_saveToMaterial)">
  1024. 保存为素材
  1025. </div>
  1026. <div class="item" @click.stop="handleShowEditEnName" v-permission="myETABtn.myChart_enNameSetting" v-if="chartInfo.Source!==11">
  1027. 设置英文名称
  1028. </div>
  1029. <div class="item" @click.stop="handleDeleteChart" v-if="chartInfo.IsEdit&&checkAuthBtn(myETABtn.myChart_del)">
  1030. 删除
  1031. </div>
  1032. </div>
  1033. </van-popup>
  1034. <!-- 复制到 -->
  1035. <van-popup
  1036. v-model:show="showCopyTo"
  1037. :position="width>650?'center':'bottom'"
  1038. :round="width>650?true:false"
  1039. closeable
  1040. >
  1041. <div class="global-pop-wrap_mobile chart-copyto-wrap">
  1042. <div class="head-box">
  1043. <div class="title">复制到</div>
  1044. </div>
  1045. <div class="content">
  1046. <ul>
  1047. <li
  1048. :class="['item',item.select?'active':'']"
  1049. v-for="item in copyToOpt"
  1050. :key="item.MyChartClassifyId"
  1051. @click="item.select=!item.select"
  1052. >{{item.MyChartClassifyName}}</li>
  1053. </ul>
  1054. <div v-if="copyToOpt.length===0" style="padding:50px 0;text-align:center">暂无分类,快去创建我的分类吧~</div>
  1055. </div>
  1056. <div class="bot-btn-box" @click="handleConfirmCopy" v-if="copyToOpt.length>0">确定</div>
  1057. </div>
  1058. </van-popup>
  1059. <!-- 另存为 -->
  1060. <ChartSaveOther
  1061. :source="chartInfo?.Source"
  1062. :chartInfo="chartInfo"
  1063. :show="showSaveChartOther"
  1064. @close="showSaveChartOther=false"
  1065. />
  1066. <!--保存图片弹窗 -->
  1067. <van-popup
  1068. v-model:show="savePicDialogShow"
  1069. position="center"
  1070. round
  1071. >
  1072. <div class="chart-picture-box">
  1073. <img :src="savePicSrc" alt="">
  1074. <p style="text-align: center;color:#999;margin-top: 10px;">长按保存图片</p>
  1075. </div>
  1076. </van-popup>
  1077. <!-- 修改英文名称 -->
  1078. <van-popup
  1079. v-model:show="showEidtEnName"
  1080. position="bottom"
  1081. :style="{height:'100%'}"
  1082. >
  1083. <set-chart-en-name
  1084. :isShow="showEidtEnName"
  1085. :chartInfo="chartInfoData"
  1086. @cancel="showEidtEnName=false"
  1087. @success="handleEditEnNameSuccess"
  1088. />
  1089. </van-popup>
  1090. <!-- 加入我的图库 -->
  1091. <AddChartToMyETA
  1092. :isShowDialog="isShowAddToMyETADialog"
  1093. :dialogPosition="width>650?'center':'bottom'"
  1094. :chartInfo="chartInfo"
  1095. @close="isShowAddToMyETADialog=false"
  1096. />
  1097. <!-- 保存至素材库 -->
  1098. <SaveToMaterial
  1099. v-model:show="showSaveToMaterial"
  1100. source="chart"
  1101. :sourceId="chartInfo.ChartInfoId"
  1102. :defaultName="chartInfo.ChartName"
  1103. />
  1104. </template>
  1105. <style lang="scss" scoped>
  1106. .chart-detail-page{
  1107. padding: $page-padding;
  1108. padding-bottom: 120px;
  1109. .chart-title{
  1110. font-size: 36px;
  1111. margin-bottom: 56px;
  1112. }
  1113. .chart-render-wrap{
  1114. .pad-change-chart-btn{
  1115. display: none;
  1116. }
  1117. }
  1118. .chart-box{
  1119. width: 100%;
  1120. height: 700px;
  1121. }
  1122. .pad-time-action-wrap{
  1123. display: none;
  1124. }
  1125. .select-time-box{
  1126. display: flex;
  1127. align-items: center;
  1128. .left-icon{
  1129. width: 48px;
  1130. height: 48px;
  1131. }
  1132. .right-icon{
  1133. margin-left: auto;
  1134. }
  1135. .val-box{
  1136. margin-left: 32px;
  1137. font-size: 32px;
  1138. &.val-box_grey{
  1139. color: $font-grey_999;
  1140. }
  1141. }
  1142. }
  1143. .select-year-box{
  1144. width: 100vw;
  1145. position: relative;
  1146. left: -$page-padding;
  1147. margin-top: 30px;
  1148. box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.08);
  1149. height: 88px;
  1150. display: flex;
  1151. align-items: center;
  1152. overflow-y: auto;
  1153. padding: 0 $page-padding;
  1154. &::-webkit-scrollbar{
  1155. height: 0;
  1156. }
  1157. .item{
  1158. line-height: 88px;
  1159. position: relative;
  1160. height: 100%;
  1161. flex-shrink: 0;
  1162. display: inline-block;
  1163. margin-right: 40px;
  1164. font-size: 32px;
  1165. color: $font-grey_999;
  1166. &.active{
  1167. color: #333;
  1168. &::after{
  1169. content: '';
  1170. display: block;
  1171. width: 50px;
  1172. height: 6px;
  1173. border-radius: 3px;
  1174. background-color: $theme-color;
  1175. position: absolute;
  1176. bottom: 0;
  1177. left: 50%;
  1178. transform: translateX(-50%);
  1179. }
  1180. }
  1181. }
  1182. }
  1183. .calendar-type-box{
  1184. width: 404px;
  1185. margin: 30px auto;
  1186. text-align: center;
  1187. border: 1px solid $theme-color;
  1188. border-radius: 12px;
  1189. overflow: hidden;
  1190. span{
  1191. display: inline-block;
  1192. width: 200px;
  1193. height: 80px;
  1194. line-height: 80px;
  1195. color: $theme-color;
  1196. font-weight: bold;
  1197. &.active{
  1198. background-color: $theme-color;
  1199. color: #fff;
  1200. }
  1201. }
  1202. }
  1203. .edb-list-box{
  1204. margin-top: 20px;
  1205. .list-item{
  1206. padding:18px;
  1207. display: flex;
  1208. gap:0 20px;
  1209. border-bottom: 1px solid #DCDFE6;
  1210. &:last-child{
  1211. border-bottom: none;
  1212. }
  1213. .edb-name{
  1214. flex: 1;
  1215. }
  1216. }
  1217. }
  1218. .fix-bot-action-box{
  1219. position: fixed;
  1220. left: 0;
  1221. bottom: 0;
  1222. right: 0;
  1223. z-index: 99;
  1224. background-color: #fff;
  1225. border-top: 1px solid $border-color;
  1226. height: 112px;
  1227. display: flex;
  1228. align-items: center;
  1229. .item{
  1230. height: 100%;
  1231. flex: 1;
  1232. display: flex;
  1233. flex-direction: column;
  1234. justify-content: center;
  1235. align-items: center;
  1236. font-size: 20px;
  1237. .icon{
  1238. width: 40px;
  1239. height: 40px;
  1240. margin-bottom: 5px;
  1241. }
  1242. }
  1243. }
  1244. }
  1245. .chart-set-limit-wrap{
  1246. .head-box{
  1247. .title{
  1248. padding: 0 $page-padding;
  1249. font-size: 36px;
  1250. font-weight: 600;
  1251. line-height: 120px;
  1252. }
  1253. }
  1254. .bot-btn-box{
  1255. line-height: 112px;
  1256. text-align: center;
  1257. color: $theme-color;
  1258. font-size: 32px;
  1259. }
  1260. .content{
  1261. padding: $page-padding;
  1262. .item-box{
  1263. display: flex;
  1264. align-items: flex-end;
  1265. margin-bottom: 30px;
  1266. .lable-text{
  1267. width: 100px;
  1268. }
  1269. .input-box{
  1270. flex: 1;
  1271. display: flex;
  1272. .item{
  1273. flex: 1;
  1274. text-align: center;
  1275. .type-text{
  1276. margin-bottom: 40px;
  1277. }
  1278. .step-box{
  1279. display: inline-block;
  1280. :deep(.van-stepper){
  1281. display: flex;
  1282. justify-content: center;
  1283. }
  1284. }
  1285. }
  1286. }
  1287. }
  1288. }
  1289. }
  1290. .more-action-wrap{
  1291. .title-box{
  1292. font-size: 36px;
  1293. font-weight: 600;
  1294. text-align: center;
  1295. padding: $page-padding;
  1296. }
  1297. .item{
  1298. display: flex;
  1299. align-items: center;
  1300. justify-content: center;
  1301. padding: 32px 34px;
  1302. border-top: 1px solid $border-color;
  1303. font-size: 32px;
  1304. }
  1305. }
  1306. .chart-copyto-wrap{
  1307. .head-box{
  1308. .title{
  1309. padding: 0 $page-padding;
  1310. font-size: 36px;
  1311. font-weight: 600;
  1312. line-height: 120px;
  1313. }
  1314. }
  1315. .bot-btn-box{
  1316. line-height: 112px;
  1317. text-align: center;
  1318. color: $theme-color;
  1319. font-size: 32px;
  1320. }
  1321. .content{
  1322. .item{
  1323. padding: 32px $page-padding;
  1324. font-size: 32px;
  1325. border-bottom: 1px solid $border-color;
  1326. position: relative;
  1327. &.active{
  1328. color: $theme-color;
  1329. &::after{
  1330. content: '';
  1331. display: block;
  1332. width: 36px;
  1333. height: 36px;
  1334. background-image: url('@/assets/imgs/icon_select2.png');
  1335. background-size: cover;
  1336. background-repeat: no-repeat;
  1337. position: absolute;
  1338. top: 50%;
  1339. right: $page-padding;
  1340. transform: translateY(-50%);
  1341. }
  1342. }
  1343. }
  1344. }
  1345. }
  1346. .chart-picture-box{
  1347. width: 300PX;
  1348. border-radius: 6PX;
  1349. padding: 10PX;
  1350. background-color: #fff;
  1351. img{
  1352. width: 100%;
  1353. display: block;
  1354. }
  1355. }
  1356. @media screen and (min-width:$media-width){
  1357. .chart-detail-page{
  1358. padding: 30px;
  1359. .chart-title{
  1360. font-size: 16px;
  1361. margin-bottom: 30px;
  1362. }
  1363. .chart-render-wrap{
  1364. position: relative;
  1365. .pad-change-chart-btn{
  1366. display: block;
  1367. width: 48px;
  1368. height: 48px;
  1369. position: absolute;
  1370. top: 50%;
  1371. transform: translateY(-50%);
  1372. left: 0px;
  1373. &.pad-change-chart-next-btn{
  1374. right: 0;
  1375. left: auto;
  1376. transform: translateY(-50%) rotate(180deg);
  1377. }
  1378. }
  1379. }
  1380. .chart-box{
  1381. width: 85%;
  1382. height: 370px;
  1383. margin: 0 auto;
  1384. }
  1385. .select-time-box{
  1386. display: none;
  1387. }
  1388. .select-year-box{
  1389. display: none;
  1390. }
  1391. .calendar-type-box{
  1392. width: 224px;
  1393. margin: 20px auto;
  1394. border-radius: 4px;
  1395. span{
  1396. width: 111px;
  1397. height: 38px;
  1398. line-height: 38px;
  1399. }
  1400. }
  1401. .edb-list-box{
  1402. margin-top: 30px;
  1403. .list-item{
  1404. padding: 10px 0;
  1405. }
  1406. }
  1407. .fix-bot-action-box{
  1408. display: none;
  1409. }
  1410. .pad-time-action-wrap{
  1411. display: flex;
  1412. flex-wrap: wrap;
  1413. align-items: center;
  1414. justify-content: space-between;
  1415. .left-time-box{
  1416. flex-shrink: 0;
  1417. margin-bottom: 20px;
  1418. .item{
  1419. display: inline-block;
  1420. width: 80px;
  1421. height: 36px;
  1422. text-align: center;
  1423. line-height: 36px;
  1424. border: 1px solid $theme-color;
  1425. margin-right: 10px;
  1426. border-radius: 3px;
  1427. color: $theme-color;
  1428. &.active{
  1429. color: #fff;
  1430. background-color: $theme-color;
  1431. }
  1432. }
  1433. .time-box{
  1434. display: inline-block;
  1435. padding: 0 15px;
  1436. height: 36px;
  1437. line-height: 36px;
  1438. border: 1px solid $theme-color;
  1439. border-radius: 3px;
  1440. background-color: #F2F3FF;
  1441. color: $theme-color;
  1442. }
  1443. }
  1444. .right-action-box{
  1445. display: flex;
  1446. margin-bottom: 20px;
  1447. .item{
  1448. display: flex;
  1449. color: $theme-color;
  1450. margin-left: 20px;
  1451. img{
  1452. width: 18px;
  1453. height: 18px;
  1454. margin-right: 4px;
  1455. }
  1456. }
  1457. .red{
  1458. color: $theme-red;
  1459. }
  1460. }
  1461. }
  1462. }
  1463. .chart-set-limit-wrap{
  1464. .head-box{
  1465. .title{
  1466. font-size: 18px;
  1467. line-height: 50px;
  1468. padding-left: 16px;
  1469. }
  1470. }
  1471. .bot-btn-box{
  1472. font-size: 16px;
  1473. line-height: 56px;
  1474. border-top-width: 8px;
  1475. }
  1476. .content{
  1477. max-height: 500px;
  1478. padding: 30px;
  1479. .item-box{
  1480. margin-bottom: 15px;
  1481. .lable-text{
  1482. width: 50px;
  1483. }
  1484. .input-box{
  1485. .item{
  1486. .type-text{
  1487. margin-bottom: 20px;
  1488. }
  1489. }
  1490. }
  1491. }
  1492. }
  1493. }
  1494. .more-action-wrap{
  1495. .title-box{
  1496. font-size: 18px;
  1497. padding: 20px $page-padding;
  1498. }
  1499. .item{
  1500. padding: 20px $page-padding;
  1501. font-size: 16px;
  1502. }
  1503. }
  1504. .chart-copyto-wrap{
  1505. width: 375px;
  1506. .head-box{
  1507. .title{
  1508. font-size: 18px;
  1509. line-height: 50px;
  1510. padding-left: 16px;
  1511. }
  1512. }
  1513. .bot-btn-box{
  1514. font-size: 16px;
  1515. line-height: 56px;
  1516. border-top-width: 8px;
  1517. }
  1518. .content{
  1519. max-height: 500px;
  1520. overflow-y: auto;
  1521. .item{
  1522. padding: 16px;
  1523. font-size: 16px;
  1524. &.active{
  1525. &::after{
  1526. width: 18px;
  1527. height: 18px;
  1528. right: 16px;
  1529. }
  1530. }
  1531. }
  1532. }
  1533. }
  1534. .chart-picture-box{
  1535. width: 500PX;
  1536. }
  1537. }
  1538. .noAuth {
  1539. text-align: center;
  1540. .img {
  1541. margin-bottom: 20px;
  1542. }
  1543. }
  1544. </style>