operationDialog.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  1. <template>
  2. <el-dialog
  3. :visible.sync="isOperation"
  4. :close-on-click-modal="false"
  5. :modal-append-to-body="false"
  6. @close="cancelHandle"
  7. custom-class="operation-dialog"
  8. center
  9. width="1200px"
  10. top="5vh"
  11. v-dialogDrag
  12. >
  13. <div slot="title" style="display: flex; align-items: center">
  14. <img
  15. :src="$icons.computed"
  16. style="color: #fff; width: 16px; height: 16px; margin-right: 5px"
  17. />
  18. <span style="font-size: 16px">{{ (operationForm.edb_id ? (operationForm.view ? $t('Dialog.title_prefix_view') : $t('Dialog.title_prefix_edit')) : '') + titleMap.get(type) }}</span>
  19. </div>
  20. <div class="dialog-main">
  21. <!-- 多选source -->
  22. <ul class="label-cont" v-if="!operationForm.view && !operationForm.edb_id">
  23. <li v-for="item in sourceList" :key="item.key" :class="{act: type === item.key}" @click="init();$emit('changeSource',item.key)">{{item.label}}</li>
  24. </ul>
  25. <div class="min-top">
  26. <label ><!-- 选择指标 -->{{$t('Edb.choose_edb')}}:</label>
  27. <el-select
  28. v-model="select_target"
  29. v-loadMore="searchLoad"
  30. :filterable="!select_target"
  31. clearable
  32. :placeholder="$t('Edb.InputHolderAll.input_name')"
  33. style="width: 85%"
  34. remote
  35. :remote-method="getTarget"
  36. @click.native="inputFocusHandle"
  37. @change="chooseTarget"
  38. @blur="search_have_more = false"
  39. :disabled="operationForm.view||[69,70].includes(type)"
  40. >
  41. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  42. <el-option
  43. v-for="item in searchOptions"
  44. :key="item.EdbInfoId"
  45. :label="$parent.currentLang==='en'?(item.EdbNameEn||item.EdbName):item.EdbName"
  46. :value="item.EdbInfoId"
  47. :disabled="!item.HaveOperaAuth"
  48. >
  49. <div>
  50. <img
  51. :src="$icons.lock_ico2"
  52. width="18"
  53. height="18"
  54. style="vertical-align:middle"
  55. v-if="!item.HaveOperaAuth"
  56. />
  57. {{$parent.currentLang==='en'?(item.EdbNameEn||item.EdbName):item.EdbName}}
  58. </div>
  59. </el-option>
  60. </el-select>
  61. <i class="el-icon-tickets" style="color:#409EFF;font-size:18px" @click="$emit('lookHistory',select_target)" v-if="select_target"/>
  62. </div>
  63. <div class="middle">
  64. <label><!-- 已选指标: -->{{ $t('Edb.have_choose_edb') }}:</label>
  65. <el-table
  66. :data="tableData"
  67. style="box-shadow: 0px 3px 6px rgba(155, 170, 219, 0.2);margin-top:10px;"
  68. border>
  69. <el-table-column
  70. v-for="item in tableColums"
  71. :key="item.label"
  72. :label="item.label"
  73. :width="item.widthsty"
  74. :min-width="item.minwidthsty"
  75. align="center"
  76. >
  77. <template slot-scope="scope">
  78. <span>{{ scope.row[item.key] }}</span>
  79. </template>
  80. </el-table-column>
  81. <el-table-column
  82. width="110"
  83. align="center"
  84. :label="$t('Table.column_operations')"
  85. v-if="!operationForm.view"
  86. >
  87. <template slot-scope="scope">
  88. <span class="deletesty" @click="delTarget"><!-- 删除 -->{{$t('Table.delete_btn')}}</span>
  89. </template>
  90. </el-table-column>
  91. <div slot="empty" style="padding:20px 0 30px;">
  92. <tableNoData :text="$t('Table.no_edb_msg')" size="mini"/>
  93. </div>
  94. </el-table>
  95. <ul
  96. class="data-ul"
  97. ref="dataUl"
  98. @scroll="scrollHandle"
  99. v-if="dataList.length">
  100. <li
  101. class="value-item"
  102. v-for="item in dataList"
  103. :key="item.EdbDataId"
  104. >
  105. <span class="value-label">
  106. <i class="new-tag" v-if="tableData[0].LatestDate===item.DataTime"></i>
  107. {{ item.DataTime }}
  108. </span>
  109. <span
  110. :class="['value-label',{'predict-act': item.isPredic}]"
  111. style="min-width: 200px; text-align: center"
  112. >{{ item.Value }}</span
  113. >
  114. </li>
  115. </ul>
  116. <div class="form-cont">
  117. <el-form
  118. ref="form"
  119. label-position="right"
  120. inline
  121. label-width="120px"
  122. :model="formData"
  123. :rules="formRules"
  124. :disabled="operationForm.view"
  125. >
  126. <el-form-item :label="$t('EtaBasePage.label_move_way')" style="display: block;" v-if="type === 46" prop="moveVal">
  127. <el-select
  128. v-model="formData.moveType"
  129. style="width: 100px"
  130. placeholder=""
  131. size="mini"
  132. @change="refreshTarget"
  133. >
  134. <el-option
  135. v-for="item in moveTypeOpions"
  136. :key="item.key"
  137. :label="item.label"
  138. :value="item.key"
  139. >
  140. </el-option>
  141. </el-select>
  142. <el-input
  143. style="width: 80px"
  144. type="number"
  145. min="0"
  146. size="mini"
  147. v-model="formData.moveVal"
  148. @keyup.native="filterCode(formData)"
  149. ></el-input>
  150. <el-select
  151. v-model="formData.moveUnit"
  152. size="mini"
  153. placeholder=""
  154. style="width: 100px"
  155. @change="refreshTarget"
  156. >
  157. <el-option
  158. v-for="item in fre_options"
  159. :key="item"
  160. :label="item"
  161. :value="item"
  162. >
  163. </el-option>
  164. </el-select>
  165. </el-form-item>
  166. <el-form-item :label="$t('Edb.Detail.e_name')" prop="targetName">
  167. <el-input
  168. v-model="formData.targetName"
  169. style="width: 340px"
  170. :placeholder="$t('Edb.InputHolderAll.input_name')"
  171. />
  172. </el-form-item>
  173. <el-form-item :label="$t('Edb.Detail.e_unit')" prop="unit">
  174. <selectUnit
  175. v-model="formData.unit"
  176. style="width: 340px"
  177. :disabled="!operationForm.edb_id&&[32,33].includes(type)"
  178. />
  179. </el-form-item>
  180. <el-form-item :label="$t('Edb.Detail.e_menu')" prop="menu">
  181. <el-cascader
  182. v-model="formData.menu"
  183. :options="options"
  184. :props="{
  185. label: 'ClassifyName',
  186. value: 'ClassifyId',
  187. children: 'Children',
  188. checkStrictly: true
  189. }"
  190. style="width: 90%"
  191. :placeholder="$t('Edb.InputHolderAll.input_menu')"
  192. />
  193. </el-form-item>
  194. <el-form-item :label="$t('Edb.Detail.e_fre')" prop="frequency">
  195. <el-select
  196. v-model="formData.frequency"
  197. :placeholder="$t('Edb.InputHolderAll.input_fre')"
  198. style="width: 340px"
  199. clearable
  200. :disabled="[42,45,64,66].includes(type)||(!operationForm.edb_id&&[32,33].includes(type))"
  201. >
  202. <el-option
  203. v-for="item in frequencyArr"
  204. :key="item"
  205. :label="item"
  206. :value="item"
  207. >
  208. </el-option>
  209. </el-select>
  210. </el-form-item>
  211. <el-form-item :label="$t('EtaBasePage.label_n_val')" prop="n_num" v-if="[39,43,44,49].includes(type)">
  212. <el-input
  213. v-model="formData.n_num"
  214. style="width: 340px"
  215. :placeholder="$t('Edb.InputHolderAll.input_n_val')"
  216. type="number"
  217. @change="NchangeHandle"
  218. />
  219. </el-form-item>
  220. <el-form-item :label="$t('EtaBasePage.label_calendar')" prop="calendar_type" v-if="type===49">
  221. <el-select
  222. v-model="formData.calendar_type"
  223. placeholder="请选择日历"
  224. style="width: 340px"
  225. @change="NchangeHandle"
  226. >
  227. <el-option
  228. v-for="item in calendarOptions"
  229. :key="item.key"
  230. :label="item.label"
  231. :value="item.label"
  232. >
  233. </el-option>
  234. </el-select>
  235. </el-form-item>
  236. <el-form-item :label="$t('EtaBasePage.label_val_type')" prop="value_type" v-if="type===54">
  237. <el-select
  238. v-model="formData.value_type"
  239. placeholder="请选择数据取值类型"
  240. style="width: 340px"
  241. >
  242. <el-option :label="$t('EtaBasePage.val_type_end')" value="期末值"/>
  243. <el-option :label="$t('EtaBasePage.val_type_average')" value="平均值"/>
  244. </el-select>
  245. </el-form-item>
  246. <!-- 通过统计特征保存的指标 -->
  247. <el-form-item :label="$t('Edb.Detail.source')" v-if="[69,70].includes(type)" style="width:50%">
  248. <span>{{type===69?'标准差':'百分比'}}</span>
  249. </el-form-item>
  250. </el-form>
  251. </div>
  252. </div>
  253. </div>
  254. <div class="dia-bot" v-if="!operationForm.view">
  255. <el-button
  256. type="primary"
  257. style="margin-right: 20px"
  258. @click="saveHandle"
  259. :loading="loading"
  260. >{{loading ? $t('Edb.calculate_ing') : operationForm.edb_id ? $t('Dialog.confirm_save_btn') : saveBtnMap.get(type)}}</el-button
  261. >
  262. <el-button type="primary" plain @click="cancelHandle('cancel')"><!-- 取消 -->{{$t('Dialog.cancel_btn')}}</el-button>
  263. </div>
  264. <el-popover
  265. placement="top-start"
  266. width="500"
  267. trigger="click"
  268. v-show="$parent.tips.get(type)">
  269. <p style="padding:30px;line-height:25px;" v-html="$parent.tips.get(type)"/>
  270. <span slot="reference" class="tip-label"><!-- 公式说明 -->{{$t('Edb.formula_instru')}}</span>
  271. </el-popover>
  272. </el-dialog>
  273. </template>
  274. <script>
  275. import * as preDictEdbInterface from '@/api/modules/predictEdbApi.js';
  276. import { formRules } from '@/views/dataEntry_manage/databaseComponents/util';
  277. import { unitArr } from '@/utils/defaultOptions';
  278. export default {
  279. name:'',
  280. props: {
  281. isOperation: {
  282. type: Boolean,
  283. },
  284. type: {
  285. type: Number
  286. },
  287. operationForm: {
  288. type: Object,
  289. }
  290. },
  291. watch: {
  292. isOperation(newval) {
  293. newval && this.getMenu();
  294. if(newval && this.operationForm.edb_id) {
  295. const backData = _.cloneDeep(this.operationForm);
  296. this.select_target = backData.oldedb_id;
  297. this.formData = {
  298. edb_id: backData.edb_id,
  299. targetName: backData.targetName,
  300. unit: backData.unit,
  301. menu: backData.menu,
  302. frequency: backData.frequency,
  303. n_num: backData.formula,
  304. moveType:backData.moveType,
  305. moveUnit:backData.moveUnit,
  306. moveVal:backData.moveVal,
  307. calendar_type:backData.calendar_type,
  308. value_type: this.type === 54 ? backData.formula : '期末值',
  309. }
  310. this.getDataList();
  311. //回显时的默认options
  312. this.searchOptions = [
  313. {
  314. EdbInfoId: backData.oldedb_id,
  315. EdbName: backData.oldEdb_name,
  316. }
  317. ]
  318. }
  319. this.sourceList = [42,64].includes(this.type)
  320. ? [{ label: /* '累计值转月值' */this.$t('Edb.CalculatesAll.to_month'),key: 42 },{ label: /* '累计值转季值' */this.$t('Edb.CalculatesAll.to_quarter'),key: 64 }]
  321. : [65,66].includes(this.type)
  322. ? [{ label: /* '累计值' */this.$t('Edb.CalculatesAll.cumulate'),key: 65 },{ label: /* '年初至今累计值' */this.$t('Edb.CalculatesAll.cumulate_oneyear'),key: 66 }]
  323. : []
  324. }
  325. },
  326. computed: {
  327. tableColums(){
  328. return [
  329. {
  330. label: /* '指标ID' */this.$t('Edb.Detail.e_id'),
  331. key: 'EdbCode',
  332. },
  333. {
  334. label: /* '指标名称' */this.$t('Edb.Detail.e_name'),
  335. key: 'EdbName',
  336. },
  337. {
  338. label: /* '频度' */ this.$t('Edb.Detail.e_fre'),
  339. key: 'Frequency',
  340. },
  341. {
  342. label: /* '单位' */this.$t('Edb.Detail.e_unit'),
  343. key: 'Unit',
  344. },
  345. {
  346. label: /* '起始时间' */this.$t('Edb.Detail.e_start_time'),
  347. key: 'StartDate',
  348. minwidthsty: '100px'
  349. },
  350. {
  351. label: /* '更新时间' */this.$t('Edb.Detail.e_update_time'),
  352. key: 'ModifyTime',
  353. minwidthsty: '110px'
  354. },
  355. {
  356. label: /* '来源' */this.$t('Edb.Detail.source'),
  357. key: 'SourceName',
  358. },
  359. ]
  360. },
  361. formRules(){
  362. return formRules
  363. },
  364. unitArr() {
  365. return unitArr
  366. },
  367. },
  368. data () {
  369. return {
  370. select_target:'',
  371. searchOptions:[],//指标列表
  372. haveMore: true,
  373. dataList:[],
  374. page_no:1,
  375. titleMap: new Map([
  376. [42,this.$t('Edb.CalculatesAll.to_month_quarter')],/* '累计值转月/季值' */
  377. [32,this.$t('Edb.CalculatesAll.on_year')],/* '同比值' */
  378. [33,this.$t('Edb.CalculatesAll.differ')],/* '同差值' */
  379. [39,this.$t('Edb.CalculatesAll.n_move_average')],/* 'N数值移动平均计算' */
  380. [43,this.$t('Edb.CalculatesAll.n_rate')],/* 'N数值环比值' */
  381. [44,this.$t('Edb.CalculatesAll.n_differ')],/* 'N数值环差值' */
  382. [45,this.$t('Edb.CalculatesAll.up_conver')],/* 升频 */
  383. [46,this.$t('Edb.CalculatesAll.time_move')],/* '时间移位' */
  384. [49,this.$t('Edb.CalculatesAll.super_season')],/* '超季节性' */
  385. [55,this.$t('Edb.CalculatesAll.annual')],/* '年化' */
  386. [54,this.$t('Edb.CalculatesAll.down_conver')],/* '降频' */
  387. [64,this.$t('Edb.CalculatesAll.to_month_quarter')],/* '累计值转月/季值' */
  388. [65,this.$t('Edb.CalculatesAll.cumulate')],/* '累计值' */
  389. [66,this.$t('Edb.CalculatesAll.cumulate')],/* '累计值' */
  390. [69,this.$t('Edb.CalculatesAll.standard_differ')],/* 标准差 */
  391. [70,this.$t('Edb.CalculatesAll.percent')],/* 百分比 */
  392. ]),//标题
  393. saveBtnMap: new Map([
  394. [42,/* '转月值计算' */this.$t('Edb.CalculateBtns.to_month')],
  395. [32,/* '同比值计算' */this.$t('Edb.CalculateBtns.on_year')],
  396. [33,/* '同差值计算' */this.$t('Edb.CalculateBtns.differ')],
  397. [39,/* '移动平均计算' */this.$t('Edb.CalculateBtns.n_move_average')],
  398. [43,/* '环比值计算' */this.$t('Edb.CalculateBtns.n_rate')],
  399. [44,/* '环差值计算' */this.$t('Edb.CalculateBtns.n_differ')],
  400. [45,/* '升频计算' */this.$t('Edb.CalculateBtns.up_conver')],
  401. [46,/* '保存' */this.$t('Dialog.confirm_save_btn')],
  402. [49,/* '超季节性计算' */this.$t('Edb.CalculateBtns.super_season')],
  403. [55,/* '年化计算' */this.$t('Edb.CalculateBtns.annual')],
  404. [54,/* '降频计算' */this.$t('Edb.CalculateBtns.down_conver')],
  405. [64,/* '转季值计算' */this.$t('Edb.CalculateBtns.to_quarter')],
  406. [65,/* '累计值计算' */this.$t('Edb.CalculateBtns.cumulate')],
  407. [66,/* '年初至今计算' */this.$t('Edb.CalculateBtns.cumulate_oneyear')],
  408. ]),//保存文案
  409. formData: {
  410. targetName:'',
  411. unit:'',
  412. menu:'',
  413. frequency:'',
  414. n_num: 1,
  415. moveType: 1,
  416. moveUnit: '天',
  417. moveVal: '',
  418. calendar_type: '公历',
  419. value_type: '期末值'
  420. },
  421. options: [],
  422. frequencyArr: ['日度', '周度','旬度', '月度', '季度', '年度'],
  423. fre_options: ['天','周','月','季','年'],
  424. moveTypeOpions: [
  425. {
  426. label: '领先',
  427. key: 1
  428. },
  429. {
  430. label: '滞后',
  431. key: 2
  432. },
  433. ],
  434. loading:false,
  435. tableData: [],
  436. search_have_more: false,
  437. search_page: 1,
  438. current_search: '',
  439. calendarOptions: [
  440. {label: '公历',key: 1},
  441. {label: '农历',key: 2},
  442. ],
  443. sourceList: []
  444. };
  445. },
  446. methods: {
  447. /* 指标列表 */
  448. getTarget(query) {
  449. this.search_page = 1;
  450. this.current_search = query;
  451. this.searchApi(this.current_search);
  452. },
  453. /* 聚焦获取当前检索 */
  454. inputFocusHandle(e) {
  455. this.search_page = 1;
  456. this.current_search = e.target.value;
  457. this.searchApi(this.current_search);
  458. },
  459. searchApi(query,page=1) {
  460. const filterMap = {
  461. 42: 2,
  462. 45: 3,
  463. 66: 6
  464. }
  465. preDictEdbInterface.edbSearch({
  466. Keyword: query,
  467. CurrentIndex: page,
  468. FilterSource: filterMap[this.type] ? filterMap[this.type] : 1,
  469. Frequency: this.type===64?'季度': ''
  470. })
  471. .then((res) => {
  472. if (res.Ret !== 200) return
  473. const { List,Paging } = res.Data;
  474. this.search_have_more = page < Paging.Pages;
  475. let arr = page === 1 ? List : this.searchOptions.concat(List);
  476. this.searchOptions = this.operationForm.edb_id ? arr.filter(item => item.EdbInfoId !== this.operationForm.edb_id) : arr;
  477. });
  478. },
  479. searchLoad() {
  480. if(!this.search_have_more) return;
  481. this.searchApi(this.current_search,++this.search_page)
  482. },
  483. // 递归改变目录结构
  484. filterNodes(arr) {
  485. arr.length &&
  486. arr.forEach((item) => {
  487. item.Children.length && this.filterNodes(item.Children);
  488. if (!item.Children.length) {
  489. delete item.Children;
  490. }
  491. });
  492. },
  493. /* 获取目录结构 */
  494. getMenu() {
  495. preDictEdbInterface.classifyListV2().then(res => {
  496. if(res.Ret !== 200) return
  497. this.filterNodes(res.Data.AllNodes||[]);
  498. this.options = res.Data.AllNodes || [];
  499. })
  500. },
  501. /* 获取指标数据 */
  502. getDataList() {
  503. preDictEdbInterface.edbDataInfo({
  504. PageSize: 10,
  505. EdbInfoId: this.select_target,
  506. CurrentIndex: this.page_no
  507. }).then(res => {
  508. if(res.Ret !== 200) return
  509. const { Item,Paging } = res.Data;
  510. this.tableData = [Item] || [];
  511. Item.PredictDataList && Item.PredictDataList.forEach(_ => {
  512. _.isPredic = true;
  513. })
  514. this.haveMore = this.page_no < Paging.Pages;
  515. this.dataList = this.page_no === 1 ? [...Item.PredictDataList,...Item.DataList] : [...this.dataList,...Item.DataList];
  516. })
  517. },
  518. /* 滚动加载 */
  519. scrollHandle(e) {
  520. const dom = e.target
  521. let scrollTop = dom.scrollTop; //滑入屏幕上方的高度
  522. let windowHeitht = dom.clientHeight; //页面的高度
  523. let scrollHeight = dom.scrollHeight; //整个div的高度
  524. let total = scrollTop + windowHeitht
  525. if(total >= scrollHeight && this.haveMore){
  526. this.page_no ++;
  527. this.getDataList();
  528. }
  529. },
  530. /* 选择指标 */
  531. chooseTarget(val) {
  532. if(val) {
  533. let obj = this.searchOptions.find(item => item.EdbInfoId === val);
  534. //频度 名称默认同步
  535. this.setDefaultOption(obj);
  536. this.page_no = 1;
  537. this.dataList.length ? this.$refs.dataUl.scrollTop = 0 : null;
  538. this.getDataList()
  539. }else {
  540. this.tableData = [];
  541. this.dataList = [];
  542. }
  543. },
  544. /* 删除已选指标 */
  545. delTarget() {
  546. this.tableData = [];
  547. this.dataList = [];
  548. this.select_target = '';
  549. this.page_no = 1;
  550. },
  551. /* 过滤负数 小数点*/
  552. filterCode(item) {
  553. item.moveVal=item.moveVal.replace(/[^\.\d]/g,'').replace('.','');
  554. },
  555. init() {
  556. this.page_no = 1;
  557. this.select_target = '';
  558. this.searchOptions = [];
  559. this.tableData = [];
  560. this.dataList = [];
  561. this.formData = {
  562. targetName:'',
  563. unit:'',
  564. menu:'',
  565. frequency:'',
  566. n_num: 1,
  567. moveType: 1,
  568. moveUnit: '天',
  569. moveVal: '',
  570. calendar_type: '公历',
  571. value_type: '期末值'
  572. };
  573. this.$refs.form.resetFields();
  574. },
  575. /* 保存 */
  576. async saveHandle() {
  577. if(!this.select_target) return this.$message.warning(/* '指标不能为空' */this.$t('Edb.Valids.no_edb'))
  578. // return
  579. await this.$refs.form.validate()
  580. this.loading = true;
  581. const valueMap = {
  582. 46: 'moveVal',
  583. 54: 'value_type'
  584. }
  585. let params ={
  586. Source: this.type,
  587. EdbName: this.formData.targetName,
  588. Unit: this.formData.unit,
  589. ClassifyId: this.formData.menu[this.formData.menu.length - 1],
  590. Frequency: this.formData.frequency,
  591. FromEdbInfoId: this.select_target,
  592. Formula: valueMap[this.type] ? String(this.formData[valueMap[this.type]]) : String(this.formData.n_num),
  593. MoveFrequency: this.formData.moveUnit,
  594. MoveType: this.formData.moveType,
  595. Calendar: this.formData.calendar_type,
  596. }
  597. /* 编辑 */
  598. let edit_params = { ...params,EdbInfoId: this.operationForm.edb_id }
  599. preDictEdbInterface.operateEdbSave(this.operationForm.edb_id ? edit_params : params)
  600. .then((res) => {
  601. this.loading = false;
  602. if(res.Ret !== 200) return
  603. this.$message.success(res.Msg);
  604. this.operationForm.edb_id ? this.$emit('addCallBack','edit') : this.$emit('addCallBack','add',{
  605. code:res.Data.UniqueCode,
  606. id:res.Data.EdbInfoId,
  607. classifyId:params.ClassifyId
  608. });
  609. this.init();
  610. })
  611. },
  612. /* 关闭弹窗 */
  613. cancelHandle(type) {
  614. this.init()
  615. this.$emit('cancel');
  616. type==='cancel' && !this.operationForm.edb_id && this.$emit('openPrev');
  617. },
  618. /* 单位默认同步基础指标
  619. 同比 同差 频度同步 单位无
  620. 转月 平均值 频度单位同步
  621. 同比 同差值:默认名称为指标名称+同比/同差
  622. n数值环比/环差值计算:默认名称为指标名称+N+频度+环比/环差
  623. 转月 平均计算 变频默认指标名称同步
  624. */
  625. setDefaultOption(obj) {
  626. const tMap=new Map([
  627. ['日度','D'],
  628. ['周度','W'],
  629. ['旬度','T'],
  630. ['月度','M'],
  631. ['季度','Q'],
  632. ['年度','Y'],
  633. ])
  634. const name_map = {
  635. 42: obj.EdbName,
  636. 32: `${obj.EdbName}同比`,
  637. 33: `${obj.EdbName}同差`,
  638. 39: `${obj.EdbName}/${this.formData.n_num}${tMap.get(obj.Frequency)}MA`,
  639. 45: `${obj.EdbName}/${obj.Frequency}升频`,
  640. 43: `${obj.EdbName}${this.formData.n_num}${obj.Frequency.slice(0,1)}环比`,
  641. 44: `${obj.EdbName}${this.formData.n_num}${obj.Frequency.slice(0,1)}环差`,
  642. 49: `${obj.EdbName}超季节性/${this.formData.n_num}年${this.formData.calendar_type==='公历'?'':'/'+this.formData.calendar_type}`,
  643. 55: `${obj.EdbName}年化`,
  644. 54: `${obj.EdbName}/${obj.Frequency}降频`,
  645. 64: obj.EdbName,
  646. 65: obj.EdbName,
  647. 66: obj.EdbName,
  648. }
  649. this.formData = {
  650. targetName: name_map[this.type] || '',
  651. frequency: this.type === 45 ? '日度' : this.type === 64 ? '季度': this.type === 65 ? '': obj.Frequency,
  652. unit: [33,39,42,45,49].includes(this.type) ? obj.Unit : '无',
  653. menu:'',
  654. n_num: 1,
  655. moveType: 1,
  656. moveUnit: '天',
  657. moveVal: '',
  658. calendar_type: this.formData.calendar_type,
  659. value_type: this.formData.value_type
  660. }
  661. },
  662. // N数值变化,名称也变化
  663. NchangeHandle() {
  664. if(!this.select_target) return;
  665. let obj = this.searchOptions.find(item => item.EdbInfoId === this.select_target);
  666. const tMap=new Map([
  667. ['日度','D'],
  668. ['周度','W'],
  669. ['旬度','T'],
  670. ['月度','M'],
  671. ['季度','Q'],
  672. ['年度','Y'],
  673. ])
  674. const name_map = {
  675. 43: `${obj.EdbName}${this.formData.n_num}${obj.Frequency.slice(0,1)}环比`,
  676. 44: `${obj.EdbName}${this.formData.n_num}${obj.Frequency.slice(0,1)}环差`,
  677. 49: `${obj.EdbName}超季节性/${this.formData.n_num}年${this.formData.calendar_type==='公历'?'':'/'+this.formData.calendar_type}`,
  678. 39: `${obj.EdbName}/${this.formData.n_num}${tMap.get(obj.Frequency)}MA`,
  679. }
  680. this.formData.targetName = name_map[this.type] || '';
  681. },
  682. },
  683. mounted() {},
  684. }
  685. </script>
  686. <style lang='scss'>
  687. .operation-dialog {
  688. position: relative;
  689. div::-webkit-scrollbar {
  690. width: 6px !important;
  691. }
  692. .el-input-number .el-input__inner {
  693. padding: 0 34px 0 4px;
  694. }
  695. .el-dialog__body {
  696. max-height: 780px;
  697. overflow: auto;
  698. }
  699. .dialog-main {
  700. .el-cascader .el-input {
  701. width: 340px;
  702. }
  703. .label-cont {
  704. display: flex;
  705. align-items: center;
  706. margin-bottom: 15px;
  707. li {
  708. cursor: pointer;
  709. font-size: 16px;
  710. margin-right: 24px;
  711. &:hover {
  712. color: #409EFF;
  713. }
  714. &.act {
  715. color: #409EFF;
  716. }
  717. }
  718. }
  719. .min-top {
  720. padding: 20px 30px;
  721. border: 1px solid #ECECEC;
  722. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.05);
  723. border-radius:4px;
  724. }
  725. .middle {
  726. margin-top: 20px;
  727. .data-ul {
  728. margin-top: 5px;
  729. border-bottom: 1px solid #dcdfe6;
  730. max-height: 140px;
  731. overflow-y: auto;
  732. .value-item {
  733. /* width: 100%; */
  734. padding: 14px 0;
  735. border: 1px solid #dcdfe6;
  736. border-bottom: none;
  737. display: flex;
  738. justify-content: space-around;
  739. .value-label {
  740. position: relative;
  741. color: #666;
  742. }
  743. .predict-act {
  744. color: orange;
  745. }
  746. .new-tag {
  747. width: 6px;
  748. height: 6px;
  749. display: inline-block;
  750. position: absolute;
  751. left: -12px;
  752. top: 50%;
  753. transform: translateY(-50%);
  754. border-radius: 50%;
  755. background: #f00;
  756. }
  757. }
  758. }
  759. .form-cont {
  760. padding-top: 30px;
  761. margin-top: 30px;
  762. border-top: 1px dashed #AAB4CC;
  763. input::-webkit-outer-spin-button,
  764. input::-webkit-inner-spin-button {
  765. -webkit-appearance: none;
  766. }
  767. input[type="number"]{
  768. -moz-appearance: textfield;
  769. }
  770. }
  771. }
  772. }
  773. .dia-bot {
  774. padding: 20px 0 30px;
  775. display: flex;
  776. justify-content: center;
  777. }
  778. .tip-cont {
  779. padding: 30px;
  780. }
  781. .tip-label {
  782. position: absolute;
  783. bottom: 30px;
  784. right: 30px;
  785. color: #409EFF;
  786. cursor: pointer;
  787. }
  788. }
  789. </style>