OtherCalculate.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  1. <script setup>
  2. import {ref,reactive,watch, computed} from 'vue'
  3. import { useRoute, useRouter } from "vue-router";
  4. import EDBHistory from '@/views/dataEDB/components/EDBHistory.vue'
  5. import SelectEDB from './SelectEDB.vue'
  6. import SelectEDBClassify from '../../components/SelectEDBClassify.vue'
  7. import SelectEDBUnit from '../../components/SelectEDBUnit.vue'
  8. import SelectEDBFrequency from '../../components/SelectEDBFrequency.vue'
  9. import SeeEDBDataList from './SeeEDBDataList.vue'
  10. import {calculateTypeTipsMap} from '../../util/config'
  11. import { showToast } from 'vant';
  12. import apiDataEDB from '@/api/dataEDB'
  13. import { useWindowSize } from '@vueuse/core'
  14. import {useToHistoryPage} from '@/hooks/edb/useToHistoryPage'
  15. const {toHistoryPage} = useToHistoryPage()
  16. const { width } = useWindowSize()
  17. const route=useRoute()
  18. const router=useRouter()
  19. const props=defineProps({
  20. edbInfo:{
  21. type:Object,
  22. default:null
  23. }
  24. })
  25. watch(
  26. ()=>props.edbInfo,
  27. ()=>{
  28. if(['edit','preview'].includes(route.query.type)){
  29. const fromEdbInfo=props.edbInfo.CalculateList[0]
  30. const edbInfoData=props.edbInfo.EdbInfoDetail
  31. searchEDBInfoByCode(fromEdbInfo.FromEdbCode)
  32. baseInfo.name=edbInfoData.EdbName
  33. baseInfo.unit=edbInfoData.Unit
  34. baseInfo.classify=edbInfoData.ClassifyId
  35. baseInfo.frequency=edbInfoData.Frequency
  36. if(edbInfoData.Source===51){//降频
  37. baseInfo.valueType=edbInfoData.CalculateFormula
  38. }
  39. if(edbInfoData.Source===35){//超季节性
  40. baseInfo.calendarType=edbInfoData.Calendar
  41. }
  42. if(edbInfoData.Source===22){//时间位移
  43. baseInfo.moveType=edbInfoData.MoveType
  44. baseInfo.moveUnit=edbInfoData.MoveFrequency
  45. baseInfo.moveVal=edbInfoData.CalculateFormula
  46. }
  47. if([8,12,13,35].includes(edbInfoData.Source)){
  48. baseInfo.numberN=Number(edbInfoData.CalculateFormula)
  49. }
  50. if([72].includes(edbInfoData.Source)){//指数修匀
  51. baseInfo.alphaVal=Number(edbInfoData.CalculateFormula)
  52. }
  53. if([62].includes(edbInfoData.Source)){//最新值处理
  54. const ExtraObj=JSON.parse(edbInfoData.Extra)
  55. baseInfo.newVal=ExtraObj.LastValType==1?'均值填充':'默认'
  56. }
  57. setTimeout(() => {
  58. selectEDBClassifyINS.value?.getSelectClassifyOpt(props.edbInfo.EdbInfoDetail.ClassifyId)//获取选择的分类目录
  59. }, 1000);
  60. }
  61. }
  62. )
  63. // 预览页面
  64. const isPreview=ref(route.query.type==='preview'||false)
  65. const moveTypeOpts=[{name:'领先',key:1},{name:'滞后',key:2}]
  66. const moveUnitOpts=[
  67. {name:'天',key:'天'},
  68. {name:'周',key:'周'},
  69. {name:'月',key:'月'},
  70. {name:'季',key:'季'},
  71. {name:'年',key:'年'},
  72. ]
  73. //公式说明
  74. const showTips=ref(false)
  75. const tipsContent=ref(calculateTypeTipsMap.get(['toMonthSeason','accumulate'].includes(route.query.source)? route.query.source: Number(route.query.source))||'')
  76. //提交计算按钮文字
  77. function getCalculateBtnText(){
  78. let str='生成计算指标'
  79. const btnTextMap=new Map([
  80. [5,'转月值计算'],
  81. [6,'同比值计算'],
  82. [7,'同差值计算'],
  83. [8,'移动平均计算'],
  84. [12,'环比值计算'],
  85. [13,'环差值计算'],
  86. [14,'升频计算'],
  87. [22,'保存'],
  88. [35,'超季节性计算'],
  89. [52,'年化计算'],
  90. [51,'降频计算'],
  91. [61,'转季值计算'],
  92. [62,'累计值计算'],
  93. [63,'年初至今计算'],
  94. [72,'指数修匀计算'],
  95. [75,'日均值计算'],
  96. ])
  97. str=btnTextMap.get(source.value)
  98. return str
  99. }
  100. const editEdbInfoId=ref(route.query.edbInfoId||0)//编辑时的指标id
  101. const source=ref(0)//计算类型
  102. const tabsArr=ref([])
  103. // 初始化
  104. function init(){
  105. // 累计值转月/季值
  106. if(route.query.source==='toMonthSeason'){
  107. tabsArr.value=[{ label: '累计值转月值',key: 5 },{ label: '累计值转季值',key: 61 }]
  108. source.value=5
  109. }else if(route.query.source==='accumulate'){//累计值
  110. tabsArr.value=[{ label: '累计值',key: 62 },{ label: '年初至今累计值',key: 63 }]
  111. source.value=62
  112. }else{
  113. tabsArr.value=[]
  114. source.value=Number(route.query.source)
  115. }
  116. }
  117. init()
  118. // 选择指标
  119. const showSelectEDB=ref(false)
  120. const selectEDBinfo=ref(null)
  121. function handleConfirmSelectEDB(e){
  122. selectEDBinfo.value=e
  123. updateBaseInfoData(e)
  124. }
  125. // 编辑时回显选择的指标 通过code去搜索
  126. function searchEDBInfoByCode(code){
  127. apiDataEDB.edbSearchList({KeyWord:code,CurrentIndex:1,PageSize:1}).then(res=>{
  128. if(res.Ret===200){
  129. selectEDBinfo.value=res.Data?.List[0]
  130. }
  131. })
  132. }
  133. // 选择指标更新基础信息
  134. function updateBaseInfoData(data){
  135. const tMap=new Map([
  136. ['日度','D'],
  137. ['周度','W'],
  138. ['旬度','T'],
  139. ['月度','M'],
  140. ['季度','Q'],
  141. ['年度','Y'],
  142. ])
  143. const name_map = {
  144. 5: `${data.EdbName}转月值`,
  145. 8: `${data.EdbName}/${baseInfo.numberN}${tMap.get(data.Frequency)}MA`,
  146. 14: `${data.EdbName}/日频`,
  147. 6: `${data.EdbName}同比`,
  148. 7: `${data.EdbName}同差`,
  149. 12: `${data.EdbName}${baseInfo.numberN}${data.Frequency.slice(0,1)}环比`,
  150. 13: `${data.EdbName}${baseInfo.numberN}${data.Frequency.slice(0,1)}环差`,
  151. 35: `${data.EdbName}超季节性/${baseInfo.numberN}年${baseInfo.calendarType==='公历'?'':'/'+baseInfo.calendarType}`,
  152. 52: `${data.EdbName}年化值`,
  153. 51: `${data.EdbName}/${data.Frequency.substr(0,1)}频`,
  154. 61: `${data.EdbName}转季值`,
  155. 62: `${data.EdbName}累计值/${data.Frequency}`,
  156. 63: `${data.EdbName}年初至今累计值`,
  157. 72: `${data.EdbName}指数修匀`,
  158. 75: `${data.EdbName}日均值`,
  159. 22:`${data.EdbName}${getMoveTypeName(baseInfo.moveType)}${baseInfo.moveVal}${baseInfo.moveUnit}`
  160. }
  161. baseInfo.name=name_map[source.value]||''
  162. baseInfo.unit=[5,8,13,14,7,35,72,75,61,62,63,52].includes(source.value) ? data.Unit : '无'
  163. if(source.value === 14){
  164. baseInfo.frequency='日度'
  165. }else if(source.value === 61){
  166. baseInfo.frequency='季度'
  167. }else{
  168. baseInfo.frequency=data.Frequency
  169. }
  170. // baseInfo.frequency=source.value === 14 ? '日度' : source.value === 61 ? '季度' : source.value === 62 ? '' : data.Frequency
  171. if([5,6,7,8,12,13,14,22,35,51,52,61,62,63,72,75].includes(source.value)){//目录默认和选择的指标在同一个目录
  172. selectEDBClassifyINS.value?.getSelectClassifyOpt(data.ClassifyId)//获取选择的分类目录
  173. }
  174. }
  175. // 基础信息
  176. const edbNameInputFocus=ref(false)
  177. const numberNInputFocus=ref(false)
  178. const alphaValInputFocus=ref(false)
  179. const baseInfo=reactive({
  180. name:'',
  181. unit:'',
  182. classify:'',
  183. frequency:'',
  184. numberN:1,//N值
  185. moveVal:'',
  186. moveType:1,
  187. moveUnit:'天',
  188. calendarType:'公历',
  189. valueType:'期末值',
  190. alphaVal:'',
  191. newVal:'默认',
  192. })
  193. // 选择单位
  194. const showSelectUnit=ref(false)
  195. function onConfirmSelectUnit(value){
  196. baseInfo.unit=value
  197. }
  198. //选择分类
  199. const showSelectClassify=ref(false)
  200. const classifyStr=ref('')
  201. const selectEDBClassifyINS=ref(null)
  202. function handleConfirmClassify({value,selectedOptions}){
  203. if(selectedOptions.length===0){
  204. baseInfo.classify=''
  205. classifyStr.value=''
  206. return
  207. }
  208. baseInfo.classify=value
  209. const textArr=selectedOptions.map(item=>item.ClassifyName)
  210. classifyStr.value=`${textArr.join('/')}`
  211. }
  212. //选择频度
  213. const showSelectFrequency=ref(false)
  214. function handleConfirmFrequency(value){
  215. baseInfo.frequency=value
  216. // 修改指标名称
  217. if(!selectEDBinfo.value||editEdbInfoId.value) return
  218. const name_map = {
  219. 51: `${selectEDBinfo.value.EdbName}/${baseInfo.frequency.substr(0,1)}频`,
  220. 62: `${selectEDBinfo.value.EdbName}累计值/${baseInfo.frequency}`,
  221. }
  222. baseInfo.name=name_map[source.value]||''
  223. }
  224. //移动方式类型选择
  225. const showMoveType=ref(false)
  226. function onSelectMoveType(e){
  227. baseInfo.moveType=e.key
  228. }
  229. function getMoveTypeName(e){
  230. return moveTypeOpts.filter(item=>item.key===e)[0].name
  231. }
  232. //移动方式单位选择
  233. const showMoveUnit=ref(false)
  234. function onSelectMoveUnit(e){
  235. baseInfo.moveUnit=e.key
  236. }
  237. //超季节性日历选择
  238. const showSelectCalendar=ref(false)
  239. //降频数据取值选择
  240. const showDataValSelect=ref(false)
  241. //查看指标数据详情
  242. const showSeeEDBDataList=ref(false)
  243. //选择最新值处理方式
  244. const showNewValSelect=ref(false)
  245. const newValOpts=ref([{name:'默认'}])
  246. const frequencyChangeFlag=computed(()=>{
  247. return selectEDBinfo.value?.Frequency+'转'+baseInfo.frequency
  248. })
  249. watch(
  250. ()=>frequencyChangeFlag.value,
  251. (n)=>{
  252. const arr=['日度转周度','日度转旬度','周度转旬度']
  253. if(n&&arr.includes(n)){
  254. newValOpts.value=[{name:'默认'}]
  255. baseInfo.newVal=''
  256. }else{
  257. newValOpts.value=[{name:'默认'},{name:'均值填充'}]
  258. }
  259. }
  260. )
  261. // 提交计算
  262. const saveBtnLoading=ref(false)
  263. async function handleSave(){
  264. if(!selectEDBinfo.value){
  265. showToast('指标不能为空')
  266. return
  267. }
  268. if(!baseInfo.name){
  269. showToast('指标名称不能为空')
  270. return
  271. }
  272. if(!baseInfo.unit){
  273. showToast('指标单位不能为空')
  274. return
  275. }
  276. if(!baseInfo.classify){
  277. showToast('指标目录不能为空')
  278. return
  279. }
  280. if(!baseInfo.frequency){
  281. showToast('指标频度不能为空')
  282. return
  283. }
  284. if([72].includes(source.value)){
  285. if(baseInfo.alphaVal<=0||baseInfo.alphaVal>=1){
  286. showToast('请输入>0,<1的alpha数值')
  287. return
  288. }
  289. }
  290. const valueMap = {
  291. 22: 'moveVal',
  292. 51: 'valueType',
  293. 72: 'alphaVal'
  294. }
  295. const params={
  296. FromEdbInfoId: selectEDBinfo.value.EdbInfoId,
  297. Source: source.value,
  298. EdbName: baseInfo.name,
  299. Unit: baseInfo.unit,
  300. ClassifyId: baseInfo.classify,
  301. Frequency: baseInfo.frequency,
  302. Formula: valueMap[source.value] ? String(baseInfo[valueMap[source.value]]) : String(baseInfo.numberN),
  303. MoveFrequency: baseInfo.moveUnit,
  304. MoveType: baseInfo.moveType,
  305. Calendar: baseInfo.calendarType,
  306. Extra:JSON.stringify({
  307. LastValType:baseInfo.newVal==='均值填充'?1:0
  308. })
  309. }
  310. saveBtnLoading.value=true
  311. const res=route.query.type==='edit'?await apiDataEDB.editCalculateEDB({...params,EdbInfoId:Number(route.query.edbInfoId)}) : await apiDataEDB.addCalculateEDB(params)
  312. saveBtnLoading.value=false
  313. if(res.Ret===200){
  314. showToast(res.Msg)
  315. setTimeout(() => {
  316. if(route.query.type==='edit'){
  317. router.back()
  318. }else{
  319. router.replace({
  320. path:'/dataEDB/detail',
  321. query:{
  322. edbInfoId:res.Data.EdbInfoId
  323. }
  324. })
  325. }
  326. }, 1500);
  327. }
  328. }
  329. // tab切换重置表单
  330. function handleTabChange(){
  331. selectEDBinfo.value=null
  332. baseInfo.name=''
  333. baseInfo.unit=''
  334. baseInfo.classify=''
  335. baseInfo.frequency=''
  336. baseInfo.numberN=1
  337. baseInfo.moveVal=''
  338. baseInfo.moveType=1
  339. baseInfo.moveUnit='天'
  340. baseInfo.calendarType='公历'
  341. baseInfo.valueType='期末值'
  342. baseInfo.newVal='默认'
  343. classifyStr.value=''
  344. }
  345. //点击选择的指标左侧图标查看指标详情
  346. const showEDBHistory=ref(false)// 显示指标溯源
  347. const edbHistoryId=ref(0)
  348. function handleShowEDBHistory(data){
  349. //计算指标打开弹窗,基础指标打开新页面
  350. if(data.EdbType===2){
  351. /* edbHistoryId.value=data.EdbInfoId
  352. showEDBHistory.value=true */
  353. toHistoryPage(data.EdbInfoId)
  354. }else{
  355. const routerEl=router.resolve({
  356. path:'/dataEDB/detail',
  357. query:{
  358. edbInfoId:data.EdbInfoId
  359. }
  360. })
  361. window.open(routerEl.href,'_blank')
  362. }
  363. }
  364. </script>
  365. <template>
  366. <div class="other-calculate-wrap">
  367. <van-tabs
  368. v-model:active="source"
  369. sticky
  370. :offset-top="width>650?60:0"
  371. border
  372. title-active-color="#0052D9"
  373. title-inactive-color="#333"
  374. line-width="16px"
  375. @change="handleTabChange"
  376. v-if="tabsArr.length"
  377. >
  378. <van-tab
  379. :title="tab.label"
  380. :name="tab.key"
  381. v-for="tab in tabsArr"
  382. :key="tab.key"
  383. />
  384. </van-tabs>
  385. <section class="section select-edb-box">
  386. <van-field
  387. :modelValue="selectEDBinfo?.EdbName"
  388. label="选择指标"
  389. :right-icon="!isPreview?'arrow':''"
  390. readonly
  391. placeholder="请选择指标"
  392. input-align="right"
  393. @click-input="showSelectEDB=true"
  394. :disabled="isPreview"
  395. >
  396. <template #left-icon>
  397. <div class="left-icon" v-if="selectEDBinfo" @click="handleShowEDBHistory(selectEDBinfo)">
  398. <svg-icon name="edb-history-tag" size="24px"/>
  399. </div>
  400. </template>
  401. </van-field>
  402. </section>
  403. <section class="section edbinfo-box">
  404. <div class="van-cell__title">已选指标</div>
  405. <div v-if="!selectEDBinfo">
  406. <img class="list-empty-img" src="https://hzstatic.hzinsights.com/static/ETA_mobile/empty_img.png" alt="">
  407. <p style="text-align:center;color:#999">暂无指标</p>
  408. </div>
  409. <div class="info-box" v-else>
  410. <h2 class="name">{{selectEDBinfo?.EdbName}}</h2>
  411. <ul class="info-list">
  412. <li class="info-item">ID:{{selectEDBinfo.EdbCode}}</li>
  413. <li class="info-item">起始时间:{{selectEDBinfo.StartDate}}</li>
  414. <li class="info-item">频度:{{selectEDBinfo.Frequency}}</li>
  415. <li class="info-item">更新时间:{{selectEDBinfo.ModifyTime}}</li>
  416. <li class="info-item">单位:{{selectEDBinfo.Unit}}</li>
  417. <li class="info-item">数据来源:{{selectEDBinfo.SourceName}}</li>
  418. </ul>
  419. <div style="text-align:right">
  420. <van-button color="#0052D9" size="small" @click="showSeeEDBDataList=true">查看数据</van-button>
  421. </div>
  422. </div>
  423. </section>
  424. <section class="section baseinfo-box">
  425. <!-- 时间位移(移动方式) -->
  426. <van-field
  427. label="移动方式"
  428. required
  429. v-if="source===22"
  430. :disabled="isPreview"
  431. >
  432. <template #input>
  433. <div class="move-type-box">
  434. <div :class="['btn',isPreview?'disabled':'']" @click="()=>{if(isPreview)return false;showMoveType=true}">
  435. <svg-icon name="swap" v-if="!isPreview"></svg-icon>
  436. <span>{{getMoveTypeName(baseInfo.moveType)}}</span>
  437. </div>
  438. <input :disabled="isPreview" class="input" type="number" :min="0" v-model="baseInfo.moveVal">
  439. <div :class="['btn',isPreview?'disabled':'']" @click="()=>{if(isPreview)return false;showMoveUnit=true}">
  440. <svg-icon name="swap" v-if="!isPreview"></svg-icon>
  441. <span>{{baseInfo.moveUnit}}</span>
  442. </div>
  443. </div>
  444. </template>
  445. </van-field>
  446. <van-field
  447. v-model="baseInfo.name"
  448. label="指标名称"
  449. placeholder="指标名称"
  450. input-align="right"
  451. required
  452. @focus="edbNameInputFocus=true"
  453. @blur="edbNameInputFocus=false"
  454. :disabled="isPreview"
  455. >
  456. <template #right-icon>
  457. <svg-icon v-if="!isPreview" class="edit-icon" name="edit" :color="edbNameInputFocus?'#0052D9':'#333333'"/>
  458. </template>
  459. </van-field>
  460. <van-field
  461. :modelValue="baseInfo.unit"
  462. readonly
  463. label="单位"
  464. placeholder="请选择单位"
  465. input-align="right"
  466. :right-icon="!isPreview?'arrow':''"
  467. required
  468. @click-input="showSelectUnit=true"
  469. :disabled="!editEdbInfoId&&[6,7,75].includes(source)||isPreview"
  470. />
  471. <van-field
  472. :modelValue="classifyStr"
  473. readonly
  474. label="指标目录"
  475. placeholder="请选择指标目录"
  476. input-align="right"
  477. :right-icon="!isPreview?'arrow':''"
  478. required
  479. @click-input="showSelectClassify=true"
  480. :disabled="isPreview"
  481. />
  482. <van-field
  483. :modelValue="baseInfo.frequency"
  484. readonly
  485. label="频度"
  486. placeholder="请选择指标频度"
  487. input-align="right"
  488. :right-icon="!isPreview?'arrow':''"
  489. required
  490. @click-input="showSelectFrequency=true"
  491. :disabled="[5,14,61,63].includes(source)||(!editEdbInfoId&&[6,7,75].includes(source))||isPreview"
  492. />
  493. <van-field
  494. v-if="[8,12,13,35].includes(source)"
  495. v-model.number="baseInfo.numberN"
  496. label="N等于"
  497. placeholder="请输入N数值"
  498. input-align="right"
  499. required
  500. @focus="numberNInputFocus=true"
  501. @blur="numberNInputFocus=false"
  502. :disabled="isPreview"
  503. >
  504. <template #right-icon>
  505. <svg-icon v-if="!isPreview" class="edit-icon" name="edit" :color="numberNInputFocus?'#0052D9':'#333333'"/>
  506. </template>
  507. </van-field>
  508. <!-- 超季节性日历 -->
  509. <van-field
  510. v-if="source===35"
  511. :modelValue="baseInfo.calendarType"
  512. readonly
  513. label="日历"
  514. placeholder="请选择日历"
  515. input-align="right"
  516. :right-icon="!isPreview?'arrow':''"
  517. required
  518. @click-input="showSelectCalendar=true"
  519. :disabled="isPreview"
  520. />
  521. <!-- 降频数据取值 -->
  522. <van-field
  523. v-if="source===51"
  524. :modelValue="baseInfo.valueType"
  525. readonly
  526. label="数据取值"
  527. placeholder="请选择"
  528. input-align="right"
  529. :right-icon="!isPreview?'arrow':''"
  530. @click-input="showDataValSelect=true"
  531. :disabled="isPreview"
  532. />
  533. <!-- 指数修匀 alpha 值 -->
  534. <van-field
  535. v-if="[72].includes(source)"
  536. v-model.number="baseInfo.alphaVal"
  537. type="number"
  538. label="alpha值"
  539. placeholder="请输入alpha值"
  540. input-align="right"
  541. required
  542. @focus="alphaValInputFocus=true"
  543. @blur="alphaValInputFocus=false"
  544. :disabled="isPreview"
  545. >
  546. <template #right-icon>
  547. <svg-icon v-if="!isPreview" class="edit-icon" name="edit" :color="alphaValInputFocus?'#0052D9':'#333333'"/>
  548. </template>
  549. </van-field>
  550. <!-- 最新值处理 -->
  551. <van-field
  552. v-if="[62,63].includes(source)"
  553. :modelValue="baseInfo.newVal||'默认'"
  554. readonly
  555. label="最新值处理"
  556. placeholder="请选择"
  557. input-align="right"
  558. :right-icon="!isPreview?'arrow':''"
  559. @click-input="showNewValSelect=true"
  560. :disabled="isPreview"
  561. />
  562. </section>
  563. <div class="formula-intro-btn" @click="showTips=true">
  564. <svg-icon class="icon" name="warning"></svg-icon>
  565. <span>公式说明</span>
  566. </div>
  567. <div class="opt-btns" v-if="!isPreview">
  568. <van-button class="primary2" @click="$router.back()">取消</van-button>
  569. <van-button
  570. type="primary"
  571. :loading="saveBtnLoading"
  572. loading-text="计算中..."
  573. @click="handleSave"
  574. >{{getCalculateBtnText()}}</van-button>
  575. </div>
  576. </div>
  577. <!-- 选择指标 -->
  578. <SelectEDB v-model:show="showSelectEDB" :source='source' @select="handleConfirmSelectEDB"/>
  579. <!-- 选择单位 -->
  580. <SelectEDBUnit v-model:show="showSelectUnit" @select="onConfirmSelectUnit"/>
  581. <!-- 选择分类 -->
  582. <SelectEDBClassify ref="selectEDBClassifyINS" v-model:show="showSelectClassify" :defaultId="baseInfo.classify" @select="handleConfirmClassify" />
  583. <!-- 选择频度 -->
  584. <SelectEDBFrequency v-model:show="showSelectFrequency" @select="handleConfirmFrequency"/>
  585. <!-- 查看指标数据 -->
  586. <SeeEDBDataList v-model:show="showSeeEDBDataList" :edbInfoId="selectEDBinfo?.EdbInfoId" />
  587. <!-- 移动方式类型选择 -->
  588. <van-action-sheet v-model:show="showMoveType" close-on-click-action :actions="moveTypeOpts" @select="onSelectMoveType" />
  589. <!-- 移动方式单位选择 -->
  590. <van-action-sheet v-model:show="showMoveUnit" close-on-click-action :actions="moveUnitOpts" @select="onSelectMoveUnit" />
  591. <!-- 超季节性日历选择 -->
  592. <van-action-sheet v-model:show="showSelectCalendar" close-on-click-action :actions="[{name:'公历'},{name:'农历'}]" @select="e=>baseInfo.calendarType=e.name" />
  593. <!-- 降频数据取值 -->
  594. <van-action-sheet v-model:show="showDataValSelect" close-on-click-action :actions="[{name:'期末值'},{name:'平均值'}]" @select="e=>baseInfo.valueType=e.name" />
  595. <!-- 最新值处理选项 -->
  596. <van-action-sheet v-model:show="showNewValSelect" close-on-click-action :actions="newValOpts" @select="e=>baseInfo.newVal=e.name" />
  597. <!-- 指标溯源 -->
  598. <EDBHistory v-model:show="showEDBHistory" :edbInfoId="edbHistoryId"/>
  599. <!-- 公式说明 -->
  600. <van-dialog
  601. v-model:show="showTips"
  602. :title="$route.query.name"
  603. confirmButtonText='知道啦'
  604. >
  605. <div class="edb-formula-tips-html-box" v-html="tipsContent"></div>
  606. </van-dialog>
  607. </template>
  608. <style lang="scss" scoped>
  609. .other-calculate-wrap{
  610. min-height: 90vh;
  611. background-color: $page-bg-grey;
  612. padding-bottom: 210px ;
  613. }
  614. .section{
  615. background-color: #fff;
  616. margin-bottom: 32px;
  617. }
  618. .edbinfo-box{
  619. padding: var(--van-cell-horizontal-padding);
  620. .info-box{
  621. margin-top: 14px;
  622. border-radius: 8px;
  623. border: 1px solid $border-color;
  624. box-shadow: $box-shadow;
  625. padding: 20px;
  626. .name{
  627. font-size: 32px;
  628. margin: 0 0 10px 0;
  629. }
  630. .info-list{
  631. display: flex;
  632. flex-wrap: wrap;
  633. gap: 10px 0;
  634. color: $font-grey;
  635. margin-bottom: 10px;
  636. .info-item{
  637. width: 100%;
  638. margin-bottom: 10px;
  639. }
  640. }
  641. }
  642. }
  643. .move-type-box{
  644. width: 100%;
  645. display: flex;
  646. align-items: center;
  647. justify-content: flex-end;
  648. gap: 20px;
  649. .input{
  650. box-sizing: border-box;
  651. display: block;
  652. border-radius: 12px;
  653. width: 150px;
  654. height: 72px;
  655. padding: 0 32px;
  656. background-color: #f6f6f6;
  657. }
  658. .btn{
  659. flex-shrink: 0;
  660. display: flex;
  661. align-items: center;
  662. justify-content: center;
  663. width: 130px;
  664. height: 72px;
  665. border-radius: 12px;
  666. background-color: #F2F3FF;
  667. color: $theme-color;
  668. }
  669. .disabled{
  670. background-color: #F6F6F6;
  671. color: #333;
  672. }
  673. }
  674. .formula-intro-btn{
  675. width: 180px;
  676. height: 60px;
  677. display: flex;
  678. align-items: center;
  679. justify-content: center;
  680. gap: 5px;
  681. color: $theme-color;
  682. line-height: 1;
  683. background-color: #fff;
  684. border-radius: 32px;
  685. margin-left: auto;
  686. margin-right: var(--van-cell-horizontal-padding);
  687. .icon{
  688. width: 24px;
  689. height: 24px;
  690. }
  691. }
  692. .opt-btns{
  693. position: fixed;
  694. left: 0;
  695. right: 0;
  696. bottom: 0;
  697. background-color: #fff;
  698. z-index: 99;
  699. padding: 48px;
  700. display: flex;
  701. justify-content: space-between;
  702. .van-button{
  703. width: 48%;
  704. max-width: 300PX;
  705. }
  706. }
  707. @media screen and (min-width:$media-width){
  708. .other-calculate-wrap{
  709. padding-bottom: 105px;
  710. }
  711. .section{
  712. margin-bottom: 16px;
  713. }
  714. .edbinfo-box{
  715. .info-box{
  716. margin-top: 7px;
  717. border-radius: 4px;
  718. padding: 10px;
  719. .name{
  720. font-size: 16px;
  721. margin: 0 0 5px 0;
  722. }
  723. .info-list{
  724. gap: 5px 0;
  725. margin-bottom: 5px;
  726. .info-item{
  727. margin-bottom: 5px;
  728. }
  729. }
  730. }
  731. }
  732. .move-type-box{
  733. gap: 10px;
  734. .input{
  735. border-radius: 6px;
  736. width: 65px;
  737. height: 36px;
  738. padding: 0 16px;
  739. }
  740. .btn{
  741. width: 65px;
  742. height: 36px;
  743. border-radius: 6px;
  744. }
  745. }
  746. .formula-intro-btn{
  747. width: 90px;
  748. height: 30px;
  749. gap: 2px;
  750. border-radius: 16px;
  751. .icon{
  752. width: 12px;
  753. height: 12px;
  754. }
  755. }
  756. .opt-btns{
  757. padding: 24px;
  758. justify-content: center;
  759. gap: 10px;
  760. }
  761. }
  762. </style>