highFrequencyData.vue 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
  1. <template>
  2. <div class="hight-frequency-data-container">
  3. <div class="top-box">
  4. <div class="select-box">
  5. <span>{{$t('SystemManage.DataRefresh.select_source')}}</span>
  6. <el-select :placeholder="$t('SystemManage.DataRefresh.select_source_pld')" v-model="Source" @change="handleSourceChange">
  7. <el-option v-for="item in SourceList" :key="item.Source"
  8. :label="$i18nt.locale==='zh'?item.SourceName:item.SourceNameEn||item.SourceName" :value="item.Source"/>
  9. </el-select>
  10. <el-select v-model="Sequence" @change="handleSequenceChange">
  11. <el-option v-for="item in SequenceList" :key="item.Sequence"
  12. :label="$i18nt.locale==='zh'?item.SequenceName:item.SequenceNameEn||item.SequenceName" :value="item.Sequence"/>
  13. </el-select>
  14. <!-- 添加高频数据 -->
  15. <el-button type="primary" @click="addHighFrequencyDiaShow" v-permission="permissionBtn.dataSourcePermission.highFrequency_adds"
  16. >{{$t('HighFrequencyData.add_high_frequency_data')}}</el-button>
  17. </div>
  18. </div>
  19. <div class="table-box">
  20. <div class="table-select">
  21. <div class="select-list">
  22. <el-cascader :placeholder="$t('HighFrequencyData.select_classify_prompt')"
  23. v-model="classifyArr" @change="searchListDelay" :options="classifyListTree"
  24. style="max-width: 160px;"
  25. key="isAssociativeSub"
  26. v-if="searchParams.isAssociativeSub"
  27. :show-all-levels="false" collapse-tags
  28. :props="classifyProps"
  29. clearable/>
  30. <el-cascader :placeholder="$t('HighFrequencyData.select_classify_prompt')"
  31. v-model="classifyArr" @change="searchListDelay" :options="classifyListTree"
  32. style="max-width: 160px;" v-else key="noIsAssociativeSub"
  33. :show-all-levels="false" collapse-tags
  34. :props="classifyProps"
  35. clearable/>
  36. <div class="associative-box">
  37. <span>{{$t('HighFrequencyData.associative_sub_classify')}}</span>
  38. <el-switch v-model="searchParams.isAssociativeSub" @change="changeAssociativeSub"></el-switch>
  39. <span class="span-button" @click="setClassify"
  40. v-permission="[permissionBtn.dataSourcePermission.highFrequency_classify_move,permissionBtn.dataSourcePermission.highFrequency_classify_delete,
  41. permissionBtn.dataSourcePermission.highFrequency_classify_editAdd,'or']"
  42. >{{$t('HighFrequencyData.classify_setting')}}</span>
  43. </div>
  44. <el-select :placeholder="$t('Edb.InputHolderAll.input_fre')" v-model="frequencyArr" @change="searchListDelay" multiple collapse-tags clearable>
  45. <el-option v-for="i in frequencyList" :key="i.value"
  46. :label="i.label" :value="i.value"
  47. />
  48. </el-select>
  49. <el-cascader
  50. :placeholder="$t('Edb.InputHolderAll.select_creator')" v-model="userArr" @change="searchListDelay"
  51. :props="{
  52. value: 'ItemId',
  53. label: 'ItemName',
  54. children: 'Children',
  55. emitPath: false,
  56. multiple:true,
  57. }"
  58. :options="userList"
  59. collapse-tags
  60. :show-all-levels="false"
  61. clearable
  62. filterable
  63. />
  64. <el-input :placeholder="$t('Edb.InputHolderAll.input_name_orid')" prefix-icon="el-icon-search" clearable
  65. v-model="searchParams.keyWord" @input="searchList"></el-input>
  66. </div>
  67. <div class="select-other">
  68. <el-checkbox :indeterminate="isIndeterminate" v-model="isCheckAll" @change="listCheckAllChange">{{$t('SystemManage.DataRefresh.all_list')}}</el-checkbox>
  69. <!-- 批量添加到指标库 -->
  70. <el-button type="primary" @click="batchAddToDatabaseOpen"
  71. :disabled="!selectedTotal>0" :loading="batchLoading"
  72. v-permission="permissionBtn.dataSourcePermission.highFrequency_addTo_database"
  73. >{{$t('HighFrequencyData.add_to_eta_indicators')}}</el-button>
  74. <!-- 批量操作 -->
  75. <el-button type="primary" @click="openBatchOperationDia"
  76. :disabled="!selectedTotal>0" :loading="batchLoading"
  77. v-permission="permissionBtn.dataSourcePermission.highFrequency_operations"
  78. >{{$t('HighFrequencyData.batch_operation')}}</el-button>
  79. </div>
  80. </div>
  81. <el-table :data="tableData" border ref="edbDataRef"
  82. @selection-change="selectionChange"
  83. @select="selectHandle"
  84. @select-all="selectAllHandle"
  85. @sort-change="handleSortChange"
  86. >
  87. <!-- 多选 -->
  88. <el-table-column
  89. align="center"
  90. type="selection"
  91. width="55">
  92. </el-table-column>
  93. <!-- 指标ID -->
  94. <el-table-column prop="IndexCode" :label="$t('Edb.Detail.e_id')" align="center" show-overflow-tooltip>
  95. <template slot-scope="{row}">
  96. <span>{{row.IndexCode}}</span>
  97. </template>
  98. </el-table-column>
  99. <!-- 指标名称 -->
  100. <el-table-column prop="IndexName" :label="$t('Edb.Detail.e_name')" align="center" show-overflow-tooltip>
  101. <template slot-scope="{row}">
  102. <span>{{row.IndexName}}</span>
  103. </template>
  104. </el-table-column>
  105. <!-- 频度 -->
  106. <el-table-column prop="Frequency" :label="$t('Edb.Detail.e_fre')" align="center">
  107. <template slot-scope="{row}">
  108. <span>{{row.Frequency}}</span>
  109. </template>
  110. </el-table-column>
  111. <!-- 单位 -->
  112. <el-table-column prop="Unit" :label="$t('Edb.Detail.e_unit')" align="center">
  113. <template slot-scope="{row}">
  114. <span>{{row.Unit}}</span>
  115. </template>
  116. </el-table-column>
  117. <!-- 指标开始时间 -->
  118. <el-table-column prop="StartDate" :label="$t('Edb.Detail.e_start_time_whole')" align="center" sortable="custom">
  119. <template slot-scope="{row}">
  120. <span>{{row.StartDate}}</span>
  121. </template>
  122. </el-table-column>
  123. <!-- 指标最新时间 -->
  124. <el-table-column prop="EndDate" :label="$t('Edb.Detail.e_latest_time_whole')" align="center" sortable="custom">
  125. <template slot-scope="{row}">
  126. <span>{{row.EndDate}}</span>
  127. </template>
  128. </el-table-column>
  129. <!-- 更新时间 -->
  130. <el-table-column prop="ModifyTime" :label="$t('Edb.Detail.e_update_time')" align="center" sortable="custom">
  131. <template slot-scope="{row}">
  132. <span>{{row.ModifyTime}}</span>
  133. </template>
  134. </el-table-column>
  135. <!-- 最新值 -->
  136. <el-table-column prop="LatestValue" :label="$t('Edb.Detail.e_latest_value')" align="center" sortable="custom">
  137. <template slot-scope="{row}">
  138. <span>{{row.LatestValue}}</span>
  139. </template>
  140. </el-table-column>
  141. <!-- 数据源分类 -->
  142. <el-table-column prop="ClassifyPath" :label="$t('HighFrequencyData.data_source_classify')" align="center" show-overflow-tooltip>
  143. <template slot-scope="{row}">
  144. <span>{{row.ClassifyPath}}</span>
  145. </template>
  146. </el-table-column>
  147. <el-table-column prop="Operation" :label="$t('Table.column_operations')" align="center">
  148. <template slot-scope="{row}">
  149. <span class="table-operation-item" @click="detailIndexHandle(row)"
  150. v-permission="permissionBtn.dataSourcePermission.highFrequency_operation_detail">{{ $t('Table.detail_btn') }}</span>
  151. <span class="table-operation-item" @click="refreshIndexHandle(row)"
  152. v-permission="permissionBtn.dataSourcePermission.highFrequency_operation_refresh">{{ $t('Table.refresh_btn') }}</span>
  153. <span class="table-operation-item del-item" @click="deleteIndexHandle(row)"
  154. v-permission="permissionBtn.dataSourcePermission.highFrequency_operation_delete">{{ $t('Table.delete_btn') }}</span>
  155. </template>
  156. </el-table-column>
  157. </el-table>
  158. <el-pagination
  159. :current-page="searchParams.currentPage"
  160. :page-size="searchParams.pageSize"
  161. :total="total"
  162. @current-change="handleCurrentChange"
  163. />
  164. </div>
  165. <!-- 数据详情 -->
  166. <el-dialog custom-class="custom-dialog"
  167. :title="$t('Edb.data_detail_tab')"
  168. :visible.sync="detailDiaShow"
  169. :close-on-click-modal="false"
  170. :modal-append-to-body="false"
  171. @close="detailDiaShow=false"
  172. width="980px"
  173. top="5vh"
  174. v-dialogDrag
  175. center
  176. >
  177. <div class="dialog-container">
  178. <div class="detail-date-select-zone">
  179. <span>{{ $t('HighFrequencyData.data_date') }}</span>
  180. <el-date-picker v-model="detailRequestParams.DataDate" type="date" :clearable="false" @change="getIndexDetailFun"
  181. :placeholder="$t('EtaBasePage.input_date_msg')" style="max-width:240px" value-format="yyyy-MM-dd"></el-date-picker>
  182. </div>
  183. <div class="detail-data-zone">
  184. <div class="detail-data-zone-header">
  185. <table border class="header-table">
  186. <tr>
  187. <td>{{ $t('Edb.Detail.e_name') }}</td>
  188. <td>
  189. <el-input v-model.trim="indexDetail.IndexName" :placeholder="$t('Edb.InputHolderAll.input_name')" size="mini"></el-input>
  190. </td>
  191. </tr>
  192. <tr>
  193. <td>{{ $t('Edb.Detail.e_stock_code') }}</td>
  194. <td>{{ indexDetail.ZqCode }}</td>
  195. </tr>
  196. <tr>
  197. <td>{{ $t('Edb.Detail.e_indicator_code') }}</td>
  198. <td>{{ indexDetail.ZbCode }}</td>
  199. </tr>
  200. </table>
  201. <table border class="header-table">
  202. <tr>
  203. <td>{{ $t('HighFrequencyData.belong_to_classify') }}</td>
  204. <td>
  205. <el-cascader :options="classifyListTree" v-model="indexDetail.ClassifyId"
  206. size="mini"
  207. :props="{label: 'ClassifyName',
  208. value: 'ClassifyId',
  209. children: 'Children',
  210. checkStrictly: true,
  211. emitPath:false}">
  212. </el-cascader>
  213. </td>
  214. </tr>
  215. <tr>
  216. <td>{{ $t('Edb.Detail.e_unit') }}</td>
  217. <td>
  218. <el-autocomplete
  219. v-model.trim="indexDetail.Unit"
  220. :fetch-suggestions="querySearchUnit"
  221. :placeholder="$t('Edb.InputHolderAll.input_unit')"
  222. suffix-icon="el-icon-arrow-down"
  223. size="mini"
  224. ></el-autocomplete>
  225. </td>
  226. </tr>
  227. <tr>
  228. <td>{{ $t('Edb.Detail.e_fre') }}</td>
  229. <td>{{indexDetail.Frequency}}</td>
  230. </tr>
  231. </table>
  232. </div>
  233. <div class="detail-data-list" ref="detailDataListRef">
  234. <table class="body-table" >
  235. <template v-if="indexDetail.DataList && indexDetail.DataList.length>0">
  236. <tr v-for="(item,index) in indexDetail.DataList" :key="index">
  237. <td>{{ item.DataTime }}</td>
  238. <td>{{ item.Value }}</td>
  239. </tr>
  240. </template>
  241. <tableNoData v-else></tableNoData>
  242. </table>
  243. </div>
  244. </div>
  245. </div>
  246. <!-- 弹窗按钮 -->
  247. <div class="dialog-btn">
  248. <el-button type="primary" plain @click="detailDiaShow=false">{{$t('Dialog.cancel_btn')}}</el-button>
  249. <el-button type="primary" @click="editDataHandle">{{$t('Dialog.confirm_btn')}}</el-button>
  250. </div>
  251. </el-dialog>
  252. <!-- 批量操作 -->
  253. <el-dialog custom-class="custom-dialog"
  254. :title="$t('HighFrequencyData.batch_operation')"
  255. :visible.sync="batchOperationDialogShow"
  256. :close-on-click-modal="false"
  257. :modal-append-to-body="false"
  258. @close="batchOperationClose"
  259. width="600px"
  260. top="5vh"
  261. v-dialogDrag
  262. >
  263. <div class="dialog-container">
  264. <div class="batch-option-row">
  265. <el-radio v-model="batchOperationData.type" :label="1">{{ $t('HighFrequencyData.move_to_new_classify') }}</el-radio>
  266. <el-cascader :options="classifyListTree" v-model="batchOperationData.newClassify"
  267. style="width: 160px;"
  268. :placeholder="$t('HighFrequencyData.select_classify_prompt')"
  269. :props="{label: 'ClassifyName',
  270. value: 'ClassifyId',
  271. children: 'Children',
  272. checkStrictly: true,
  273. emitPath:false}">
  274. </el-cascader>
  275. </div>
  276. <div class="batch-option-row">
  277. <el-radio v-model="batchOperationData.type" :label="2" style="margin-right: 10px;">{{ $t('Edb.detail_del_btn') }}</el-radio>
  278. </div>
  279. <div class="batch-option-row">
  280. <el-radio v-model="batchOperationData.type" :label="3">{{ $t('Edb.detail_refresh_btn') }}</el-radio>
  281. <div class="radio-box" v-show="batchOperationData.type==3">
  282. <el-radio v-model="batchOperationData.refreshType" :label="1">{{ $t('HighFrequencyData.last_six_hours') }}</el-radio>
  283. <el-radio v-model="batchOperationData.refreshType" :label="2">{{ $t('HighFrequencyData.refresh_all') }}</el-radio>
  284. </div>
  285. </div>
  286. </div>
  287. <!-- 弹窗按钮 -->
  288. <div class="dialog-btn">
  289. <el-button type="primary" plain @click="batchOperationDialogShow=false">{{$t('Dialog.cancel_btn')}}</el-button>
  290. <el-button type="primary" @click="batchOpeartion">{{$t('Dialog.confirm_btn')}}</el-button>
  291. </div>
  292. </el-dialog>
  293. <!-- 分类设置 -->
  294. <classifySetting :showIt.sync="classifySettingShow" @closeHandle="classifyCloseHandle" />
  295. <!-- 添加高频数据 -->
  296. <addHighFrequencyData :isAddShow.sync="addHighFrequencyShow" :unitList="unitList" :classifyList="classifyListTree" @addSuccessHandle="addHighFrequencySuccess" />
  297. <!-- 批量添加到到指标库 -->
  298. <addToIndexDatabaseBatch :isAddShow.sync="batchAddToDatabaseShow" :IndexIds="choiceIdList"/>
  299. </div>
  300. </template>
  301. <script>
  302. import {dataRefreshInterface,dataAuthInterface} from '@/api/modules/dataApi.js';
  303. import { dataInterence,highFrequencyDataInterface } from '@/api/api.js'
  304. import classifySetting from './components/highFrequency/classifySetting.vue';
  305. import addHighFrequencyData from './components/highFrequency/addHighFrequencyData.vue'
  306. import addToIndexDatabaseBatch from './components/highFrequency/addToIndexDatabaseBatch.vue';
  307. export default {
  308. name:'highFrequencyData',
  309. components:{classifySetting,addHighFrequencyData,addToIndexDatabaseBatch},
  310. data() {
  311. return {
  312. Source:'',
  313. SourceList:[],
  314. Sequence:'',
  315. SequenceList:[],
  316. classifyListTree:[],
  317. userList:[],
  318. unitList:[],
  319. searchParams:{
  320. classify:'',//分类
  321. isAssociativeSub:true,//是否关联子分类
  322. frequency:'',//频度
  323. user:'',//创建人
  324. keyWord:'',//关键字
  325. sortType:'',//升序降序
  326. sortParam:'',//排序字段
  327. pageSize:10,
  328. currentPage:1,
  329. },
  330. classifyArr:[],
  331. frequencyArr:[],
  332. userArr:[],
  333. tableData: [],
  334. tableDataIds:[],
  335. total:0,
  336. //全部全选
  337. isIndeterminate:false,
  338. isCheckAll:false,
  339. isSelectAll:false,//为true时,selectList是剔除的指标,为false时selectList是已选择的指标
  340. //已选择/已剔除的指标id
  341. selectList:[],//监听table的select-all select
  342. choiceIdList:[], //后端返回的选中的列表
  343. detailDiaShow:false,
  344. indexDetail:{},
  345. detailRequestParams:{
  346. IndexId:0,
  347. DataDate:''
  348. },
  349. classifySettingShow:false,
  350. addHighFrequencyShow:false,
  351. batchOperationDialogShow:false,
  352. batchOperationData:{
  353. type:1,
  354. newClassify:0,
  355. refreshType:1
  356. },
  357. batchAddToDatabaseShow:false,
  358. batchLoading:false
  359. };
  360. },
  361. computed:{
  362. selectedTotal(){
  363. if(this.isSelectAll){
  364. return this.total - (this.selectList ? this.selectList.length : 0)
  365. }else{
  366. return this.selectList ? this.selectList.length : 0
  367. }
  368. },
  369. frequencyList() {
  370. return [
  371. {value: "1m",label: "1m"},
  372. {value: "3m",label: '3m'},
  373. {value: "5m",label: "5m"},
  374. {value: "10m",label: "10m"},
  375. {value: "15m",label: "15m"},
  376. {value: "30m",label: "30m"},
  377. {value: "60m",label: "60m"}
  378. ];
  379. },
  380. classifyProps(){
  381. return {
  382. checkStrictly:(!this.searchParams.isAssociativeSub),
  383. value:'ClassifyId',
  384. label:'ClassifyName',
  385. children:'Children',
  386. emitPath:this.searchParams.isAssociativeSub,
  387. multiple:true
  388. }
  389. }
  390. },
  391. watch:{
  392. classifyArr(value){
  393. if(value && value.length>0){
  394. const classifyIds = [...new Set(value.join(',').split(','))]
  395. this.searchParams.classify=classifyIds.join(',')
  396. }else{
  397. this.searchParams.classify=''
  398. }
  399. },
  400. frequencyArr(value){
  401. if(value && value.length>0){
  402. this.searchParams.frequency=value.join(',')
  403. }else{
  404. this.searchParams.frequency=''
  405. }
  406. },
  407. userArr(value){
  408. if(value && value.length>0){
  409. this.searchParams.user=value.join(',')
  410. }else{
  411. this.searchParams.user=''
  412. }
  413. },
  414. },
  415. methods: {
  416. //添加高频数据
  417. addHighFrequencyDiaShow(){
  418. this.addHighFrequencyShow=true
  419. },
  420. addHighFrequencySuccess(){
  421. this.searchParams.currentPage = 1
  422. this.getTableData()
  423. },
  424. //获取数据源列表
  425. getSourceList(){
  426. this.SourceList=[{Source: 1,SourceName: "同花顺",SourceNameEn: "同花顺"}]
  427. this.Source = this.SourceList[0].Source
  428. },
  429. getSequenceList(){
  430. this.SequenceList=[{Sequence: 1,SequenceName: "高频序列",SequenceNameEn: "高频序列"}]
  431. this.Sequence = this.SequenceList[0].Sequence
  432. },
  433. //数据源改变
  434. handleSourceChange(){
  435. },
  436. // 序列改变
  437. handleSequenceChange(){
  438. },
  439. //获取分类列表
  440. async getClassifyList(){
  441. const res = await highFrequencyDataInterface.classifyListTree()
  442. if(res.Ret!==200) return
  443. this.classifyListTree = res.Data||[]
  444. },
  445. //获取用户列表
  446. getUserList() {
  447. dataAuthInterface.userSearch({
  448. KeyWord: ''
  449. }).then(res => {
  450. if(res.Ret !== 200) return
  451. this.userList = res.Data||[]
  452. })
  453. },
  454. // 获取指标单位
  455. async getUnitList(){
  456. let res=await dataInterence.getTargetUnitList()
  457. if(res.Ret===200){
  458. this.unitList=res.Data&&res.Data.map(item=>{
  459. return {value:item}
  460. })
  461. }
  462. },
  463. //搜索单位
  464. querySearchUnit(queryString, cb){
  465. let results = queryString ? this.unitList.filter(item=>item.value.indexOf(queryString) === 0) : this.unitList;
  466. // 调用 callback 返回建议列表的数据
  467. cb(results);
  468. },
  469. changeAssociativeSub(value){
  470. // 清空
  471. this.classifyArr=[]
  472. this.searchListDelay()
  473. },
  474. searchListDelay(){
  475. setTimeout(()=>{
  476. this.searchList()
  477. },0)
  478. },
  479. //表格筛选项改变时触发
  480. searchList(){
  481. this.searchParams.currentPage = 1
  482. this.getTableData('search')
  483. },
  484. handleCurrentChange(page){
  485. this.searchParams.currentPage = page
  486. this.getTableData()
  487. },
  488. async getTableData(type){
  489. const {frequency,user,classify,keyWord,sortParam,sortType,currentPage,pageSize,isAssociativeSub} = this.searchParams
  490. let params={
  491. ClassifyId:classify,
  492. IncludeChild:isAssociativeSub,
  493. SysAdminId:user,
  494. Frequency:frequency,
  495. Keywords:keyWord,
  496. SortField:sortParam,
  497. SortType:sortType,
  498. PageSize:Number(pageSize) || 10,
  499. CurrentIndex:Number(currentPage)||1
  500. }
  501. // console.log(params,'params');
  502. const res = await highFrequencyDataInterface.getTableDataApi(params)
  503. if(res.Ret!==200) return
  504. const {Paging,List} = res.Data||{}
  505. this.tableData = List||[]
  506. if(this.tableData.length === 0 && this.searchParams.currentPage>1 && Paging.Pages){
  507. // 最后一页的最后一个被删除了 当前页码没数据 去最后一页 非要改
  508. this.searchParams.currentPage > Paging.Pages ?
  509. (this.searchParams.currentPage = Paging.Pages || 1) :
  510. (this.searchParams.currentPage--)
  511. this.getTableData(type)
  512. return
  513. }
  514. this.total = Paging.Totals||0
  515. if(this.tableData.length>0){
  516. this.tableDataIds = this.tableData.map(it => it.IndexId)
  517. }else{
  518. this.tableDataIds = []
  519. }
  520. if(type==='search'){
  521. //如果是表格筛选项改变导致重新请求数据
  522. //清除所选
  523. this.selectList = []
  524. this.listCheckAllChange(false)
  525. }else{
  526. //若不是,数据获取完成后,查询列表全选的值
  527. //若当页有数据在selectList内,则勾选/剔除
  528. this.adjustSelection()
  529. }
  530. },
  531. //勾选/取消勾选表格项
  532. adjustSelection(){
  533. if(!this.isSelectAll){
  534. this.tableData.map(it =>{
  535. let row = this.selectList.includes(it.IndexId)?it:''
  536. if(row){
  537. this.$nextTick(()=>{
  538. this.$refs.edbDataRef.toggleRowSelection(row,true)
  539. })
  540. }
  541. })
  542. }else{
  543. this.tableData.map(it =>{
  544. let row = this.selectList.includes(it.IndexId)?'':it
  545. if(row){
  546. this.$nextTick(()=>{
  547. this.$refs.edbDataRef.toggleRowSelection(row,true)
  548. })
  549. }
  550. })
  551. }
  552. },
  553. //列表全选改变
  554. listCheckAllChange(value){
  555. this.selectList = []
  556. this.isSelectAll = value
  557. this.$refs.edbDataRef && this.$refs.edbDataRef.clearSelection()
  558. if(value){
  559. this.$refs.edbDataRef && this.$refs.edbDataRef.toggleAllSelection()
  560. }
  561. },
  562. selectionChange(selection){
  563. // selectAllHandle的触发在selectionChange后面,将selectionChange的逻辑延迟一下
  564. setTimeout(()=>{
  565. // 去重
  566. let duplicateArr = Array.from(new Set(this.selectList))
  567. //isSelectAll为true时,selectList表示需要剔除的项
  568. //isSelectAll为false时,selectList表示需要勾选的项
  569. //全选
  570. if((duplicateArr.length == this.total && (!this.isSelectAll))|| (duplicateArr.length == 0 && this.isSelectAll)){
  571. this.isCheckAll = true
  572. this.isIndeterminate=false
  573. //全不选
  574. }else if((duplicateArr.length == 0 && (!this.isSelectAll))|| (duplicateArr.length == this.total && this.isSelectAll)){
  575. this.isCheckAll = false
  576. this.isIndeterminate=false
  577. //半选
  578. }else{
  579. this.isCheckAll = false
  580. this.isIndeterminate=true
  581. }
  582. },1)
  583. },
  584. selectHandle(selection,row){
  585. let check = false;
  586. if(selection.some(it => it.IndexId == row.IndexId)){
  587. // 勾选
  588. if(this.isSelectAll){
  589. check=false
  590. }else{
  591. check=true
  592. }
  593. }else{
  594. // 取消勾选
  595. if(this.isSelectAll){
  596. check=true
  597. }else{
  598. check=false
  599. }
  600. }
  601. if(check){
  602. this.selectList.push(row.IndexId)
  603. }else{
  604. this.selectList=this.selectList.filter(it => it!=row.IndexId)
  605. }
  606. },
  607. selectAllHandle(selection){
  608. let check = false;
  609. if(selection && selection.length>0){
  610. // 全选
  611. if(this.isSelectAll){
  612. check=false
  613. }else{
  614. check=true
  615. }
  616. }else{
  617. // 全不选
  618. if(this.isSelectAll){
  619. check=true
  620. }else{
  621. check=false
  622. }
  623. }
  624. if(check){
  625. this.selectList = [...this.selectList,...this.tableDataIds]
  626. }else{
  627. this.selectList = this.selectList.filter(it => !this.tableDataIds.includes(it))
  628. }
  629. },
  630. handleSortChange({prop,order}){
  631. let propMap = new Map([
  632. ["StartDate",1],
  633. ["EndDate",2],
  634. ["ModifyTime",3],
  635. ["LatestValue",4]
  636. ])
  637. if(order){
  638. this.searchParams.sortParam = propMap.get(prop)
  639. this.searchParams.sortType = order==='ascending'?1:2
  640. }else{
  641. this.searchParams.sortParam = ''
  642. this.searchParams.sortType = ''
  643. }
  644. this.searchList()
  645. },
  646. // 详情
  647. async detailIndexHandle(row){
  648. this.detailRequestParams.IndexId = row.IndexId
  649. this.detailRequestParams.DataDate = ''
  650. await this.getIndexDetailFun()
  651. this.detailDiaShow=true
  652. this.$nextTick(()=>{
  653. this.$refs.detailDataListRef && (this.$refs.detailDataListRef.scrollTop=0)
  654. })
  655. },
  656. async getIndexDetailFun(){
  657. await highFrequencyDataInterface.highFreDataDetail(this.detailRequestParams).then(res=>{
  658. if(res.Ret == 200){
  659. let resData = res.Data||{}
  660. let indexData = resData.Index || {}
  661. this.detailRequestParams.DataDate = resData.DataDate
  662. this.indexDetail={
  663. IndexId:indexData.IndexId,
  664. IndexName:indexData.IndexName,
  665. ZqCode:indexData.StockCode,
  666. ZbCode:indexData.Indicator,
  667. ClassifyId:indexData.ClassifyId,
  668. Unit:indexData.Unit,
  669. Frequency:indexData.Frequency,
  670. DataList:resData.DataList||[]
  671. }
  672. }
  673. })
  674. },
  675. editDataHandle(){
  676. if(!(this.indexDetail.IndexName && this.indexDetail.ClassifyId && this.indexDetail.Unit)){
  677. return this.$message.warning(this.$t('MsgPrompt.please_complete'))
  678. }
  679. let params={
  680. IndexId:this.indexDetail.IndexId,
  681. IndexName:this.indexDetail.IndexName,
  682. ClassifyId:this.indexDetail.ClassifyId,
  683. Unit:this.indexDetail.Unit,
  684. }
  685. highFrequencyDataInterface.highFreDataEdit(params).then(res=>{
  686. if(res.Ret == 200){
  687. this.$message.success(this.$t('MsgPrompt.operate_success_msg'))
  688. this.detailDiaShow=false
  689. this.getTableData()
  690. }
  691. })
  692. },
  693. // 刷新
  694. refreshIndexHandle(row){
  695. highFrequencyDataInterface.highFreDataRefresh({
  696. IndexId:row.IndexId
  697. }).then(res=>{
  698. if(res.Ret!==200) return
  699. this.$message.success(/* "刷新成功" */this.$t('MsgPrompt.refresh_success_msg'))
  700. this.getTableData()
  701. })
  702. },
  703. // 删除
  704. deleteIndexHandle(row){
  705. this.$confirm(this.$t('Edb.MsgPrompt.del_edb_confirm'),this.$t('Dialog.warn_tit'),{
  706. confirmButtonText:/* "确定" */this.$t('Dialog.confirm_btn'),
  707. cancelButtonText:/* "取消" */this.$t('Dialog.cancel_btn'),
  708. type:"warning"
  709. }).then(()=>{
  710. highFrequencyDataInterface.highFreDataDelete({
  711. IndexId:row.IndexId
  712. }).then(res=>{
  713. if(res.Ret!==200) return
  714. this.$message.success(/* "删除成功" */this.$t('MsgPrompt.delete_msg'))
  715. this.selectList=this.selectList.filter(it => it!=row.IndexId)
  716. this.getTableData()
  717. })
  718. }).catch(()=>{})
  719. },
  720. setClassify(){
  721. this.classifySettingShow=true
  722. },
  723. classifyCloseHandle({requestClassifyList,requestDataList}){
  724. if(requestDataList) this.getTableData('search')
  725. if(requestClassifyList) this.getClassifyList()
  726. this.classifySettingShow=false
  727. },
  728. async openBatchOperationDia(){
  729. if(this.selectedTotal>500){
  730. return this.$message.warning(this.$t('HighFrequencyData.batch_operation_limit'))
  731. }
  732. this.batchLoading = true
  733. let flag = await this.getHighFreDataChoiceList()
  734. this.batchLoading = false
  735. this.batchOperationDialogShow=!!flag
  736. },
  737. async getHighFreDataChoiceList(){
  738. let params={
  739. ClassifyId:this.searchParams.classify,
  740. IncludeChild:this.searchParams.isAssociativeSub,
  741. Frequency:this.searchParams.frequency,
  742. SysAdminId:this.searchParams.user,
  743. Keywords:this.searchParams.keyWord,
  744. ListIds:this.selectList.join(','),
  745. SelectAll:this.isSelectAll,
  746. }
  747. return await highFrequencyDataInterface.highFreDataChoice(params).then(res=>{
  748. if(res.Ret == 200){
  749. const choiceList = res.Data || []
  750. this.choiceIdList=choiceList.map(cl=> cl.IndexId)
  751. return true
  752. }else{
  753. return false
  754. }
  755. })
  756. },
  757. batchOperationClose(){
  758. this.batchOperationDialogShow=false
  759. this.batchOperationData={
  760. type:1,
  761. newClassify:0,
  762. refreshType:1
  763. }
  764. },
  765. batchOpeartion(){
  766. if(this.batchOperationData.type==1 && !this.batchOperationData.newClassify) return this.$message.warning(this.$t('HighFrequencyData.select_classify_prompt'))
  767. let params={
  768. IndexIds:this.choiceIdList,
  769. OptType:this.batchOperationData.type,
  770. MoveClassifyId:this.batchOperationData.newClassify,
  771. RefreshType:this.batchOperationData.refreshType
  772. }
  773. highFrequencyDataInterface.highFreDataBatchOperation(params).then(res=>{
  774. if(res.Ret == 200){
  775. if(this.batchOperationData.type==2){
  776. // 批量删除
  777. let deleteFails=res.Data.Fail || []
  778. let deleteSuccess=res.Data.Success || []
  779. if(deleteSuccess.length) this.$message.success(this.$t('MsgPrompt.operate_success_msg'))
  780. if(deleteFails){
  781. let message = '';
  782. deleteFails.forEach(item => {
  783. message+=`${item.IndexName}:${this.$t('HighFrequencyData.indicator_been_referenced_prompt')}</br>`
  784. })
  785. // 和成功提示错开
  786. this.$nextTick(()=>{
  787. this.$message({
  788. dangerouslyUseHTMLString: true,
  789. message,
  790. type: 'error'
  791. })
  792. })
  793. }
  794. // 删除之后 调整选中
  795. this.listCheckAllChange(false)
  796. }else{
  797. this.$message.success(this.$t('MsgPrompt.operate_success_msg'))
  798. }
  799. this.getTableData()
  800. this.batchOperationDialogShow=false
  801. }
  802. })
  803. },
  804. async batchAddToDatabaseOpen(){
  805. if(this.selectedTotal>500){
  806. return this.$message.warning(this.$t('HighFrequencyData.batch_operation_limit'))
  807. }
  808. this.batchLoading = true
  809. let flag = await this.getHighFreDataChoiceList()
  810. this.batchLoading = false
  811. this.batchAddToDatabaseShow=!!flag
  812. }
  813. },
  814. mounted(){
  815. this.getSourceList()
  816. this.getSequenceList()
  817. this.getClassifyList()
  818. this.getUserList()
  819. this.getUnitList()
  820. this.getTableData()
  821. }
  822. }
  823. </script>
  824. <style scoped lang="scss">
  825. .hight-frequency-data-container{
  826. min-height: calc(100vh - 120px);
  827. display: flex;
  828. flex-direction: column;
  829. .top-box{
  830. box-sizing: border-box;
  831. margin-bottom: 16px;
  832. display: flex;
  833. .select-box{
  834. span{
  835. margin-right:10px;
  836. }
  837. .el-select{
  838. margin-right:10px;
  839. width:160px;
  840. }
  841. }
  842. }
  843. .table-box{
  844. flex:1;
  845. .el-select{
  846. min-width:180px;
  847. }
  848. .table-select{
  849. display: flex;
  850. justify-content: space-between;
  851. .select-list{
  852. flex:1;
  853. display: flex;
  854. flex-wrap: wrap;
  855. gap:10px;
  856. .el-select,.el-cascader,.el-input{
  857. max-width: 210px;
  858. }
  859. .associative-box{
  860. display: flex;
  861. align-items: center;
  862. gap: 10px;
  863. color: #333333;
  864. .span-button{
  865. color:#0052D9 ;
  866. cursor: pointer;
  867. }
  868. }
  869. }
  870. .select-other{
  871. margin-left: 10px;
  872. .el-button{
  873. margin-left:10px;
  874. }
  875. }
  876. }
  877. .el-table{
  878. margin:20px 0;
  879. }
  880. .el-pagination{
  881. text-align: right;
  882. background-color: white;
  883. padding: 10px 0;
  884. }
  885. .table-operation-item{
  886. padding: 0 3px;
  887. cursor: pointer;
  888. color: #0052D9;
  889. white-space: nowrap;
  890. }
  891. .del-item{
  892. color: #D54941;
  893. }
  894. }
  895. .custom-dialog{
  896. .dialog-container{
  897. overflow: hidden;
  898. padding: 0 35px;
  899. .detail-date-select-zone{
  900. display:flex;
  901. margin-bottom: 30px;
  902. align-items:center;
  903. span{
  904. margin-right: 20px;
  905. }
  906. .el-input{
  907. width: 240px;
  908. }
  909. }
  910. .detail-data-zone{
  911. display: flex;
  912. flex-direction: column;
  913. justify-content: center;
  914. .detail-data-zone-header{
  915. display: flex;
  916. align-items: center;
  917. justify-content: space-between;
  918. .header-table{
  919. font-size: 14px;
  920. border:solid 1px #C8CDD9;
  921. box-sizing: border-box;
  922. tr{
  923. box-sizing: border-box;
  924. td{
  925. padding: 10px;
  926. width: 270px;
  927. color: #666666;
  928. box-sizing: border-box;
  929. &:first-child{
  930. width: 150px;
  931. text-align: center;
  932. font-weight: bold;
  933. color: #333333;
  934. }
  935. }
  936. }
  937. }
  938. }
  939. .detail-data-list{
  940. height: 260px;
  941. overflow: auto;
  942. margin: 40px auto 30px auto;
  943. .body-table{
  944. border-left: solid 1px #C8CDD9;
  945. border-right: solid 1px #C8CDD9;
  946. tr{
  947. box-sizing: border-box;
  948. td{
  949. min-width: 150px;
  950. text-align: center;
  951. padding: 8px 10px;
  952. color: #666666;
  953. box-sizing: border-box;
  954. &:first-child{
  955. width: 260px;
  956. border-right:solid 1px #C8CDD9;
  957. }
  958. }
  959. }
  960. }
  961. }
  962. }
  963. // 批量操作
  964. .batch-option-row{
  965. margin-bottom: 20px;
  966. .radio-box{
  967. margin-top: 20px;
  968. padding-left: 50px;
  969. .el-radio{
  970. margin-right: 20px;
  971. }
  972. }
  973. }
  974. }
  975. .dialog-btn{
  976. text-align: center;
  977. padding: 40px 0 25px;
  978. .el-button{
  979. min-width: 120px;
  980. }
  981. }
  982. }
  983. }
  984. </style>
  985. <style lang="scss">
  986. .custom-dialog{
  987. .el-input{
  988. width: 100%!important;
  989. }
  990. }
  991. .detail-data-zone-header{
  992. .el-cascader{
  993. width: 100%;
  994. }
  995. .el-autocomplete{
  996. width: 100%;
  997. }
  998. .el-select{
  999. width: 100%;
  1000. }
  1001. .el-input{
  1002. width: 100%;
  1003. input{
  1004. border: none;
  1005. padding: 0;
  1006. font-size: 14px;
  1007. }
  1008. }
  1009. }
  1010. </style>