addLInkDia.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867
  1. <template>
  2. <div>
  3. <el-dialog v-dialogDrag :modal-append-to-body='false' :title="$t('SandboxManage.SandFlow.add_node_data')" :visible.sync="show"
  4. :close-on-click-modal="false" width="1000px" top="5vh" @close="cancelHandle" v-show="!dialogDisplayNone">
  5. <div class="add-link-box">
  6. <div class="link-box-option">
  7. <el-select v-model="addLinkSearchParams.linkType" placeholder="节点数据类型" style="width: 240px;" @change="changeLinkType">
  8. <el-option :label="item.label" :value="item.value" v-for="item in linkTypeList" :key="item.value"></el-option>
  9. </el-select>
  10. <el-select v-if="addLinkSearchParams.linkType==1"
  11. v-model="search_dataBaseId"
  12. v-loadMore="dataBaseSearchLoad"
  13. ref="searchRef"
  14. :filterable="!search_dataBaseId"
  15. remote
  16. clearable
  17. :placeholder="$t('SandboxManage.SandFlow.add_link_search_placeholder')"
  18. style="width: 240px"
  19. :remote-method="dataBaseSearch"
  20. @click.native="dataBaseInputFocus"
  21. >
  22. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  23. <el-option
  24. v-for="item in dataBaseOptions"
  25. :key="item.EdbInfoId"
  26. :label="currentLang==='en'?(item.EdbNameEn||item.EdbName):item.EdbName"
  27. :value="item.EdbInfoId"
  28. :disabled="!item.HaveOperaAuth"
  29. >
  30. <div>
  31. <img
  32. :src="$icons.lock_ico2"
  33. width="18"
  34. height="18"
  35. style="vertical-align:middle"
  36. v-if="!item.HaveOperaAuth"
  37. />
  38. {{currentLang==='en'?(item.EdbNameEn||item.EdbName):item.EdbName}}
  39. </div>
  40. </el-option>
  41. </el-select>
  42. <el-select v-else-if="addLinkSearchParams.linkType==2"
  43. v-model="search_dataBaseId"
  44. v-loadMore="dataBaseSearchLoad"
  45. ref="searchRef"
  46. :filterable="!search_dataBaseId"
  47. remote
  48. clearable
  49. :placeholder="$t('Chart.Detail.chart_name')"
  50. style="width: 240px"
  51. :remote-method="dataBaseSearch"
  52. @click.native="dataBaseInputFocus"
  53. >
  54. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  55. <el-option
  56. v-for="item in dataBaseOptions"
  57. :key="item.ChartInfoId"
  58. :label="currentLang==='en'?(item.ChartNameEn||item.ChartName):item.ChartName"
  59. :value="item.ChartInfoId"
  60. :disabled="!item.HaveOperaAuth"
  61. >
  62. <div>
  63. <img
  64. :src="$icons.lock_ico2"
  65. width="18"
  66. height="18"
  67. style="vertical-align:middle"
  68. v-if="!item.HaveOperaAuth"
  69. />
  70. {{currentLang==='en'?(item.ChartNameEn||item.ChartName):item.ChartName}}
  71. </div>
  72. </el-option>
  73. </el-select>
  74. <el-input v-else v-model="reportKeyWord" @input="searchReport"
  75. :placeholder="$t('ReportManage.smart_title_creator_btn')" style="width: 240px;" clearable >
  76. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  77. </el-input>
  78. </div>
  79. <div class="link-box-tags">
  80. <div class="link-box-tag"
  81. v-for="(item,index) in linkListInShow"
  82. :key="item.RId"
  83. :class="{'unchoose-tag':item.Id != activeItem.Id,'choosed-tag':item.Id == activeItem.Id}">
  84. <span @dblclick.stop="editLinkName(item)"
  85. v-if="!item.editing"
  86. @click="linkClick(item)"
  87. :style="{color:item.Id == activeItem.Id?'#0052D9':'#666666'}">{{ item.Name }}</span>
  88. <el-input v-else @blur="editLinkNameFinish(item)"
  89. v-model.trim="editingLabel" class="label-edit-input" ref="labelEditInput"/>
  90. <img src="~@/assets/img/sand_new/delete_outline_1.png" @click="linkDelete(item,index)">
  91. </div>
  92. </div>
  93. <div class="link-box-content">
  94. <!-- 指标 -->
  95. <div class="link-content-dataIndex" v-if="addLinkSearchParams.linkType==1 && databaseTableData && databaseTableData.length>0">
  96. <template v-if="databaseTableData[0].HaveOperaAuth">
  97. <el-table :data="databaseTableData" border style="box-shadow: rgba(155, 170, 219, 0.2) 0px 3px 6px;">
  98. <el-table-column :label="$t('Table.edb_id')" align="center">
  99. <template slot-scope="scope">{{ scope.row.EdbCode }}</template>
  100. </el-table-column>
  101. <el-table-column :label="$t('Table.edb_name')" align="center" width="200">
  102. <template slot-scope="scope">{{ currentLang==='en'?(scope.row.EdbNameEn||scope.row.EdbName):scope.row.EdbName }}</template>
  103. </el-table-column>
  104. <el-table-column :label="$t('Table.frequency')" align="center" width="50">
  105. <template slot-scope="scope">{{ getFrequencyTrans(scope.row.Frequency||'null') }}</template>
  106. </el-table-column>
  107. <el-table-column :label="$t('Table.unit')" align="center" width="100">
  108. <template slot-scope="scope">{{ currentLang==='en'?(scope.row.UnitEn||getUnitTrans(scope.row.Unit)):getUnitTrans(scope.row.Unit) }}</template>
  109. </el-table-column>
  110. <el-table-column :label="$t('Edb.Detail.e_latest_value')" align="center" width="100">
  111. <template slot-scope="scope">{{ scope.row.LatestValue }}</template>
  112. </el-table-column>
  113. <el-table-column :label="$t('Edb.Detail.e_latest_date')" align="center" width="130">
  114. <template slot-scope="scope">{{ scope.row.LatestDate }}</template>
  115. </el-table-column>
  116. <el-table-column :label="$t('Table.source')" align="center">
  117. <template slot-scope="scope">{{ scope.row.SourceName }}</template>
  118. </el-table-column>
  119. </el-table>
  120. <ul class="link-count-wrap">
  121. <li v-for="item in calculateOption"
  122. :key="item.source"
  123. class="link-count-item"
  124. :class="{'link-count-item-un':!handleCountChoose(item),'link-count-item-on':handleCountChoose(item)}"
  125. @click="clickCountItem(item)">
  126. <span>{{ item.label }}</span>
  127. <img v-if="handleCountChoose(item) && item.source != 98 && item.source != 99"
  128. src="~@/assets/img/sand_new/blue_edit_icon.png"
  129. style="width: 13px;height: 13px;margin-left: 8px;"
  130. @click.stop="handleEditCal(item)">
  131. </li>
  132. </ul>
  133. <div v-if="threeCalculation && threeCalculation.length > 0" class="calculate-result-wrap">
  134. <div class="calculate-result-title">{{ $t('ETableChildren.calculate_result') }}</div>
  135. <div class="calculate-result-table">
  136. <div v-for="(item,index) in threeCalculation" :key="index" class="calculate-result-table-tr">
  137. <div v-for="(v) in item" :key="v.source" class="calculate-result-table-item">{{ v.label }}:{{ v.value }}</div>
  138. </div>
  139. </div>
  140. </div>
  141. </template>
  142. <noDataAuth v-if="databaseTableData[0].HaveOperaAuth===false" :text="$t('MsgPrompt.no_edb_auth')"/>
  143. </div>
  144. <div class="link-content-chartIndex" v-else-if="addLinkSearchParams.linkType==2 && this.chartInfo && this.chartInfo.ChartInfoId">
  145. <template v-if="chartInfo.HaveOperaAuth">
  146. <div class="chart-name">{{ currentLang==='en'?(chartInfo.ChartNameEn||chartInfo.ChartName):chartInfo.ChartName }}</div>
  147. <Chart :options="options" :chartInfo="chartInfo" ref="chartRef" />
  148. </template>
  149. <noDataAuth v-if="chartInfo.HaveOperaAuth===false" :text="$t('MsgPrompt.no_chart_auth')"/>
  150. </div>
  151. <div class="link-content-dataIndex" v-else-if="addLinkSearchParams.linkType==3 && this.reportList.length>0">
  152. <el-table :data="this.reportList" border style="margin-bottom: 10px;" ref="reportTable"
  153. @select="reportSelect" @select-all="reportSelect">
  154. <el-table-column type="selection" width="40" align="center"></el-table-column>
  155. <el-table-column :label="$t('Table.report_title')" align="center" show-overflow-tooltip>
  156. <template slot-scope="scope">
  157. <span >{{ scope.row.Title }}</span>
  158. <span v-if="scope.row.MsgSendTime">
  159. ({{ scope.row.MsgSendTime.substring(5, 7)}}{{ scope.row.MsgSendTime.substring(8, 10) }})
  160. </span>
  161. <span v-else-if="scope.row.PublishTime">
  162. ({{ scope.row.PublishTime.substring(5, 7)}}{{ scope.row.PublishTime.substring(8, 10) }})
  163. </span>
  164. <span v-else-if="scope.row.CreateTime">
  165. ({{ scope.row.CreateTime.substring(5, 7)}}{{ scope.row.CreateTime.substring(8, 10) }})
  166. </span>
  167. </template>
  168. </el-table-column >
  169. <el-table-column :label="$t('Table.publish_time')" align="center">
  170. <template slot-scope="scope">
  171. <span>{{scope.row.PrePublishTime?scope.row.PrePublishTime:scope.row.PublishTime}}</span>
  172. </template>
  173. </el-table-column>
  174. </el-table>
  175. <m-page :page_no="reportParams.CurrentIndex" :pageSize="5" :total="reportTotal" @handleCurrentChange="pageChange"/>
  176. </div>
  177. <tableNoData :text="$t('Table.prompt_slogan')" v-else/>
  178. </div>
  179. <div class="link-box-buttons">
  180. <el-button type="info" style="width:120px;color:#333333;background-color:#F4F8FE" @click="cancelHandle">{{$t('Dialog.cancel_btn')}}</el-button>
  181. <el-button type="primary" style="width:120px;margin-left: 30px;" @click="saveLink">{{$t('Dialog.confirm_btn')}}</el-button>
  182. </div>
  183. </div>
  184. </el-dialog>
  185. <calculateEdb
  186. :isShow.sync="isOpenCalculationDia"
  187. :calculationItem="calculationItem"
  188. :activeLink="activeItem"
  189. :linkList="linkListInShow"
  190. @editEdbName="handleEditEdbName"
  191. @addEdbItem="handleAddEdbItem"
  192. @changeActiveEdb="handleChangeActiveEdb"
  193. @edbDelete="handleEdbDelete"
  194. @addCalculation="handleAddCalculation"
  195. @handleCloseDialog="handleCloseDialog"
  196. ></calculateEdb>
  197. </div>
  198. </template>
  199. <script>
  200. import { chartSetMixin } from '../../../dataEntry_manage/mixins/chartPublic'
  201. import * as sheetInterface from "@/api/modules/sheetApi.js";
  202. import mPage from "@/components/mPage.vue";
  203. import Chart from '../../../dataEntry_manage/components/chart.vue'
  204. import calculateEdb from './calculateEdb.vue';
  205. import { dataBaseInterface,reportlist} from '@/api/api.js';
  206. import * as preDictEdbInterface from '@/api/modules/predictEdbApi.js';
  207. import { calculateOption } from "../../common/options"
  208. export default {
  209. components:{
  210. mPage,Chart,calculateEdb
  211. },
  212. props:{
  213. show:{
  214. reuqired:true,
  215. type:Boolean
  216. },
  217. linkList:{
  218. type:Array,
  219. default:()=>[]
  220. }
  221. },
  222. mixins:[chartSetMixin],
  223. watch:{
  224. /* 选中搜索指标 展开目录 选中指标 展示数据 */
  225. search_dataBaseId(newval) {
  226. if (newval) {
  227. if(this.linkListInShow.find(_=>_.Id == newval)){
  228. return this.$message.warning(this.$t('SandboxManage.SandFlow.data_already_exists'))
  229. }
  230. if(this.addLinkSearchParams.linkType==1){
  231. let search_obj = this.dataBaseOptions.find(
  232. (item) => item.EdbInfoId === newval
  233. );
  234. if(search_obj){
  235. this.activeItem = {
  236. RId:this.addLinkSearchParams.linkType+'-'+search_obj.EdbInfoId,
  237. Id:search_obj.EdbInfoId,
  238. Name:this.currentLang==='en'?(search_obj.EdbNameEn||search_obj.EdbName):search_obj.EdbName,
  239. Type:this.addLinkSearchParams.linkType,
  240. editing:false,
  241. databaseType:search_obj.EdbInfoType, //0 普通指标 | 1 预测指标
  242. // EdbType:search_obj.EdbType || 0,
  243. detailParams:{
  244. code:search_obj.UniqueCode,
  245. id:search_obj.EdbInfoId,
  246. classifyId:search_obj.ClassifyId
  247. },
  248. calculationMethod:[],
  249. }
  250. this.checkedLinkList.push(this.activeItem)
  251. this.handleLinkListInShow()
  252. this.activeItemRId=this.addLinkSearchParams.linkType+'-'+search_obj.EdbInfoId
  253. this.initGetData()
  254. }
  255. }else{
  256. let search_obj = this.dataBaseOptions.find(
  257. (item) => item.ChartInfoId === newval
  258. );
  259. if(search_obj){
  260. this.activeItem = {
  261. RId:this.addLinkSearchParams.linkType+'-'+search_obj.ChartInfoId,
  262. Id:search_obj.ChartInfoId,
  263. Name: this.currentLang==='en'?(search_obj.ChartNameEn||search_obj.ChartName):search_obj.ChartName,
  264. Type:this.addLinkSearchParams.linkType,
  265. editing:false,
  266. detailParams:{
  267. code:search_obj.UniqueCode,
  268. id:search_obj.ChartInfoId
  269. },
  270. calculationMethod:[],
  271. }
  272. this.checkedLinkList.push(this.activeItem)
  273. this.handleLinkListInShow()
  274. this.activeItemRId=this.addLinkSearchParams.linkType+'-'+search_obj.ChartInfoId
  275. this.getChartDetail(search_obj.ChartInfoId)
  276. }
  277. }
  278. }
  279. },
  280. edbData: {
  281. handler(newval, oldval) {
  282. newval.length && !this.chartInfo.WarnMsg && this.setChartOptionHandle(newval);
  283. },
  284. deep: true,
  285. },
  286. show(value){
  287. if(value){
  288. this.isOpenCalculationDia = false;
  289. this.checkedLinkList = JSON.parse(JSON.stringify(this.linkList.map(_=>({calculationMethod:[],..._}))))
  290. this.handleLinkListInShow()
  291. let firstCheckedLink = this.checkedLinkList[0]
  292. if(firstCheckedLink){
  293. this.addLinkSearchParams.linkType = firstCheckedLink.Type;
  294. this.activeItemRId='';
  295. this.linkClick(firstCheckedLink)
  296. }else{
  297. this.addLinkSearchParams.linkType=1
  298. }
  299. this.doDataInit()
  300. }
  301. },
  302. activeItem:{
  303. deep:true,
  304. handler(){
  305. this.handleThreeCalculation()
  306. }
  307. },
  308. },
  309. computed:{
  310. linkTypeList(){
  311. return [
  312. {value:1,label:this.$t('SandboxManage.SandFlow.link_type_opt1')},
  313. {value:2,label:this.$t('SandboxManage.SandFlow.link_type_opt2')},
  314. {value:3,label:this.$t('SandboxManage.SandFlow.link_type_opt3')}
  315. ]
  316. },
  317. calculateOption(){
  318. return calculateOption
  319. },
  320. },
  321. data() {
  322. return {
  323. /* linkTypeList:[
  324. {value:1,label:this.$t('SandboxManage.SandFlow.link_type_opt1')},
  325. {value:2,label:this.$t('SandboxManage.SandFlow.link_type_opt2')},
  326. {value:3,label:this.$t('SandboxManage.SandFlow.link_type_opt3')}
  327. ], */
  328. addLinkSearchParams:{
  329. linkType:1
  330. },
  331. //添加链接:指标
  332. search_dataBaseId:'',
  333. dataBaseParams:{
  334. pages:1,
  335. searchText:'',
  336. search_have_more:false
  337. },
  338. dataBaseOptions:[],
  339. databaseTableData:[],
  340. databaseList:[],
  341. databaseHaveMore:false,
  342. databasePageNo:1,
  343. chartInfo:{},
  344. edbData:[],
  345. options:{},
  346. reportKeyWord:'',
  347. reportParams:{
  348. CurrentIndex:1,
  349. PageSize:5,
  350. },
  351. reportList:[],
  352. selections:[],
  353. checkedLinkList:[],
  354. linkListInShow:[],//当前种类下的标签
  355. reportTotal:0,
  356. editingLabel:'',
  357. activeItemRId:'',
  358. activeItem:'',
  359. threeCalculation:[],//三个一组
  360. isOpenCalculationDia:false,
  361. calculationItem:{},
  362. dialogDisplayNone:false,
  363. }
  364. },
  365. methods: {
  366. handleThreeCalculation(){
  367. let i = this.checkedLinkList.findIndex(_=>_.RId == this.activeItem.RId);
  368. if(i < 0) return;
  369. if(!this.checkedLinkList[i].calculationMethod) this.checkedLinkList[i].calculationMethod = [];
  370. let data = this.checkedLinkList[i].calculationMethod || [];
  371. let arr = [];
  372. if(data && data.length > 0) {
  373. for(var x=0;x<data.length;x+=3){
  374. arr.push(data.slice(x,x+3));
  375. }
  376. }
  377. this.threeCalculation = arr || [];
  378. },
  379. handleCountChoose(item){
  380. let i = this.checkedLinkList.findIndex(_=>_.RId == this.activeItem.RId);
  381. if(i < 0) return false;
  382. let arr = this.checkedLinkList[i].calculationMethod || [];
  383. return arr.find(_=>_.source == item.source || _.source == item.source2);
  384. },
  385. handleEditCal(v){ //编辑状态
  386. this.calculationItem = v;
  387. this.isOpenCalculationDia = true;
  388. this.dialogDisplayNone = true;
  389. },
  390. clickCountItem(item){
  391. let i = this.checkedLinkList.findIndex(_=>_.RId == this.activeItem.RId);
  392. if(i < 0) return;
  393. if(!this.checkedLinkList[i].calculationMethod) this.checkedLinkList[i].calculationMethod = [];
  394. let isChoosed = this.checkedLinkList[i].calculationMethod.findIndex(_=>_.source == item.source || _.source == item.source2);
  395. if(isChoosed >= 0){ //已经选中
  396. this.checkedLinkList[i].calculationMethod.splice(isChoosed,1)
  397. } else { //未选中
  398. if(item.source == 99 || item.source == 98){ //最新值和最新日期
  399. this.checkedLinkList[i].calculationMethod.unshift({
  400. ...item,
  401. value:item.source == 99 ? this.databaseTableData[0].LatestValue : this.databaseTableData[0].LatestDate
  402. })
  403. } else {
  404. this.calculationItem = item;
  405. this.isOpenCalculationDia = true;
  406. this.dialogDisplayNone = true;
  407. }
  408. };
  409. this.handleThreeCalculation();
  410. },
  411. handleAddCalculation({item}){
  412. let i = this.checkedLinkList.findIndex(_=>_.RId == this.activeItem.RId);
  413. if(i < 0) return;
  414. if(!this.checkedLinkList[i].calculationMethod) this.checkedLinkList[i].calculationMethod = [];
  415. let x = this.calculateOption.find(_=>item.source == _.source || item.source == _.source2);
  416. let isChoosed = this.checkedLinkList[i].calculationMethod.findIndex(_=>_.source == x.source || _.source == x.source2);
  417. if(isChoosed >= 0) {
  418. this.checkedLinkList[i].calculationMethod.splice(isChoosed,1);
  419. }
  420. this.checkedLinkList[i].calculationMethod.unshift(item);
  421. this.handleThreeCalculation();
  422. },
  423. changeLinkType(){
  424. this.doDataInit();
  425. this.handleLinkListInShow();
  426. let firstCheckedLink = this.linkListInShow[0];
  427. if(firstCheckedLink){
  428. this.activeItemRId=''
  429. this.linkClick(firstCheckedLink)
  430. }
  431. this.doDataInit();
  432. },
  433. handleLinkListInShow(){
  434. this.linkListInShow = (this.checkedLinkList || []).filter(_=>_.Type == this.addLinkSearchParams.linkType);
  435. },
  436. doDataInit(){
  437. this.search_dataBaseId=''
  438. this.dataBaseOptions=[]
  439. this.dataBaseParams={
  440. pages:1,
  441. searchText:'',
  442. search_have_more:false
  443. }
  444. this.databaseTableData=[]
  445. this.databaseList=[]
  446. this.databaseHaveMore=false
  447. this.databasePageNo=1
  448. this.chartInfo={}
  449. this.edbData=[]
  450. this.reportKeyWord=''
  451. this.reportList=[]
  452. },
  453. /* 搜索 */
  454. dataBaseSearch(query) {
  455. this.dataBaseParams.pages = 1;
  456. this.dataBaseParams.searchText = query;
  457. this.dataBaseSearchApi(this.dataBaseParams.searchText)
  458. },
  459. // 加载更多
  460. dataBaseSearchLoad() {
  461. if(!this.dataBaseParams.search_have_more) return;
  462. this.dataBaseSearchApi(this.dataBaseParams.searchText,++this.dataBaseParams.pages);
  463. },
  464. /* 聚焦获取当前检索 */
  465. dataBaseInputFocus(e) {
  466. this.dataBaseParams.pages = 1;
  467. this.dataBaseParams.searchText = e.target.value;
  468. if(this.dataBaseParams.searchText) {
  469. this.dataBaseSearchApi(this.dataBaseParams.searchText);
  470. }else {
  471. this.searchOptions = [];
  472. this.dataBaseParams.search_have_more=false
  473. }
  474. },
  475. dataBaseSearchApi(query,page=1) {
  476. if(this.addLinkSearchParams.linkType==1){
  477. sheetInterface.searchTarget({
  478. KeyWord:query,
  479. CurrentIndex: page
  480. }).then(res => {
  481. if(res.Ret !== 200) return
  482. const { List,Paging } = res.Data;
  483. this.dataBaseParams.search_have_more = page < Paging.Pages;
  484. this.dataBaseOptions = page === 1 ? List : this.dataBaseOptions.concat(List);
  485. })
  486. }else{
  487. dataBaseInterface.chartSearchByEs({
  488. Keyword: query,
  489. IsShowMe:false,
  490. CurrentIndex: page
  491. })
  492. .then((res) => {
  493. if (res.Ret !== 200) return
  494. const { List,Paging } = res.Data;
  495. this.dataBaseParams.search_have_more = page < Paging.Pages;
  496. this.dataBaseOptions = page === 1 ? List : [...this.dataBaseOptions,...List];
  497. });
  498. }
  499. },
  500. initGetData() {
  501. this.databasePageNo = 1;
  502. if(this.$refs.edb_detail_data){
  503. this.$refs.valueUl.scrollTop=0
  504. }
  505. this.getDatabaseList();
  506. },
  507. getDatabaseList(){
  508. // 0-普通指标 1-预测指标
  509. let api = this.activeItem.databaseType==0?(dataBaseInterface.targetList):(preDictEdbInterface.edbDataInfo)
  510. api({
  511. PageSize: 20,
  512. CurrentIndex: this.databasePageNo,
  513. EdbInfoId: this.search_dataBaseId || this.activeItem.Id,
  514. }).then(res => {
  515. if(res.Ret === 200) {
  516. if(res.Data) {
  517. this.databaseTableData = [res.Data.Item] || [];
  518. this.databaseHaveMore = this.databasePageNo < res.Data.Paging.Pages ? true : false;
  519. this.databaseList = this.databasePageNo === 1 ? (res.Data.Item.DataList || []) : this.databaseList.concat(res.Data.Item.DataList);
  520. }else {
  521. this.databaseTableData = [];
  522. this.databaseList = [];
  523. }
  524. }
  525. })
  526. },
  527. databaseScrollHandle:_.throttle(function() {
  528. let scrollTop = this.$refs.valueUl.scrollTop;
  529. let clientHeight = this.$refs.valueUl.clientHeight;
  530. let scrollHeight = this.$refs.valueUl.scrollHeight;
  531. if(scrollTop===0) return
  532. if(scrollTop + clientHeight >= scrollHeight-10 && this.databaseHaveMore){
  533. this.databasePageNo++
  534. this.getDatabaseList()
  535. }
  536. },200),
  537. async getChartDetail(ChartInfoId) {
  538. const res = await dataBaseInterface.getChartInfoById({ChartInfoId})
  539. if (res.Ret !== 200) return;
  540. this.chartInfo = res.Data.ChartInfo || {}
  541. this.edbData = res.Data.EdbInfoList|| []
  542. //初始化上下限
  543. this.setLimitData(this.edbData)
  544. const chartTypeMap = {
  545. 7: this.initBarData, //柱形图
  546. 10: this.initSectionScatterData, //截面散点
  547. 11: this.initRadarData(res.Data)
  548. }
  549. chartTypeMap[this.chartInfo.ChartType] && chartTypeMap[this.chartInfo.ChartType](res.Data);
  550. },
  551. editLinkName(item){
  552. this.editingLabel = item.Name
  553. item.editing=true
  554. this.$nextTick(() => {
  555. this.$refs.labelEditInput[0].focus();
  556. });
  557. },
  558. // 链接点击
  559. /*
  560. config.noInfo - 研报类型的不提示
  561. */
  562. linkClick(item,config={}){
  563. if(this.activeItemRId == item.RId) return
  564. this.activeItemRId = item.RId
  565. this.activeItem = item
  566. this.addLinkSearchParams.linkType=item.Type
  567. this.handleLinkListInShow();
  568. if(item.Type==3){
  569. if(!config.noInfo){
  570. this.$message.info('研报类型的暂无回显')
  571. }
  572. }else if(item.Type==1){
  573. this.doDataInit()
  574. this.initGetData()
  575. }else if(item.Type==2){
  576. this.doDataInit()
  577. this.getChartDetail(item.Id)
  578. }
  579. },
  580. linkDelete(item,index){
  581. let rId = item.RId
  582. this.linkListInShow.splice(index,1);
  583. this.checkedLinkList.splice(this.checkedLinkList.findIndex(_=>_.RId == rId),1);
  584. if(this.activeItemRId == rId){
  585. let firstCheckedLink = this.linkListInShow[0]
  586. if(firstCheckedLink){
  587. this.linkClick(firstCheckedLink,{noInfo:true})
  588. }else{
  589. this.activeItemRId = "";
  590. this.activeItem = {};
  591. }
  592. this.doDataInit()
  593. }
  594. if(item.Type==3){
  595. let deleteId=this.selections.filter(it=> it.Id==item.Id)
  596. if(deleteId[0]){
  597. this.$refs.reportTable && this.$refs.reportTable.toggleRowSelection(deleteId[0],false)
  598. }
  599. }
  600. },
  601. editLinkNameFinish(item){
  602. if (this.editingLabel) {
  603. item.editing=false
  604. item.Name = this.editingLabel
  605. let i = this.checkedLinkList.findIndex(_=>_.RId == item.RId);
  606. if(i >= 0) this.checkedLinkList[i].Name = this.editingLabel;
  607. } else {
  608. this.$message.warning('不能为空');
  609. }
  610. },
  611. handleEditEdbName(options){
  612. let {item} = options;
  613. let i = this.checkedLinkList.findIndex(_=>_.RId == item.RId);
  614. if(i >= 0) this.checkedLinkList[i].Name = item.Name;
  615. let j = this.linkListInShow.findIndex(_=>_.RId == item.RId);
  616. if(j >= 0) this.linkListInShow[j].Name = item.Name;
  617. },
  618. handleAddEdbItem(options){
  619. let {item} = options;
  620. this.doDataInit()
  621. this.activeItem = item;
  622. this.checkedLinkList.push(item)
  623. this.handleLinkListInShow()
  624. this.activeItemRId=item.RId;
  625. this.initGetData()
  626. },
  627. handleChangeActiveEdb({item}){
  628. if(!item) return;
  629. this.linkClick(item)
  630. },
  631. handleEdbDelete({item}){
  632. let index = this.linkListInShow.findIndex(_=>_.RId == item.RId)
  633. this.linkDelete(item,index)
  634. },
  635. searchReport(){
  636. this.reportParams.CurrentIndex=1
  637. if(!this.reportKeyWord){
  638. this.reportList=[]
  639. this.reportTotal=0
  640. }else{
  641. this.getReportList()
  642. }
  643. },
  644. getReportList(){
  645. let params={
  646. CurrentIndex: this.reportParams.CurrentIndex,
  647. PageSize: this.reportParams.PageSize,
  648. KeyWord:this.reportKeyWord,
  649. State:2
  650. }
  651. reportlist(params).then((res) => {
  652. if (res.Ret === 200) {
  653. this.reportList = res.Data.List || [];
  654. this.reportTotal = parseInt(res.Data.Paging.Totals);
  655. }
  656. });
  657. },
  658. pageChange(page_no){
  659. this.reportParams.CurrentIndex = page_no;
  660. this.getReportList();
  661. },
  662. reportSelect(selection){
  663. this.selections=selection
  664. let allIds = this.reportList.map(it => {
  665. return it.Id
  666. })
  667. let simpleSelections = selection.map(it => {
  668. return {Id:it.Id,Code:it.ReportCode,Name:it.Title}
  669. })
  670. let unselectIds=[]
  671. if(simpleSelections.length>0){
  672. allIds.map(id =>{
  673. if(simpleSelections.every(sele => id!=sele.Id )){
  674. unselectIds.push(id)
  675. }
  676. })
  677. }else{
  678. unselectIds=allIds
  679. }
  680. //没有就增加
  681. simpleSelections.map(item =>{
  682. let rId = this.addLinkSearchParams.linkType+'-'+item.Id
  683. if(this.checkedLinkList.every(sele => rId!=sele.RId )){
  684. this.checkedLinkList.push({
  685. RId:rId,
  686. Id:item.Id,
  687. Name:item.Name,
  688. Type:this.addLinkSearchParams.linkType,
  689. editing:false,
  690. detailParams:{id:item.Id,code:item.Code},
  691. calculationMethod:[]
  692. })
  693. this.handleLinkListInShow()
  694. }
  695. })
  696. //有就去掉
  697. unselectIds.map(item =>{
  698. let rId = this.addLinkSearchParams.linkType+'-'+item
  699. let index = this.checkedLinkList.findIndex(link => rId==link.RId)
  700. if(index!=-1){
  701. this.checkedLinkList.splice(index,1)
  702. this.handleLinkListInShow()
  703. }
  704. })
  705. },
  706. saveLink(){
  707. this.$emit("saveLink", this.checkedLinkList);
  708. },
  709. handleCloseDialog(){
  710. this.dialogDisplayNone = false;
  711. },
  712. cancelHandle(){
  713. this.linkListInShow = [];
  714. this.$emit("update:show", false);
  715. }
  716. },
  717. }
  718. </script>
  719. <style lang="scss" scoped>
  720. .add-link-box{
  721. max-height: 72vh;
  722. overflow: auto;
  723. padding: 15px 40px 35px;
  724. .link-box-option{
  725. display: flex;
  726. align-items: center;
  727. justify-content: space-between;
  728. margin-bottom: 20px;
  729. }
  730. .link-box-content{
  731. margin-bottom: 30px;
  732. .link-content-dataIndex{
  733. display: flex;
  734. flex-direction: column;
  735. .link-count-wrap{
  736. margin-top: 13px;
  737. display: flex;
  738. justify-content: start;
  739. align-items: center;
  740. flex-wrap: wrap;
  741. .link-count-item{
  742. cursor: pointer;
  743. display: flex;
  744. justify-content: center;
  745. align-items: center;
  746. margin-top: 20px;
  747. margin-right: 20px;
  748. font-size: 14px;
  749. box-sizing: border-box;
  750. height: 40px;
  751. padding: 4px 8px 4px 8px;
  752. border-radius: 4px;
  753. }
  754. .link-count-item-on{
  755. border: 1px solid #0052D9;
  756. color: #666666;
  757. background: #ECF2FE;
  758. }
  759. .link-count-item-un{
  760. border: 1px solid #C8CDD9;
  761. color: #666666;
  762. }
  763. }
  764. .calculate-result-wrap{
  765. margin-top: 20px;
  766. .calculate-result-title{
  767. font-size: 14px;
  768. color: #333333;
  769. margin-bottom: 10px;
  770. }
  771. .calculate-result-table{
  772. border: 1px solid #C8CDD9;
  773. box-sizing: border-box;
  774. padding: 0 20px;
  775. border-radius: 4px;
  776. .calculate-result-table-tr:nth-of-type(n+2){
  777. border-top: 1px solid #C8CDD9;
  778. }
  779. .calculate-result-table-tr{
  780. height: 50px;
  781. display: flex;
  782. align-items: center;
  783. .calculate-result-table-item{
  784. width: 33.3%;
  785. color: #333333;
  786. font-weight: 400;
  787. }
  788. }
  789. }
  790. }
  791. .delete-button{
  792. color: #AD352F;
  793. font-size: 14px;
  794. cursor: pointer;
  795. }
  796. }
  797. .link-content-chartIndex{
  798. .chart-name{
  799. font-size: 16px;
  800. text-align: center;
  801. color: #333333;
  802. }
  803. }
  804. }
  805. .link-box-tags{
  806. display: flex;
  807. align-items: center;
  808. overflow-x: auto;
  809. margin-bottom: 20px;
  810. .unchoose-tag{
  811. border: 1px solid #C8CDD9;
  812. }
  813. .choosed-tag{
  814. border: 1px solid #0052D9;
  815. background: rgba(236, 242, 254, 1);
  816. }
  817. .link-box-tag{
  818. display: flex;
  819. align-items: center;
  820. padding: 0 8px;
  821. height: 40px;
  822. max-width: 250px;
  823. margin-right: 30px;
  824. border-radius: 4px;
  825. cursor: pointer;
  826. &:last-child{
  827. margin-right: 0;
  828. }
  829. span{
  830. white-space: nowrap;
  831. overflow: hidden;
  832. text-overflow: ellipsis;
  833. }
  834. img{
  835. height: 16px;
  836. width: 16px;
  837. margin-left: 8px;
  838. }
  839. }
  840. }
  841. .link-box-buttons{
  842. margin-top: 60px;
  843. display: flex;
  844. align-items: center;
  845. justify-content: center;
  846. }
  847. }
  848. </style>