addPredicEdb.vue 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328
  1. <template>
  2. <div class="add-predicedb-page">
  3. <div class="aside-warp" v-show="isAsideShow">
  4. <div class="btn-box">
  5. <el-button type="primary" @click="saveHandle"><!-- 保存 -->{{$t('Dialog.confirm_save_btn')}}</el-button>
  6. <el-button type="primary" plain @click="$router.back()"><!-- 取消 -->{{$t('Dialog.cancel_btn')}}</el-button>
  7. </div>
  8. <div class="con">
  9. <el-form
  10. ref="formRef"
  11. hide-required-asterisk
  12. :model="formData"
  13. :rules="formRules"
  14. >
  15. <el-form-item prop="classify">
  16. <div class="item">
  17. <span class="label">{{$t('PredictEditPage.add_to_classify')}}<!-- 添加到分类 --></span>
  18. <el-cascader
  19. v-model="formData.classify"
  20. :options="classifyArr"
  21. :props="{
  22. label: 'ClassifyName',
  23. value: 'ClassifyId',
  24. children: 'Children',
  25. checkStrictly: true
  26. }"
  27. style="width: 90%"
  28. :placeholder="$t('Edb.InputHolderAll.input_classify')"
  29. />
  30. </div>
  31. </el-form-item>
  32. <el-form-item prop="oldEdb" v-if="!formData.edb_id">
  33. <div class="item">
  34. <span class="label">{{$t('Edb.choose_edb')}}<!-- 选择指标 --></span>
  35. <el-select
  36. v-model="formData.oldEdb"
  37. v-loadMore="searchLoad"
  38. style="width: 100%"
  39. :filterable="!formData.oldEdb"
  40. remote
  41. clearable
  42. :placeholder="$t('Edb.InputHolderAll.input_name_orid')"
  43. :remote-method="searchHandle"
  44. @click.native="inputFocusHandle"
  45. @change="selectEdbHandle"
  46. >
  47. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  48. <el-option
  49. v-for="item in searchOptions"
  50. :key="item.EdbInfoId"
  51. :label="currentLang==='en'?(item.EdbNameEn||item.EdbName):item.EdbName"
  52. :value="item.EdbInfoId"
  53. :disabled="!item.HaveOperaAuth"
  54. >
  55. <edbDetailPopover :info="item">
  56. <div slot="reference">
  57. <img
  58. :src="$icons.lock_ico2"
  59. width="18"
  60. height="18"
  61. style="vertical-align:middle"
  62. v-if="!item.HaveOperaAuth"
  63. />
  64. {{currentLang==='en'?(item.EdbNameEn||item.EdbName):item.EdbName}}
  65. </div>
  66. </edbDetailPopover>
  67. </el-option>
  68. </el-select>
  69. </div>
  70. </el-form-item>
  71. <el-form-item prop="edbName">
  72. <div class="item">
  73. <span class="label">{{$t('PredictEditPage.predict_edb_name')}}<!-- 预测指标名称 --></span>
  74. <el-input
  75. v-model="formData.edbName"
  76. style="width: 100%"
  77. :placeholder="$t('Edb.InputHolderAll.input_name')"
  78. />
  79. </div>
  80. </el-form-item>
  81. <el-form-item prop="dateType">
  82. <div class="item">
  83. <span class="label">{{$t('PredictEditPage.predict_date_type')}}<!-- 预测日期类型 --></span>
  84. <el-select
  85. v-model="formData.dateType"
  86. :placeholder="$t('PredictEditPage.ph_date_type')"
  87. style="width: 100%"
  88. @change="getChartInfo"
  89. >
  90. <el-option :label="$t('PredictEditPage.date_type_trade')" value="交易日"></el-option>
  91. <el-option :label="$t('PredictEditPage.date_type_normal')" value="自然日"></el-option>
  92. </el-select>
  93. </div>
  94. </el-form-item>
  95. <el-form-item v-if="formData.oldEdbName">
  96. <div class="item" style="margin-top: 30px">
  97. <span class="label">{{$t('PredictEdbPage.old_edb_name')}}<!-- 原指标名称 -->:{{ formData.oldEdbName }}</span>
  98. </div>
  99. </el-form-item>
  100. <el-form-item prop="frequency">
  101. <div class="item">
  102. <span class="label">{{$t('Edb.Detail.e_fre')}}<!-- 频度 -->:{{ getFrequencyTrans(formData.frequency||'null') }}</span>
  103. </div>
  104. </el-form-item>
  105. <el-form-item prop="newdata">
  106. <div class="item">
  107. <span class="label">{{$t('Edb.Detail.e_latest_value')}}<!-- 最新值 -->:{{ formData.newdata }}</span>
  108. </div>
  109. </el-form-item>
  110. <el-form-item prop="lasetDate">
  111. <div class="item" style="margin-bottom: 30px">
  112. <span class="label">{{$t('Edb.Detail.e_latest_date')}}<!-- 最新日期 -->:{{ formData.lasetDate }}</span>
  113. </div>
  114. </el-form-item>
  115. </el-form>
  116. <!-- 规则 -->
  117. <el-collapse v-model="activeNames" class="rules-ul">
  118. <el-collapse-item
  119. v-for="(item, index) in rulesArr"
  120. :key="index"
  121. :name="index"
  122. >
  123. <template slot="title">
  124. <span class="text_oneLine"><!-- 时间段 -->{{$t('PredictEditPage.label_time_period')}}{{ index + 1 }}</span>
  125. <i
  126. class="el-icon-delete del-icon"
  127. @click.stop="removeRuleHandle(item, index)"
  128. />
  129. </template>
  130. <div class="wrap">
  131. <div class="item">
  132. <span class="label">{{$t('PredictEdbPage.predict_end_date')}}<!-- 预测截止日期 --></span>
  133. <el-date-picker
  134. v-model="item.endDate"
  135. type="date"
  136. style="width: 100%"
  137. value-format="yyyy-MM-dd"
  138. :placeholder="$t('Edb.InputHolderAll.input_date')"
  139. :picker-options="timePickerOptions"
  140. @change="changeDateHandle($event,index)"
  141. >
  142. <!-- :disabled="index!==0 && !rulesArr[index-1].endDate" -->
  143. </el-date-picker>
  144. </div>
  145. <div class="item">
  146. <span class="label">
  147. <!-- 预测规则 -->{{$t('PredictEdbPage.predict_rule')}}
  148. <el-tooltip effect="dark" placement="right">
  149. <div
  150. slot="content"
  151. v-html="$t('PredictEditPage.rule_tip')"
  152. style="line-height: 20px;max-width:600px;max-height:550px;overflow-y:auto"
  153. ></div>
  154. <i class="el-icon-question" style="color: #666" />
  155. </el-tooltip>
  156. </span>
  157. <el-select
  158. v-model="item.predict_type"
  159. style="width: 100%"
  160. @change="changePredictType($event,item,index)"
  161. >
  162. <el-option
  163. v-for="item in predictTypeSetting"
  164. :key="item.key"
  165. :label="item.label"
  166. :value="item.key"
  167. :disabled="formData.frequency==='年度'&&[5,6,11,12].includes(item.key)"
  168. >
  169. </el-option>
  170. </el-select>
  171. </div>
  172. <div class="item" v-if="![1,9,11,12,14,15].includes(item.predict_type)">
  173. <span class="label">{{labelMap[item.predict_type]}}</span>
  174. <el-input
  175. v-model="item.fixedValue"
  176. style="width: 100%"
  177. :placeholder="$t('Edb.InputHolderAll.input_number')"
  178. type="number"
  179. />
  180. </div>
  181. <!-- 季节性规则 -->
  182. <div v-if="[11,15].includes(item.predict_type)">
  183. <div class="item">
  184. <span class="label"><!-- 选择方式 -->{{$t('PredictEditPage.season_select')}}</span>
  185. <el-select
  186. v-model="item.season_way"
  187. placeholder="请选择方式"
  188. style="width: 100%"
  189. @change="item.n_value = '';item.season_years=[]"
  190. >
  191. <el-option :label="$t('PredictEditPage.season_select_cont')" :value="1"/>
  192. <el-option :label="$t('PredictEditPage.season_select_formula')" :value="2"/>
  193. </el-select>
  194. </div>
  195. <div class="item" v-if="item.season_way===1">
  196. <span class="label"><!-- 年数 -->{{$t('PredictEditPage.label_years')}}</span>
  197. <el-input
  198. v-model="item.n_value"
  199. style="width: 100%"
  200. :placeholder="$t('Edb.InputHolderAll.input_number')"
  201. type="number"
  202. />
  203. </div>
  204. <div class="item" v-else>
  205. <el-date-picker
  206. v-model="select_year"
  207. type="year"
  208. value-format="yyyy"
  209. placeholder="选择年份"
  210. @change="pushYear($event,item)"
  211. />
  212. <div class="season-year-cont" v-if="item.season_years.length">
  213. <el-tag
  214. v-for="year in item.season_years"
  215. :key="year"
  216. style="margin: 5px;"
  217. @close="removeYear(year,item)"
  218. closable
  219. >
  220. {{year}}
  221. </el-tag>
  222. </div>
  223. </div>
  224. <div class="item" v-if="item.predict_type===11">
  225. <el-radio-group v-model="item.season_type">
  226. <el-radio label="公历"><!-- 公历 -->{{$t('PredictEditPage.option_season_calendar1')}}</el-radio>
  227. <el-radio label="农历"><!-- 农历 -->{{$t('PredictEditPage.option_season_calendar2')}}</el-radio>
  228. </el-radio-group>
  229. </div>
  230. </div>
  231. <!-- 移动平均同比 -->
  232. <div v-else-if="item.predict_type===12">
  233. <div class="item">
  234. <span class="label"><!-- 期数 -->{{$t('PredictEditPage.label_periods')}}</span>
  235. <el-input
  236. v-model="item.n_value"
  237. style="width: 100%"
  238. :placeholder="$t('Edb.InputHolderAll.input_number')"
  239. type="number"
  240. />
  241. </div>
  242. <div class="item">
  243. <span class="label"><!-- 同比年份 -->{{$t('PredictEditPage.label_yoy_year')}}</span>
  244. <el-date-picker
  245. v-model="item.move_average_year"
  246. type="year"
  247. value-format="yyyy"
  248. :placeholder="$t('PredictEditPage.ph_yoy_year')"
  249. @change="pushYear($event,item)"
  250. />
  251. </div>
  252. </div>
  253. <!-- 一元线性拟合 -->
  254. <div v-else-if="item.predict_type===14">
  255. <div class="item">
  256. <span class="label">
  257. <!-- 自变量 -->{{$t('PredictEditPage.label_slef_var')}}
  258. <el-radio-group v-model="edbFromType">
  259. <el-radio :label="0" style="margin-right: 15px"><!-- ETA指标 -->{{$t('Edb.eta_name')}}</el-radio>
  260. <el-radio :label="1"><!-- ETA预测指标 -->{{$t('Edb.eta_predictor_name')}}</el-radio>
  261. </el-radio-group>
  262. </span>
  263. <el-select
  264. v-model="item.self_target"
  265. v-loadMore="searchLoad"
  266. ref="searchRef"
  267. :filterable="!item.self_target"
  268. remote
  269. clearable
  270. :placeholder="$t('Edb.InputHolderAll.input_name_orid')"
  271. style="width:88%;margin-top: 10px;display:inline-block"
  272. :remote-method="searchHandle"
  273. @click.native="inputFocusHandle($event,'self_target')"
  274. >
  275. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  276. <el-option
  277. v-for="item in searchOptions"
  278. :key="item.EdbInfoId"
  279. :label="currentLang==='en'?(item.EdbNameEn||item.EdbName):item.EdbName"
  280. :value="item.EdbInfoId"
  281. :disabled="!item.HaveOperaAuth"
  282. >
  283. <div>
  284. <img
  285. :src="$icons.lock_ico2"
  286. width="18"
  287. height="18"
  288. style="vertical-align:middle"
  289. v-if="!item.HaveOperaAuth"
  290. />
  291. {{currentLang==='en'?(item.EdbNameEn||item.EdbName):item.EdbName}}
  292. </div>
  293. </el-option>
  294. </el-select>
  295. <i class="el-icon-tickets" style="color:#409EFF;font-size:18px" @click="toHistoryPage(item.self_target,$route.matched);lookEdbId=item.self_target;" v-if="item.self_target"/>
  296. </div>
  297. <div class="item">
  298. <span class="label">
  299. <!-- 领先天数 -->{{$t('PredictEditPage.label_lead_day')}}
  300. <el-input
  301. v-model="item.fixedValue"
  302. style="width: 80px;margin:0 5px;"
  303. type="number"
  304. :step="1"
  305. @keyup.native="filterCode(item)"
  306. />{{$t('PredictEditPage.lead_day_unit')}}
  307. </span>
  308. </div>
  309. <div class="item">
  310. <span class="label"><!-- 拟合时间段 -->{{$t('PredictEditPage.lead_day_unit')}}</span>
  311. <el-date-picker
  312. v-model="item.fit_date[0]"
  313. range-separator="至"
  314. :placeholder="$t('PredictEditPage.ph_start_time')"
  315. value-format="yyyy-MM-dd"
  316. style="width: 90%;margin-bottom: 10px;"
  317. @change="changeFitDate(item)"
  318. />
  319. <!-- 至 -->{{$t('Common.to')}}
  320. <el-date-picker
  321. v-model="item.fit_date[1]"
  322. :placeholder="$t('PredictEditPage.ph_end_time')"
  323. value-format="yyyy-MM-dd"
  324. style="width: 90%"
  325. @change="changeFitDate(item)"
  326. :picker-options="{
  327. shortcuts: [{
  328. text: $t('PredictEditPage.tonow'),
  329. onClick(picker) {
  330. const date = new Date();
  331. picker.$et('pick',date);
  332. }
  333. }]
  334. }"
  335. />
  336. </div>
  337. </div>
  338. <!-- 年度值倒退 -->
  339. <div v-else-if="item.predict_type===16">
  340. <div class="item">
  341. <span class="label"><!-- 余额分配方式 -->{{$t('PredictEditPage.label_distru_way')}}</span>
  342. <el-select
  343. v-model="item.distribute_type"
  344. placeholder="请选择方式"
  345. style="width: 100%"
  346. @change="item.on_year=''"
  347. >
  348. <el-option :label="$t('PredictEditPage.option_distru_way1')" :value="1"/>
  349. <el-option :label="$t('PredictEditPage.option_distru_way2')" :value="2"/>
  350. </el-select>
  351. </div>
  352. <div class="item" v-if="item.distribute_type===2">
  353. <span class="label"><!-- 同比年份 -->{{$t('PredictEditPage.label_yoy_year')}}</span>
  354. <el-date-picker
  355. v-model="item.on_year"
  356. type="year"
  357. value-format="yyyy"
  358. :placeholder="$t('PredictEditPage.ph_yoy_year')"
  359. />
  360. </div>
  361. </div>
  362. <el-button type="text" v-if="item.predict_type===9" @click="setRingAddHandle(item,index)"><!-- 设置环比增加值 -->{{$t('PredictEditPage.set_mom_btn')}}</el-button>
  363. </div>
  364. </el-collapse-item>
  365. </el-collapse>
  366. <div class="rules-add" @click="addRuleHandle">
  367. <img
  368. src="~@/assets/img/set_m/add_ico.png"
  369. alt=""
  370. style="width: 16px; height: 16px; margin-right: 10px"
  371. />
  372. <span><!-- 添加更多 -->{{$t('PredictEditPage.add_more_btn')}}</span>
  373. </div>
  374. </div>
  375. </div>
  376. <div class="main-wrap" id="right">
  377. <div class="con-box" v-show="edbData.DataList">
  378. <div class="top-title">{{ formData.edbName }}</div>
  379. <div class="chart-wrap">
  380. <chartInfo
  381. :edbData="edbData"
  382. :isAllowEditLimit="true"
  383. @refreshData="refreshData"
  384. ref="chartInfo"
  385. />
  386. </div>
  387. </div>
  388. <div class="empty-box" v-show="!edbData.DataList">
  389. <tableNoData :text="$t('Common.no_info_msg')"/>
  390. </div>
  391. </div>
  392. <span
  393. class="slide-icon slide-btn-icon"
  394. :class="{'slide-left':isAsideShow,'slide-right':!isAsideShow}"
  395. @click="isAsideShow = !isAsideShow"
  396. >
  397. <i :class="{'el-icon-d-arrow-left':isAsideShow,'el-icon-d-arrow-right':!isAsideShow}"></i>
  398. </span>
  399. <!-- 设置动态环差弹窗 -->
  400. <dynamic-differ
  401. :isOpenDialog.sync="isOpenDialog"
  402. :edbList="dynamicDifferList"
  403. :info="dynamicDifferInfo"
  404. @ensureBack="saveDynamicDifferRule"
  405. @lookHistory="id => {toHistoryPage(id,$route.matched);lookEdbId=id;}"
  406. />
  407. <!-- 指标历史记录 -->
  408. <!-- <edbHistoryDialog
  409. :isOpenDialog.sync="isLookHistory"
  410. :edbId="lookEdbId"
  411. /> -->
  412. </div>
  413. </template>
  414. <script>
  415. import * as preDictEdbInterface from "@/api/modules/predictEdbApi.js";
  416. import { dataBaseInterface } from "@/api/api.js";
  417. import chartInfo from "./components/chartInfo.vue";
  418. import dynamicDiffer from './components/dynamicRingdiffer.vue';
  419. export default {
  420. components: { chartInfo,dynamicDiffer },
  421. computed: {
  422. // 图需要更新的依赖项
  423. showChart() {
  424. return {
  425. oldEdb: this.formData.oldEdb,
  426. };
  427. },
  428. timePickerOptions() {
  429. let that=this
  430. let obj={
  431. disabledDate(time) {
  432. if(that.formData.lasetDate){
  433. return time.getTime() < new Date(that.formData.lasetDate).getTime()
  434. }else{
  435. return time.getTime() < Date.now()
  436. }
  437. }
  438. }
  439. return obj
  440. },
  441. predictTypeSetting(){
  442. return [
  443. { key: 1, label: /* "最新" */this.$t('PredictEditPage.rule_newset') },
  444. { key: 2, label: /* "固定值" */this.$t('PredictEditPage.rule_fix') },
  445. { key: 3, label: /* "同比" */this.$t('PredictEditPage.rule_onyear') },
  446. { key: 4, label: /* "同差" */this.$t('PredictEditPage.rule_differ') },
  447. { key: 5, label: /* "环比" */this.$t('PredictEditPage.rule_mom') },
  448. { key: 6, label: /* "环差" */this.$t('PredictEditPage.rule_mom_differ') },
  449. { key: 7, label: /* "N期移动均值" */this.$t('PredictEditPage.rule_move_average') },
  450. { key: 8, label: /* "N期段线性外推值" */this.$t('PredictEditPage.rule_linear') },
  451. { key: 9, label: /* '动态环差' */this.$t('PredictEditPage.rule_dynamic_differ') },
  452. { key: 10, label: /* "给定终值后插值" */this.$t('PredictEditPage.rule_inter_end') },
  453. { key: 11, label: /* "季节性" */this.$t('PredictEditPage.rule_season') },
  454. { key: 12, label: /* "移动平均同比" */this.$t('PredictEditPage.rule_yoy_move') },
  455. { key: 13, label: /* "同比增速插值" */this.$t('PredictEditPage.rule_yoy_growth') },
  456. { key: 14, label: /* "一元线性拟合" */this.$t('PredictEditPage.rule_linear_reg') },
  457. { key: 15, label: /* "N年均值" */this.$t('PredictEditPage.rule_n_year') },
  458. { key: 16, label: /* "年度值倒推" */this.$t('PredictEditPage.rule_value_back') },
  459. ]
  460. },
  461. labelMap(){
  462. return {
  463. 2: /* '固定值' */this.$t('PredictEditPage.rule_fix'),
  464. 3: /* '同比增速' */this.$t('PredictEditPage.label_value_yoy_growth'),
  465. 4: /* '同比增加值' */this.$t('PredictEditPage.label_value_yoy_add'),
  466. 5: /* '环比增速' */this.$t('PredictEditPage.label_value_mom_growth'),
  467. 6: /* '环比增加值' */this.$t('PredictEditPage.label_value_mom_add'),
  468. 7: /* '期数' */this.$t('PredictEditPage.label_periods'),
  469. 8: /* '期数' */this.$t('PredictEditPage.label_periods'),
  470. 10: /* '预测终值' */this.$t('PredictEditPage.label_periods'),
  471. 11: /* '期数' */this.$t('PredictEditPage.label_periods'),
  472. 12: /* '期数' */this.$t('PredictEditPage.label_periods'),
  473. 13: /* '同比增速终值' */this.$t('PredictEditPage.label_value_yoy_end'),
  474. 16: /* '年度值' */this.$t('PredictEditPage.label_value_year')
  475. }
  476. },
  477. currentLang() {
  478. return this.$store.state.lang
  479. }
  480. },
  481. watch: {
  482. showChart(n, o) {
  483. if (n.oldEdb) {
  484. console.log("更新");
  485. if (n.oldEdb != o.oldEdb) {
  486. this.$refs.chartInfo.chartInfo.ChartType = 1;
  487. }
  488. //this.getChartInfo();
  489. }
  490. },
  491. rulesArr: {
  492. handler(newval) {
  493. this.isNeedWatch && this.formData.oldEdb && this.getChartInfo();
  494. },
  495. deep: true
  496. }
  497. },
  498. data() {
  499. return {
  500. formData: {
  501. edb_id: "",
  502. classify: "",
  503. oldEdb: "",
  504. edbName: "",
  505. frequency: "",
  506. newdata: "",
  507. lasetDate: "",
  508. dateType: '交易日',
  509. },
  510. formRules: {
  511. classify: [
  512. { required: true, message: /* "分类不能为空" */this.$t('Edb.Valids.classify_msg'), trigger: "blur" },
  513. ],
  514. oldEdb: [{ required: true, message: /* "指标不能为空" */this.$t('Edb.Valids.no_edb'), trigger: "blur" }],
  515. edbName: [
  516. { required: true, message: /* "指标名称不能为空" */this.$t('Edb.Valids.name_msg'), trigger: "blur" },
  517. ],
  518. },
  519. classifyArr: [],
  520. /* predictTypeOptions:[], */
  521. /* rulesTip: this.$t('PredictEditPage.rule_tip'), */
  522. rulesArr: [{
  523. endDate: "",
  524. predict_type: 1,
  525. fixedValue: "",
  526. edbarr:[],
  527. season_way: 1,
  528. season_years: [],
  529. season_type: '公历',
  530. n_value:'',
  531. move_average_year: '',
  532. self_target: '',
  533. fit_date:['',this.$moment().format('YYYY-MM-DD')],
  534. distribute_type: 1,
  535. on_year: ''
  536. }],
  537. activeNames: [0],
  538. searchOptions: [],
  539. search_page: 1,
  540. search_have_more: false,
  541. current_search: "",
  542. edbData: {
  543. DataList: null,
  544. EdbInfo: {},
  545. },
  546. DateType: 10, //年份选择项 默认全部
  547. isNeedWatch: true,
  548. /* 动态环差弹窗 */
  549. isOpenDialog: false,
  550. dynamicDifferList: [],//依赖指标
  551. dynamicDifferInfo: '',
  552. click_rule_index: -1,
  553. select_year: '',
  554. edbFromType: 0,//标准指标
  555. /* 查看历史弹窗 */
  556. isLookHistory: false,
  557. lookEdbId: 0,
  558. isAsideShow:true,
  559. };
  560. },
  561. created() {
  562. if (this.$route.path == "/editpredictEdb") {
  563. this.formData.edb_id = Number(this.$route.query.id);
  564. this.getEditInitData();
  565. }
  566. this.getClassifyOne();
  567. this.setRulesArr()
  568. },
  569. methods: {
  570. // 获取详情
  571. getEditInitData() {
  572. this.isNeedWatch = false; //控制编辑进来调用多次watch
  573. preDictEdbInterface
  574. .edbDetail({
  575. EdbInfoId: this.formData.edb_id,
  576. })
  577. .then((res) => {
  578. if (res.Ret !== 200) return;
  579. const {
  580. ClassifyId,
  581. ClassifyList,
  582. EdbName,
  583. EdbNameEn,
  584. Frequency,
  585. LatestValue,
  586. RuleList,
  587. EdbInfoId,
  588. LatestDate,
  589. DataDateType
  590. } = res.Data;
  591. const classifyArr = ClassifyList.length&&ClassifyList.map(item=>item.ClassifyId).reverse()
  592. this.formData = {
  593. edb_id: EdbInfoId,
  594. classify: classifyArr||[],
  595. oldEdb: res.Data.CalculateList[0].FromEdbInfoId,
  596. oldEdbName: res.Data.CalculateList[0].FromEdbName,
  597. edbName: this.currentLang==='en'?EdbNameEn:EdbName,
  598. frequency: Frequency,
  599. newdata: res.Data.CalculateList[0].EndValue,
  600. lasetDate: res.Data.CalculateList[0].EndDate,
  601. dateType: DataDateType
  602. };
  603. this.rulesArr = RuleList.map(_ => ({
  604. endDate: this.$moment(_.EndDate).format('YYYY-MM-DD'),
  605. predict_type: _.RuleType,
  606. fixedValue: _.RuleType === 14
  607. ? JSON.parse(_.Value).MoveDay
  608. : _.RuleType === 16
  609. ? JSON.parse(_.Value).Value
  610. : _.Value,
  611. edbarr: _.RuleType === 9
  612. ? _.CalculateList.map(item => ({ target:item.FromEdbInfoId,tag:item.FromTag,name:item.FromEdbName,start_date: item.StartDate,end_date:item.EndDate }))
  613. : [],
  614. season_way:[11,15].includes(_.RuleType) ? JSON.parse(_.Value).YearType : '',
  615. season_years: [11,15].includes(_.RuleType) ? JSON.parse(_.Value).YearList.map(_ =>_.toString()) : [],
  616. season_type: _.RuleType === 11 ? JSON.parse(_.Value).Calendar : '',
  617. n_value: [11,12,15].includes(_.RuleType) ? JSON.parse(_.Value).NValue : '',
  618. move_average_year: _.RuleType === 12 ? JSON.parse(_.Value).Year.toString() : '',
  619. self_target: _.RuleType === 14 ? JSON.parse(_.Value).EdbInfoId : '',
  620. fit_date: _.RuleType === 14 ? [JSON.parse(_.Value).StartDate,JSON.parse(_.Value).EndDate] : [],
  621. distribute_type: _.RuleType === 16?JSON.parse(_.Value).Type:1,
  622. on_year: _.RuleType === 16?JSON.parse(_.Value).Year.toString():'',
  623. nullValueWay: _.EmptyType,
  624. maxNullWay: _.MaxEmptyType
  625. }))
  626. this.searchOptions = RuleList.map(item => ({
  627. EdbInfoId: item.CalculateList[0] ? item.CalculateList[0].FromEdbInfoId : '',
  628. EdbName: item.CalculateList[0] ? item.CalculateList[0].FromEdbName : ''
  629. }));
  630. this.edbData.EdbInfo = {
  631. ...res.Data,
  632. ChartColor: "",
  633. ChartStyle: "",
  634. ChartType: 0,
  635. ChartWidth: 0,
  636. MaxData: res.Data.MaxValue,
  637. MinData: res.Data.MinValue,
  638. EdbInfoCategoryType: 1,
  639. EdbInfoType: 1,
  640. EdbName: this.formData.edbName,
  641. IsAxis: 1,
  642. };
  643. });
  644. },
  645. // 递归改变目录结构
  646. filterNodes(arr) {
  647. arr.length &&
  648. arr.forEach((item) => {
  649. item.Children.length && this.filterNodes(item.Children);
  650. if (!item.Children.length) {
  651. delete item.Children;
  652. }
  653. });
  654. },
  655. getClassifyOne() {
  656. preDictEdbInterface.classifyListV2().then((res) => {
  657. if (res.Ret !== 200) return;
  658. this.filterNodes(res.Data.AllNodes || [])
  659. this.classifyArr = res.Data.AllNodes || [];
  660. // if (this.$route.path == "/editpredictEdb") {
  661. // //将formData.classify转为数组的格式
  662. // this.formData.classify = this.findParentNodeHandle(this.classifyArr,this.formData.classify).reverse()
  663. // }
  664. });
  665. },
  666. findParentNodeHandle(arr, id) {
  667. // 遍历取父级code push数组
  668. for (let i of arr) {
  669. if (i.ClassifyId === id) {
  670. return [i.ClassifyId];
  671. }
  672. if (i.Children) {
  673. let node = this.findParentNodeHandle(i.Children, id);
  674. if (node) {
  675. return node.concat(i.ClassifyId);
  676. }
  677. }
  678. }
  679. },
  680. searchLoad() {
  681. if (!this.search_have_more) return;
  682. this.searchApi(this.current_search, ++this.search_page);
  683. },
  684. async searchApi(query, page = 1) {
  685. let params = {
  686. KeyWord: query,
  687. CurrentIndex: page,
  688. }
  689. const res = (this.edbFromType === 1 && this.current_type==='self_target')
  690. ? await preDictEdbInterface.edbSearch(params)
  691. : await dataBaseInterface.targetSearchByPage(params)
  692. if (res.Ret !== 200) return;
  693. const { List, Paging } = res.Data;
  694. this.search_have_more = page < Paging.Pages;
  695. this.searchOptions = page === 1 ? List : this.searchOptions.concat(List);
  696. },
  697. /* 聚焦获取当前检索 */
  698. inputFocusHandle(e,type='') {
  699. this.search_page = 1;
  700. this.current_search = e.target.value;
  701. this.current_type = type;
  702. this.searchApi(this.current_search);
  703. },
  704. /* 选择指标 同步名称频度最新值*/
  705. async selectEdbHandle(val) {
  706. if (val) {
  707. const { Data } = await dataBaseInterface.targetDetail({
  708. EdbInfoId: val,
  709. });
  710. this.formData.edbName = `${this.currentLang==='en'?Data.EdbNameEn:Data.EdbName}(预测)`;
  711. this.formData.frequency = Data.Frequency;
  712. this.formData.newdata = Data.LatestValue;
  713. this.formData.lasetDate = Data.LatestDate;
  714. this.edbData.EdbInfo = {
  715. ...Data,
  716. ChartColor: "",
  717. ChartStyle: "",
  718. ChartType: 0,
  719. ChartWidth: 0,
  720. // MaxData: Data.MaxValue,
  721. // MinData: Data.MinValue,
  722. EdbInfoCategoryType: 1,
  723. EdbInfoType: 1,
  724. EdbName: this.formData.edbName,
  725. IsAxis: 1
  726. };
  727. this.setRulesArr()
  728. this.getChartInfo()
  729. } else {
  730. this.formData.edbName = "";
  731. this.formData.frequency = "";
  732. this.formData.newdata = "";
  733. this.formData.lasetDate = "";
  734. }
  735. },
  736. /* 搜索 */
  737. searchHandle(query) {
  738. this.search_page = 1;
  739. this.current_search = query;
  740. this.searchApi(this.current_search);
  741. },
  742. // 获取图表数据
  743. async getChartInfo() {
  744. console.log(this.rulesArr)
  745. let rules_params = this.rulesArr.filter(_ => (
  746. (_.predict_type === 1 && _.endDate)
  747. || [11,12,15].includes(_.predict_type) && _.endDate && (_.n_value||_.season_years.length)
  748. || (_.predict_type===14 &&_.endDate && _.fit_date[0] && _.fit_date[1] && _.self_target)
  749. || ![1,11,12,14,15].includes(_.predict_type) && _.endDate && _.fixedValue
  750. )).map(_ =>{
  751. let dynamic_params = {};
  752. switch(_.predict_type) {
  753. case 11:
  754. case 15:
  755. dynamic_params = {
  756. Calendar: _.season_type,
  757. YearType: _.season_way,
  758. NValue: Number(_.n_value),
  759. YearList: _.season_years.map(_ =>Number(_)),
  760. }
  761. break
  762. case 12:
  763. dynamic_params = {
  764. Year: Number(_.move_average_year),
  765. NValue: Number(_.n_value)
  766. }
  767. break
  768. case 14:
  769. dynamic_params = {
  770. StartDate: _.fit_date[0],
  771. EndDate: _.fit_date[1],
  772. MoveDay: Number(_.fixedValue),
  773. EdbInfoId: _.self_target
  774. }
  775. break
  776. case 16:
  777. dynamic_params = {
  778. Type: _.distribute_type,
  779. Value: Number(_.fixedValue),
  780. Year: Number(_.on_year)
  781. }
  782. break
  783. }
  784. return {
  785. RuleType: _.predict_type,
  786. EndDate: _.endDate,
  787. Value: [11,12,14,15,16].includes(_.predict_type) ? JSON.stringify(dynamic_params) : _.fixedValue,
  788. EdbInfoIdArr: _.predict_type === 9
  789. ? _.edbarr.map(item => ({ EdbInfoId:item.target,FromTag:item.tag }))
  790. : _.predict_type === 14
  791. ? [{EdbInfoId: _.self_target,FromTag: ''}]
  792. :[],
  793. EmptyType: _.predict_type===9 ? _.nullValueWay : 0,
  794. MaxEmptyType: _.predict_type===9 ? _.maxNullWay : 0
  795. }
  796. })
  797. let dateArray=[]
  798. let DateType,StartYear;
  799. if(this.$refs.chartInfo.chartInfo.ChartType==2){
  800. DateType=this.$refs.chartInfo.year_select_season
  801. StartYear=this.$refs.chartInfo.count_year_season
  802. if(!(this.$refs.chartInfo.season_year && this.$refs.chartInfo.season_year.length>0)){
  803. // 初始化日期显示
  804. let latestYear = parseInt(this.$refs.chartInfo.tableData[0].LatestDate.substring(0,4))
  805. this.$refs.chartInfo.season_year = [`${latestYear-StartYear+1}-01-01`,`${latestYear}-12-31`];
  806. }
  807. dateArray = this.$refs.chartInfo.season_year
  808. }else{
  809. DateType=this.$refs.chartInfo.year_select
  810. StartYear=this.$refs.chartInfo.count_year
  811. dateArray = this.$refs.chartInfo.select_date
  812. }
  813. let params = {
  814. SourceEdbInfoId: this.formData.oldEdb,
  815. DateType,
  816. StartDate: dateArray[0] || "",
  817. EndDate: dateArray[1] || "",
  818. Calendar: this.$refs.chartInfo.calendar_type,
  819. ChartType: this.$refs.chartInfo.chartInfo.ChartType,
  820. // ETA1.0.5 去除了这两个参数
  821. // SeasonStartDate: this.$refs.chartInfo.season_year[0] || "",
  822. // SeasonEndDate: this.$refs.chartInfo.season_year[1] || "",
  823. DataDateType: this.formData.dateType,
  824. StartYear:StartYear || 0
  825. }
  826. const res = await preDictEdbInterface.edbChartDataForAdd(rules_params.length ? {...params,RuleList: rules_params} : params);
  827. if (res.Ret != 200) return;
  828. this.edbData.DataList = res.Data.DataList;
  829. this.edbData.EdbInfo.MaxData = this.edbData.EdbInfo.MaxData || res.Data.MaxValue;
  830. this.edbData.EdbInfo.MinData = this.edbData.EdbInfo.MinData || res.Data.MinValue;
  831. this.isNeedWatch = true; //控制编辑进来调用多次watch
  832. },
  833. /* 保存 */
  834. async saveHandle() {
  835. await this.$refs.formRef.validate();
  836. // 规则填写是否完整
  837. let isRulesComplete = this.rulesArr.every(item => {
  838. return item.predict_type === 1 && item.endDate
  839. || [11,12,15].includes(item.predict_type) && item.endDate && (item.n_value||item.season_years.length)
  840. || (item.predict_type===14 && item.endDate && item.fit_date[0] && item.fit_date[1] && item.self_target)
  841. || ![1,11,12,14,15].includes(item.predict_type) && item.endDate && item.fixedValue
  842. })
  843. if(!isRulesComplete) return this.$message.warning(/* '请填写完整的规则' */this.$t('PredictEditPage.vaild_full_rule'))
  844. const { edb_id,classify,oldEdb,edbName,dateType } = this.formData;
  845. //规则参数
  846. let RuleList = this.rulesArr.map(_ => {
  847. let dynamic_params = {};
  848. switch(_.predict_type) {
  849. case 11:
  850. case 15:
  851. dynamic_params = {
  852. Calendar: _.season_type,
  853. YearType: _.season_way,
  854. NValue: Number(_.n_value),
  855. YearList: _.season_years.map(_ =>Number(_)),
  856. }
  857. break
  858. case 12:
  859. dynamic_params = {
  860. Year: Number(_.move_average_year),
  861. NValue: Number(_.n_value)
  862. }
  863. break
  864. case 14:
  865. dynamic_params = {
  866. StartDate: _.fit_date[0],
  867. EndDate: _.fit_date[1],
  868. MoveDay: Number(_.fixedValue),
  869. EdbInfoId: _.self_target
  870. }
  871. break
  872. case 16:
  873. dynamic_params = {
  874. Type: _.distribute_type,
  875. Value: Number(_.fixedValue),
  876. Year: Number(_.on_year)
  877. }
  878. break
  879. }
  880. return {
  881. RuleType: _.predict_type,
  882. EndDate: _.endDate,
  883. Value: [11,12,14,15,16].includes(_.predict_type) ? JSON.stringify(dynamic_params) : _.fixedValue,
  884. EdbInfoIdArr: _.predict_type === 9
  885. ? _.edbarr.map(item => ({ EdbInfoId:item.target,FromTag:item.tag }))
  886. : _.predict_type === 14
  887. ? [{EdbInfoId: _.self_target,FromTag: ''}]
  888. :[],
  889. EmptyType: _.predict_type===9 ? _.nullValueWay : 0,
  890. MaxEmptyType: _.predict_type===9 ? _.maxNullWay : 0
  891. }
  892. })
  893. let params = {
  894. ClassifyId: classify[classify.length-1],
  895. EdbName: edbName,
  896. MaxValue: Number(this.$refs.chartInfo.tableData[0].MaxData),
  897. MinValue: Number(this.$refs.chartInfo.tableData[0].MinData),
  898. DataDateType: dateType,
  899. RuleList
  900. };
  901. const { Ret, Data } = edb_id
  902. ? await preDictEdbInterface.edbEdit({ ...params, EdbInfoId: edb_id })
  903. : await preDictEdbInterface.edbAdd({
  904. ...params,
  905. SourceEdbInfoId: oldEdb,
  906. });
  907. if (Ret !== 200) return;
  908. // this.$message.success("保存成功");
  909. this.$message.success(this.$t('MsgPrompt.saved_msg'));
  910. //编辑的话更新图
  911. edb_id && this.$nextTick(() => {
  912. this.setChartImage();
  913. });
  914. if (!edb_id) {
  915. const obj = {
  916. code: Data.UniqueCode,
  917. id: Data.EdbInfoId,
  918. };
  919. sessionStorage.setItem("predictEdbTreeData", JSON.stringify(obj));
  920. }
  921. setTimeout(() => {
  922. this.$router.back();
  923. }, 1500);
  924. },
  925. /* 关联图片 */
  926. setChartImage() {
  927. let svg = this.$refs.chartInfo.$refs.chartRef.chart.getSVG({
  928. chart: {
  929. width: 340,
  930. height: 230,
  931. },
  932. });
  933. let form = new FormData();
  934. form.append("Img", svg);
  935. this.setImageHandle(form);
  936. },
  937. async setImageHandle(form) {
  938. // let { Data } = await dataBaseInterface.uploadImgSvg(form);
  939. // await preDictEdbInterface.setImg({
  940. // EdbInfoId: this.formData.edb_id,
  941. // ImageUrl: Data.ResourceUrl,
  942. // });
  943. form.append("EdbInfoId", this.formData.edb_id);
  944. await preDictEdbInterface.setThumbnail(form)
  945. },
  946. refreshData() {
  947. this.getChartInfo();
  948. },
  949. /* 添加新规则 */
  950. addRuleHandle() {
  951. const newItem = {
  952. endDate: "",
  953. predict_type: 1,
  954. fixedValue: "",
  955. edbarr: [],
  956. season_way: 1,
  957. season_years: [],
  958. season_type: '公历',
  959. n_value: '',
  960. move_average_year: '',
  961. self_target: '',
  962. fit_date:['',this.$moment().format('YYYY-MM-DD')],
  963. distribute_type: 1
  964. };
  965. this.rulesArr.push(newItem);
  966. },
  967. /* 切换预测规则 重置value */
  968. initRule(e,item) {
  969. item.fixedValue = '';
  970. item.edbarr=[];
  971. item.season_way=1;
  972. item.season_years=[];
  973. item.season_type='公历';
  974. item.n_value='';
  975. item.move_average_year='';
  976. item.self_target = '';
  977. item.fit_date = ['',this.$moment().format('YYYY-MM-DD')];
  978. item.distribute_type=1;
  979. },
  980. /* 设置预测规则数组 */
  981. setRulesArr(){
  982. const {frequency} = this.formData
  983. let filterKey=[]
  984. //如果是年度,则不显示环比、环差、动态环差、季节性、移动平均同比的选项
  985. if(frequency==='年度'){
  986. filterKey = [5,6,11,12]
  987. }
  988. //this.predictTypeOptions = this.predictTypeSetting.filter(item=>{return !filterKey.includes(item.key)})
  989. /* this.predictTypeOptions = this.predictTypeSetting */
  990. //年度指标时,将不支持的规则类型重置
  991. this.isNeedWatch = false
  992. this.rulesArr.forEach(item=>{
  993. if(filterKey.length&&filterKey.includes(item.predict_type)){
  994. this.initRule(_,item)
  995. item.predict_type = 1
  996. }
  997. })
  998. this.$nextTick(()=>{
  999. this.isNeedWatch=true
  1000. })
  1001. },
  1002. /* 删除规则 */
  1003. removeRuleHandle(item, index) {
  1004. if(this.rulesArr.length===1) return this.$message.warning(/* '请至少保留一条预测规则' */this.$t('PredictEditPage.vaild_last_rule'));
  1005. this.rulesArr.splice(index, 1);
  1006. // this.$message.success("删除成功");
  1007. this.$message.success(this.$t('MsgPrompt.delete_msg'));
  1008. },
  1009. /* 选择日期时提示不能小于上个日期 */
  1010. changeDateHandle(value,index) {
  1011. console.log(value,index)
  1012. let isDateRepeat = this.rulesArr.some((_,_index) => _index!==index&&this.$moment(_.endDate).valueOf()===this.$moment(value).valueOf())
  1013. if(isDateRepeat) {
  1014. this.rulesArr[index].endDate = '';
  1015. return this.$message.warning('所选日期不能和其他规则重复')
  1016. }
  1017. // if(index > 0) {
  1018. // let prev_date = this.rulesArr[index-1].endDate;
  1019. // if(this.$moment(prev_date).valueOf() >= this.$moment(value).valueOf()){
  1020. // this.$message.warning('所选日期不能小于上个规则的日期')
  1021. // this.rulesArr[index].endDate = '';
  1022. // }
  1023. // }
  1024. this.rulesArr[index].predict_type===16 && this.rulesArr[index].endDate && this.checkReverseYearDate(index)
  1025. },
  1026. // n年倒推 校验日期时同一年份
  1027. checkReverseYearDate(index) {
  1028. let selectDateYear = new Date(this.rulesArr[index].endDate).getFullYear();
  1029. let prevRuleDateYear = '';
  1030. if(this.rulesArr.length === 1) {
  1031. prevRuleDateYear = new Date(this.formData.lasetDate).getFullYear();
  1032. } else {
  1033. let sortRuleArr = [...this.rulesArr].sort((x,y) => new Date(x.endDate)-new Date(y.endDate));
  1034. let newIndex = sortRuleArr.findIndex(_ => _.endDate===this.rulesArr[index].endDate);
  1035. prevRuleDateYear = newIndex === 0 ? new Date(this.formData.lasetDate).getFullYear() : new Date(sortRuleArr[newIndex-1].endDate).getFullYear()
  1036. }
  1037. if(selectDateYear !== prevRuleDateYear) {
  1038. this.rulesArr[index].endDate = ''
  1039. return this.$message.warning('年度值倒推不支持跨年预测')
  1040. }
  1041. },
  1042. changePredictType(e,item,index) {
  1043. e===16&&item.endDate&&this.checkReverseYearDate(index);
  1044. this.initRule(e,item)
  1045. },
  1046. /* 拟合选择日期 */
  1047. changeFitDate(item) {
  1048. if(item.fit_date[0] && item.fit_date[1]) {
  1049. let differ = this.$moment(item.fit_date[1]).diff(
  1050. this.$moment(item.fit_date[0]),
  1051. 'days',
  1052. true
  1053. )
  1054. if(differ < 2) {
  1055. item.fit_date = [];
  1056. this.$message.warning(`${differ<0?'开始日期不能晚于结束日期':'日期间隔不得少于两天'}`)
  1057. }
  1058. }
  1059. },
  1060. /* 设置环比增加值 */
  1061. setRingAddHandle({edbarr,fixedValue,nullValueWay,maxNullWay},index) {
  1062. this.click_rule_index = index;
  1063. this.dynamicDifferList = edbarr;
  1064. this.dynamicDifferInfo = {
  1065. formulaList: fixedValue,
  1066. nullValueWay,
  1067. maxNullWay
  1068. };
  1069. this.isOpenDialog = true;
  1070. },
  1071. /* 规则动态环差信息 */
  1072. saveDynamicDifferRule({arr,formula,nullValueWay,maxNullWay}) {
  1073. this.rulesArr[this.click_rule_index].edbarr = arr;
  1074. this.rulesArr[this.click_rule_index].fixedValue = formula;
  1075. this.rulesArr[this.click_rule_index].nullValueWay = nullValueWay;
  1076. this.rulesArr[this.click_rule_index].maxNullWay = maxNullWay;
  1077. console.log(this.rulesArr)
  1078. },
  1079. /* 追加年份 */
  1080. pushYear(e,item) {
  1081. this.select_year = '';
  1082. if(item.season_years.includes(e)) return this.$message.warning('年份已存在')
  1083. item.season_years.push(e)
  1084. },
  1085. /* 删除年份 */
  1086. removeYear(year,item) {
  1087. item.season_years.splice(item.season_years.findIndex(_ => _===year),1)
  1088. },
  1089. /*小数点*/
  1090. filterCode(item) {
  1091. item.fixedValue=item.fixedValue.replace('.','');
  1092. },
  1093. },
  1094. };
  1095. </script>
  1096. <style lang="scss">
  1097. .add-predicedb-page {
  1098. overflow-y: auto;
  1099. .aside-warp {
  1100. /* .el-form-item {
  1101. margin-bottom: 0;
  1102. } */
  1103. .el-form-item__content {
  1104. line-height: 1;
  1105. }
  1106. }
  1107. .el-collapse-item__header {
  1108. background-color: #F0F2F5;
  1109. margin-bottom: 0;
  1110. border-bottom: 1px solid #dcdfe6;
  1111. padding: 0 30px;
  1112. .el-collapse-item__arrow {
  1113. position: absolute;
  1114. left: 8px;
  1115. }
  1116. }
  1117. .el-collapse-item__content {
  1118. padding-bottom: 10px;
  1119. }
  1120. .el-collapse-item.is-disabled .el-collapse-item__header {
  1121. color: #333;
  1122. }
  1123. }
  1124. </style>
  1125. <style lang="scss" scoped>
  1126. div {
  1127. box-sizing: border-box;
  1128. }
  1129. .add-predicedb-page {
  1130. display: flex;
  1131. min-height: calc(100vh - 150px);
  1132. position: relative;
  1133. .aside-warp {
  1134. flex-shrink: 0;
  1135. width: 300px;
  1136. background: #ffffff;
  1137. border-radius: 4px;
  1138. border: 1px solid #ececec;
  1139. margin-right: 20px;
  1140. .btn-box {
  1141. height: 80px;
  1142. background: #ffffff;
  1143. box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.06);
  1144. border-radius: 4px 4px 0px 0px;
  1145. opacity: 1;
  1146. border-bottom: 1px solid #ececec;
  1147. padding-top: 20px;
  1148. padding-left: 15px;
  1149. }
  1150. .con {
  1151. padding: 20px;
  1152. max-height: calc(100vh - 200px);
  1153. overflow-y: auto;
  1154. .item {
  1155. margin-bottom: 20px;
  1156. font-size: 14px;
  1157. .label {
  1158. margin-bottom: 10px;
  1159. display: block;
  1160. }
  1161. .season-year-cont {
  1162. padding: 10px;
  1163. margin-top: 15px;
  1164. border: 1px dashed #AAB4CC;
  1165. }
  1166. }
  1167. .tip-wrap {
  1168. color: #999;
  1169. margin-top: 30px;
  1170. }
  1171. }
  1172. }
  1173. .main-wrap {
  1174. flex: 1;
  1175. background: #ffffff;
  1176. border-radius: 4px;
  1177. border: 1px solid #ececec;
  1178. overflow-x: auto;
  1179. }
  1180. .slide-icon{
  1181. position: absolute;
  1182. &.slide-left {
  1183. left: 290px;
  1184. }
  1185. &.slide-right {
  1186. left: 0px;
  1187. }
  1188. }
  1189. .rules-ul {
  1190. border: 1px solid #dcdfe6;
  1191. .del-icon {
  1192. position: absolute;
  1193. right: 10px;
  1194. font-size: 16px;
  1195. color: #f00;
  1196. cursor: pointer;
  1197. }
  1198. .wrap {
  1199. padding: 20px 20px 0;
  1200. li {
  1201. padding-bottom: 20px;
  1202. margin-bottom: 20px;
  1203. border-bottom: 1px solid #dcdfe6;
  1204. &:last-child {
  1205. padding-bottom: 0;
  1206. margin-bottom: 0;
  1207. border-bottom: none;
  1208. }
  1209. }
  1210. }
  1211. }
  1212. .rules-add {
  1213. margin-top: 10px;
  1214. display: flex;
  1215. align-items: center;
  1216. color: #409eff;
  1217. color: pointer;
  1218. }
  1219. }
  1220. .main-wrap {
  1221. .empty-box {
  1222. padding-top: 200px;
  1223. color: #aab4cc;
  1224. text-align: center;
  1225. img {
  1226. width: 150px;
  1227. }
  1228. }
  1229. .con-box {
  1230. .top-title {
  1231. height: 80px;
  1232. background: #ffffff;
  1233. box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.06);
  1234. border-radius: 4px 4px 0px 0px;
  1235. border-bottom: 1px solid #ececec;
  1236. font-size: 18px;
  1237. display: flex;
  1238. padding-left: 30px;
  1239. align-items: center;
  1240. }
  1241. .chart-wrap{
  1242. box-sizing: border-box;
  1243. padding:30px;
  1244. }
  1245. }
  1246. }
  1247. </style>