index.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295
  1. <template>
  2. <div
  3. class="mychart_container"
  4. id="mychart_container"
  5. >
  6. <span
  7. class="slide-icon slide-right"
  8. @click="slideHandle"
  9. v-show="isSlideLeft"
  10. >
  11. <i class="el-icon-d-arrow-right"></i>
  12. </span>
  13. <div class="main-left left" id="left" v-show="!isSlideLeft">
  14. <span class="slide-icon slide-left" @click="slideHandle">
  15. <i class="el-icon-d-arrow-left"></i>
  16. </span>
  17. <span class="move-btn resize" v-drag id="resize"></span>
  18. <div class="left-top">
  19. <span v-permission="permissionBtn.myETAPermission.myChart_selectChart"
  20. class="add-cont" @click="chooseChartHandle">
  21. <img
  22. :src="$icons.choose_blue"
  23. alt=""
  24. style="width: 14px; height: 14px"
  25. />
  26. <!-- 选择图表 -->{{$t('MyEtaPage.choose_chart_btn')}}
  27. </span>
  28. <el-select
  29. v-model="search_txt"
  30. v-loadMore="searchLoad"
  31. :filterable="!search_txt"
  32. remote
  33. clearable
  34. :placeholder="$t('Chart.search_chart_placeholder')"
  35. style="width: 100%; margin-top: 20px"
  36. :remote-method="searchHandle"
  37. @click.native="inputFocusHandle"
  38. >
  39. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  40. <el-option
  41. v-for="item in searchOptions"
  42. :key="item.MyChartId"
  43. :label="chart_lang==='en'?(item.ChartNameEn||item.ChartName):item.ChartName"
  44. :value="item.MyChartId"
  45. >
  46. </el-option>
  47. </el-select>
  48. </div>
  49. <div class="left-bottom">
  50. <div class="public-classify" v-if="publicClassifyList.length">
  51. <h3
  52. @click="expandPublic = !expandPublic"
  53. class="classify-type"
  54. >
  55. <!-- 公共图库 -->{{$t('MyEtaPage.tab_public')}}
  56. <span><i :class="{'el-icon-arrow-down':!expandPublic,'el-icon-arrow-up':expandPublic}"></i></span>
  57. </h3>
  58. <div class="tree-wrap" v-show="expandPublic">
  59. <el-tree
  60. ref="catalogTree"
  61. class="catalog-tree other-tree"
  62. empty-text="暂无图库"
  63. :data="publicClassifyList"
  64. node-key="nodeKeyId"
  65. :expand-on-click-node="false"
  66. @current-change="(data,node)=>{nodeChange(data,node)}"
  67. >
  68. <div class="custom-tree-node" slot-scope="{ data,node }">
  69. <span class="tree-label">{{ data.name }}</span>
  70. <div class="right-item right-item-box" >
  71. <el-dropdown @command="handleCommand" trigger="click" v-if="isShowDropPublic&&data.MyChartClassifyId">
  72. <span class="el-dropdown-link">
  73. <i class="el-icon-more" style="font-size: 16px;transform: rotate(90deg);cursor: pointer"/>
  74. </span>
  75. <el-dropdown-menu slot="dropdown">
  76. <el-dropdown-item :command="{key:'copy'}" :disabled="select_classify_userid === roleId"><!-- 复制 -->{{$t('MyEtaPage.option_op_copy')}}</el-dropdown-item>
  77. </el-dropdown-menu>
  78. </el-dropdown>
  79. </div>
  80. </div>
  81. </el-tree>
  82. </div>
  83. </div>
  84. <div class="classify" v-if="classifyList.length">
  85. <h3 class="classify-type"><!-- 我的图库 -->{{$t('MyEtaPage.tab_my')}}</h3>
  86. <draggable
  87. v-model="classifyList"
  88. class="classify-ul"
  89. animation="300"
  90. tag="ul"
  91. @start="menuDragStart"
  92. @update="menuDragenter"
  93. @end="menuDragOver"
  94. >
  95. <li
  96. :class="[
  97. 'classify-item',
  98. { 'act': item.MyChartClassifyId === select_classify && item.fromPublic === ispublic },
  99. ]"
  100. v-for="item in classifyList"
  101. :key="item.MyChartClassifyId"
  102. @click="chooseClassify(item)"
  103. >
  104. <div>
  105. <img
  106. src="~@/assets/img/data_m/move_ico.png"
  107. alt=""
  108. class="move"
  109. style="width: 14px; height: 14px;margin-right: 5px;"
  110. />
  111. {{ item.MyChartClassifyName }}
  112. </div>
  113. <div class="right-item right-item-box">
  114. <el-dropdown v-if="isShowGroupBtn"
  115. style="margin-right: 10px" @command="handleCommand" trigger="click">
  116. <span class="el-dropdown-link el-dropdown-link-img">
  117. <img src="~@/assets/img/chart_m/Group.png" v-if="item.IsPublic === 0">
  118. <img src="~@/assets/img/chart_m/User.png" v-else>
  119. </span>
  120. <el-dropdown-menu slot="dropdown">
  121. <el-dropdown-item
  122. :command="{key:'own',IsCompanyPublic:undefined,item}"
  123. :class="item.IsPublic === 0 ? 'el-dropdown-menu-item-chat-act' : ''"
  124. class="el-dropdown-menu-item-chat"
  125. >
  126. <img v-if="item.IsPublic === 0" src="~@/assets/img/chart_m/Group_act.png">
  127. <img v-else src="~@/assets/img/chart_m/Group.png">
  128. <!-- 仅自己可见 -->{{$t('MyEtaPage.option_view_person')}}</el-dropdown-item>
  129. <el-dropdown-item
  130. :command="{key:'public',IsCompanyPublic:undefined,item}"
  131. :class="item.IsPublic === 1 ? 'el-dropdown-menu-item-chat-act' : ''"
  132. class="el-dropdown-menu-item-chat"
  133. >
  134. <img v-if="item.IsPublic === 1" src="~@/assets/img/chart_m/User_act.png">
  135. <img v-else src="~@/assets/img/chart_m/User.png">
  136. <!-- 所有人可见 -->{{$t('MyEtaPage.option_view_all')}}</el-dropdown-item>
  137. </el-dropdown-menu>
  138. </el-dropdown>
  139. <el-dropdown @command="handleCommand" trigger="click" v-if="isShowDropMine">
  140. <span class="el-dropdown-link">
  141. <i class="el-icon-more" style="font-size: 16px;transform: rotate(90deg);cursor: pointer"/>
  142. </span>
  143. <el-dropdown-menu slot="dropdown">
  144. <el-dropdown-item v-if="permissionBtn.isShowBtn('myETAPermission','myChart_classifyOpt_rename')"
  145. :command="{key:'edit'}"><!-- 重命名 -->{{$t('MyEtaPage.option_op_rename')}}</el-dropdown-item>
  146. <el-dropdown-item v-if="permissionBtn.isShowBtn('myETAPermission','myChart_classifyOpt_delete')"
  147. :command="{key:'del'}"><!-- 删除 -->{{$t('Table.delete_btn')}}</el-dropdown-item>
  148. </el-dropdown-menu>
  149. </el-dropdown>
  150. </div>
  151. </li>
  152. </draggable>
  153. </div>
  154. <div class="noclassify" @click="addClassify" v-permission="permissionBtn.myETAPermission.myChart_classifyOpt_edit">
  155. <img
  156. src="~@/assets/img/set_m/add_ico.png"
  157. alt=""
  158. style="width: 16px; height: 16px; margin-right: 10px"
  159. />
  160. <span><!-- 添加我的分类 -->{{$t('MyEtaPage.add_myclassify_btn')}}</span>
  161. </div>
  162. </div>
  163. </div>
  164. <div
  165. class="main-right right"
  166. id="right"
  167. :style="isSlideLeft ? 'width:100%' : ``"
  168. >
  169. <div class="chart-public-cont" v-if="haveData">
  170. <div class="cont-top">
  171. <span>{{$t('Chart.total_chart_show',{limit:total})}}</span>
  172. <span v-if="ispublic === 1"><!-- 分享人 -->{{$t('MyEtaPage.label_share_user')}}: {{ RealName }}</span>
  173. </div>
  174. <div
  175. class="chart-public-list"
  176. :infinite-scroll-disabled="!haveMove"
  177. v-infinite-scroll="loadMove"
  178. infinite-scroll-distance='1'
  179. infinite-scroll-delay="200"
  180. >
  181. <draggable
  182. v-model="chartList"
  183. class="drag-cont"
  184. animation="300"
  185. @start="dragStartHandler"
  186. @update="dragenter"
  187. @end="dragOverHandler"
  188. :disabled="ispublic===1"
  189. >
  190. <el-col
  191. :span="6"
  192. v-for="chart in chartList"
  193. :key="chart.ChartInfoId"
  194. style="margin-bottom: 20px; padding-right: 20px;min-width: 270px;"
  195. >
  196. <el-card class="public-chart-item">
  197. <div slot="header" class="item-top">
  198. <span class="text_oneLine" :style="{'padding-left':chart.IsEnChart?'24px':''}">{{ chart_lang === 'en' ? (chart.ChartNameEn||chart.ChartName) : chart.ChartName }}</span>
  199. <img
  200. v-if="ispublic === 0"
  201. src="~@/assets/img/data_m/move_ico.png"
  202. alt=""
  203. class="move"
  204. style="width: 14px; height: 14px"
  205. />
  206. </div>
  207. <img
  208. :src="([1,11].includes(chart.Source)&&!chart.HaveOperaAuth) ? $icons.lock_big : chart.ChartImage"
  209. alt=""
  210. class="chart-img"
  211. @click="viewChartDetail(chart)"
  212. />
  213. <div class="item-bottom">
  214. <span class="last-time"
  215. ><!-- 创建时间 -->{{$t('Chart.list_chart_time')}}: {{ chart.CreateTime.slice(0,10) }}</span
  216. >
  217. <div v-if="select_classify_userid === roleId">
  218. <span v-permission="permissionBtn.myETAPermission.myChart_move"
  219. class="join_txt" @click="removeMyChart(chart)">
  220. <i
  221. class="el-icon-remove-outline"
  222. style="font-size: 14px"
  223. ></i>
  224. <!-- 移出 -->{{$t('Chart.chart_remove_btn')}}
  225. </span>
  226. </div>
  227. </div>
  228. </el-card>
  229. </el-col>
  230. </draggable>
  231. </div>
  232. </div>
  233. <div v-else class="nodata">
  234. <span v-if="ispublic === 1" class="sharer"><!-- 分享人 -->{{$t('MyEtaPage.label_share_user')}}: {{ RealName }}</span>
  235. <tableNoData :text="$t('Common.no_chart_msg')"/>
  236. </div>
  237. </div>
  238. <choose-chart
  239. :isOpenChoose="isChoose"
  240. @cancel="isChoose = false"
  241. @addSuccess="addChartBack"
  242. />
  243. <pub-dialog
  244. :isShow="isClassifyDia"
  245. :title="dia_title"
  246. :keysArr="dialogKeyArrs"
  247. :formData="formData"
  248. :formRules="addRules"
  249. :selectArr="selectArr"
  250. @cancel="isClassifyDia = false"
  251. @ensureCallBack="addClassifyBack"
  252. />
  253. <!-- 图表详情弹窗 -->
  254. <chart-detail
  255. :isOpenDetail="isOpenDetail"
  256. :select_classify="select_classify"
  257. :chart_code="chart_code"
  258. :allChart="chartArrParams"
  259. :classifyUserId="select_classify_userid"
  260. @close="chartCallBack"
  261. @remove="removeCallBack"
  262. />
  263. <!-- 删除确认弹窗 -->
  264. <ClassifyDeleteCheck
  265. :hintDialogShow="hintDialogShow"
  266. :detailArr="detailArr"
  267. @close="hintDialogShow=false"
  268. />
  269. </div>
  270. </template>
  271. <script>
  272. import draggable from 'vuedraggable';
  273. import { mychartInterface } from '@/api/api.js';
  274. import pubDialog from '@/components/pubDialog.vue';
  275. import chooseChart from './components/chooseChart.vue';
  276. import chartDetail from './components/chartDetailDia.vue';
  277. import ClassifyDeleteCheck from './components/classifyDeleteCheck.vue';
  278. export default {
  279. name: '',
  280. components: {
  281. chooseChart,
  282. pubDialog,
  283. draggable,
  284. chartDetail,
  285. ClassifyDeleteCheck
  286. },
  287. directives: {
  288. drag(el, bindings) {
  289. el.onmousedown = function (e) {
  290. var init = e.clientX;
  291. var box = $('#mychart_container')[0];
  292. let total_wid = box.offsetWidth;
  293. var left = $('#left')[0];
  294. var right = $('#right')[0];
  295. var initWidth = left.offsetWidth;
  296. document.onmousemove = function (e) {
  297. var end = e.clientX;
  298. if (end > 310) {
  299. var newWidth = end - init + initWidth;
  300. right.style.width = total_wid - newWidth + 'px';
  301. left.style.width = newWidth + 'px';
  302. } else {
  303. end = 350;
  304. // 最小宽度300
  305. left.style.width = 300 + 'px';
  306. }
  307. };
  308. document.onmouseup = function () {
  309. document.onmousemove = document.onmouseup = null;
  310. e.releaseCapture && e.releaseCapture();
  311. };
  312. e.setCapture && e.setCapture();
  313. return false;
  314. };
  315. },
  316. },
  317. data() {
  318. return {
  319. expandPublic:false,
  320. RealName:'',
  321. haveData: true,
  322. isSlideLeft: false, //收起分类
  323. search_txt: '',
  324. searchOptions: [],
  325. select_classify: 0,
  326. classifyList: [],
  327. total: 0,
  328. page_no: 1,
  329. page_size: 1200,
  330. chartList: [], //列表
  331. isRightClick: false, //右击弹窗
  332. rightClick_classify: '', //右击的分类
  333. rightActionArr: [
  334. {
  335. title: '编辑',
  336. key: 'edit',
  337. },
  338. {
  339. title: '删除',
  340. key: 'del',
  341. },
  342. ],
  343. startIndex: '', //初始位置id
  344. preIndex: '', //结束位置上一个id
  345. nextIndex: '', //结束位置下一个id
  346. /* 选择图表弹窗 */
  347. isChoose: false,
  348. /* 添加分类 */
  349. isClassifyDia: false,
  350. dia_title: '新增分类',
  351. dialogKeyArrs: [], //form key
  352. selectArr: [], //select data
  353. formData: {
  354. name: '',
  355. },
  356. addRules: {
  357. name: [
  358. { required: true, message: /* '分类名称不能为空' */this.$t('Edb.Valids.common_msg',{label: this.$t('MyEtaPage.label_classify_name')}), trigger: 'blur' },
  359. ],
  360. classify: [
  361. { required: true, message: /* '复制分类不能为空' */this.$t('Edb.Valids.common_msg',{label: this.$t('MyEtaPage.label_classify_name')}), trigger: 'blur' },
  362. ]
  363. }, //添加分类规则
  364. move_id: '', //移动到 当前选中图表
  365. /* 图表详情弹窗 */
  366. isOpenDetail: false,
  367. chart_code: '',//图表code
  368. chartArrParams: [],//当前选择分类下的所有图表
  369. startMenuIndex: '', //初始位置id
  370. preMenuIndex: '', //结束位置上一个id
  371. nextMenuIndex: '', //结束位置下一个id
  372. publicClassifyList: [],//公共分类
  373. ispublic: '',//选中的是公共还是own
  374. select_classify_userid: 0,//选中图表的创建人id
  375. haveMove: false,
  376. hintDialogShow:false,
  377. detailArr:[]
  378. };
  379. },
  380. computed: {
  381. /* 登录角色id */
  382. roleId() {
  383. let id = Number(localStorage.getItem('AdminId'));
  384. return id;
  385. },
  386. //是否显示公共图库的下拉按钮
  387. isShowDropPublic(){
  388. return this.permissionBtn.isShowBtn('myETAPermission','myChart_classifyOpt_copy')
  389. },
  390. //是否显示我的图库的下拉按钮
  391. isShowDropMine(){
  392. return this.permissionBtn.isShowBtn('myETAPermission','myChart_classifyOpt_rename')
  393. || this.permissionBtn.isShowBtn('myETAPermission','myChart_classifyOpt_delete')
  394. },
  395. //是否显示可见权限
  396. isShowGroupBtn(){
  397. return this.permissionBtn.isShowBtn('myETAPermission','myChart_classifyOpt_show')
  398. },
  399. //语言版本
  400. chart_lang() {
  401. return this.$store.state.lang
  402. }
  403. },
  404. watch: {
  405. // 左侧选中分类
  406. select_classify(newval) {
  407. if (newval) {
  408. this.page_no = 1;
  409. this.chartList = [];
  410. this.getChartList();
  411. }
  412. },
  413. /* */
  414. search_txt(newval) {
  415. if (newval) {
  416. const obj = this.searchOptions.find(
  417. (item) => item.MyChartId === newval
  418. );
  419. //所属分类列表 单个高亮左侧
  420. let classify_arr = obj.MyChartClassifyId.split(',');
  421. this.page_no = 1;
  422. this.select_classify = 0;
  423. if (classify_arr.length === 1) this.select_classify = Number(classify_arr[0]);
  424. this.getChartList();
  425. }
  426. },
  427. //页码
  428. page_no() {
  429. this.getChartList();
  430. },
  431. },
  432. methods: {
  433. /* 获取分类列表 */
  434. getClassify() {
  435. mychartInterface.classifyList().then((res) => {
  436. if (res.Ret !== 200) return;
  437. this.classifyList = res.Data ? res.Data.List.map(item => ({
  438. ...item,
  439. fromPublic: 0
  440. })) : [];
  441. if (!this.classifyList.length) this.haveData = false;
  442. this.select_classify =
  443. this.select_classify ||
  444. (this.classifyList.length
  445. ? this.classifyList[0].MyChartClassifyId
  446. : 0);
  447. this.ispublic = this.ispublic ||
  448. (this.classifyList.length
  449. ? this.classifyList[0].fromPublic
  450. : '');
  451. this.select_classify_userid = this.select_classify_userid || (this.classifyList.length
  452. ? this.classifyList[0].AdminId
  453. : 0);
  454. });
  455. },
  456. /* 获取公用分类 */
  457. getPublicClassify() {
  458. mychartInterface.publicClassify().then((res) => {
  459. if(res.Ret !== 200) return;
  460. this.publicClassifyList = res.Data?res.Data.List||[]:[]
  461. this.publicClassifyList = this.publicClassifyList.map(list=>{
  462. list.name = list.MenuName
  463. list.nodeKeyId = 'list' + list.MenuAdminId
  464. if(list.Items){
  465. list.children = list.Items.map(item=>{
  466. return {
  467. ...item,
  468. ...{
  469. nodeKeyId:'item'+ item.MyChartClassifyId,
  470. name:item.MyChartClassifyName
  471. }
  472. }
  473. })
  474. }
  475. return list
  476. })
  477. })
  478. },
  479. /* 获取图表 MyChartId用于具体搜索和MyChartClassifyId互斥*/
  480. getChartList() {
  481. mychartInterface
  482. .myList({
  483. PageSize: this.page_size,
  484. CurrentIndex: this.page_no,
  485. MyChartClassifyId: this.select_classify || 0,
  486. MyChartId: this.search_txt || 0,
  487. })
  488. .then((res) => {
  489. if (res.Ret !== 200) return;
  490. this.haveData = res.Data ? true : false;
  491. this.haveMove = res.Data
  492. ? this.page_no < res.Data.Paging.Pages
  493. : false;
  494. this.chartList = res.Data
  495. ? this.page_no === 1
  496. ? res.Data.List
  497. : [...this.chartList, ...res.Data.List]
  498. : [];
  499. this.total = res.Data ? res.Data.Paging.Totals : 0;
  500. });
  501. },
  502. /* 加载下页 */
  503. loadMove() {
  504. this.page_no++;
  505. },
  506. /* 搜索 */
  507. searchHandle(query) {
  508. this.search_page = 1;
  509. this.current_search = query;
  510. this.searchApi(this.current_search)
  511. },
  512. searchApi(query,page=1) {
  513. if(!query) {
  514. this.searchOptions = [];
  515. return
  516. }
  517. /* 查找列表 */
  518. mychartInterface
  519. .mychartSearchByEs({
  520. Keyword: query,
  521. CurrentIndex: page
  522. })
  523. .then((res) => {
  524. if (res.Ret !== 200) return
  525. const { List,Paging } = res.Data;
  526. this.search_have_more = page < Paging.Pages;
  527. this.searchOptions = page === 1 ? List : [...this.searchOptions,...List];
  528. });
  529. },
  530. /* 聚焦获取当前检索 */
  531. inputFocusHandle(e) {
  532. this.search_page = 1;
  533. this.current_search = e.target.value;
  534. if(this.current_search) {
  535. this.searchApi(this.current_search)
  536. }else {
  537. this.searchOptions = [];
  538. }
  539. },
  540. searchLoad() {
  541. if(!this.search_have_more) return;
  542. this.searchApi(this.current_search,++this.search_page);
  543. },
  544. nodeChange(data,node){
  545. if(node.level===1){
  546. this.select_classify = 0
  547. this.haveData = false
  548. this.total = 0
  549. this.page_no = 1
  550. this.chartList = []
  551. this.ispublic=''
  552. return
  553. }
  554. this.RealName = data.RealName
  555. this.chooseClassify({
  556. MyChartClassifyId:data.MyChartClassifyId,
  557. fromPublic:1,
  558. AdminId:data.AdminId
  559. })
  560. },
  561. /* 切换分类 */
  562. chooseClassify({MyChartClassifyId,fromPublic,AdminId}) {
  563. if(fromPublic!==1){
  564. this.$refs.catalogTree&&this.$refs.catalogTree.setCurrentKey(null)
  565. }
  566. this.select_classify = MyChartClassifyId;
  567. this.ispublic = fromPublic;
  568. this.select_classify_userid = AdminId;
  569. this.search_txt = '';
  570. },
  571. /* 选择图表添加 */
  572. chooseChartHandle() {
  573. this.isChoose = true;
  574. },
  575. /* 图表添加完成 */
  576. addChartBack() {
  577. this.isChoose = false;
  578. this.getClassify();
  579. this.getChartList();
  580. },
  581. /* 添加分类 */
  582. addClassify() {
  583. this.dia_title = /* '新增分类' */this.$t('MyEtaPage.label_add_classify');
  584. this.dialogKeyArrs = [
  585. {
  586. label: /* '分类名称' */this.$t('MyEtaPage.label_classify_name'),
  587. prop: 'name',
  588. type: 'input',
  589. maxlen: 10,
  590. placeholder: /* '请输入分类名称' */this.$t('MyEtaPage.ph_classify'),
  591. },
  592. ];
  593. this.formData = {
  594. name: '',
  595. };
  596. this.isClassifyDia = true;
  597. },
  598. /* 添加分类回调 */
  599. addClassifyBack(params, title) {
  600. title === this.$t('MyEtaPage.label_add_classify') &&
  601. mychartInterface
  602. .addClassify({
  603. MyChartClassifyName: params.name,
  604. })
  605. .then((res) => {
  606. if (res.Ret !== 200) return;
  607. this.$message.success(/* '新增成功' */this.$t('MsgPrompt.add_msg'));
  608. this.isClassifyDia = false;
  609. this.getClassify();
  610. });
  611. title === this.$t('MyEtaPage.label_rename_classify') &&
  612. mychartInterface
  613. .editClassify({
  614. MyChartClassifyName: params.name,
  615. MyChartClassifyId: this.select_classify,
  616. })
  617. .then((res) => {
  618. if (res.Ret !== 200) return;
  619. this.$message.success(/* '编辑成功' */this.$t('MsgPrompt.edit_msg'));
  620. this.isClassifyDia = false;
  621. this.getClassify();
  622. this.getPublicClassify();
  623. });
  624. title === this.$t('MyEtaPage.label_copy_classify') &&
  625. mychartInterface
  626. .copyMyChart({
  627. ChartInfoId: this.move_id,
  628. MyChartClassifyId: params.classify,
  629. })
  630. .then((res) => {
  631. if (res.Ret !== 200) return;
  632. this.$message.success(/* '复制成功' */this.$t('MsgPrompt.copy_success_msg'));
  633. this.isClassifyDia = false;
  634. this.resetStatus();
  635. this.getClassify();
  636. this.getChartList();
  637. });
  638. },
  639. resetStatus() {
  640. this.search_txt = '';
  641. },
  642. /*重命名分类 */
  643. editClassify({ MyChartClassifyName }) {
  644. this.isClassifyDia = true;
  645. this.formData = {
  646. name: MyChartClassifyName,
  647. };
  648. this.dialogKeyArrs = [
  649. {
  650. label: /* '分类名称' */this.$t('MyEtaPage.label_classify_name'),
  651. prop: 'name',
  652. type: 'input',
  653. maxlen: 10,
  654. placeholder: /* '请输入分类名称' */this.$t('MyEtaPage.ph_classify'),
  655. },
  656. ];
  657. this.dia_title = /* '重命名分类' */this.$t('MyEtaPage.label_rename_classify');
  658. },
  659. /* 操作 */
  660. handleCommand({key,IsCompanyPublic,item}) {
  661. console.log({key,IsCompanyPublic,item});
  662. key === 'copy' && mychartInterface.copyclassify({
  663. MyChartClassifyId: this.select_classify
  664. }).then(res => {
  665. if(res.Ret !== 200) return;
  666. this.$message.success(/* '复制成功' */this.$t('MsgPrompt.copy_success_msg'));
  667. this.getClassify();
  668. });
  669. ['edit','del'].includes(key) && this.dealAction(key);
  670. ['own', 'public'].includes(key) && mychartInterface.setPublic({
  671. IsPublic: key === 'own' ? 0 : 1,
  672. MyChartClassifyId: this.select_classify
  673. }).then(res => {
  674. if(res.Ret !== 200) return;
  675. this.$message.success(/* '设置成功' */this.$t('MsgPrompt.set_success_msg'));
  676. if(key === 'own'){
  677. item.IsPublic=0
  678. item.IsCompanyPublic=0
  679. }else{
  680. item.IsPublic=1
  681. }
  682. })
  683. key==='auth' && mychartInterface.setClassifyAuthToUser({
  684. MyChartClassifyId:this.select_classify,
  685. IsCompanyPublic:IsCompanyPublic
  686. }).then(res=>{
  687. if(res.Ret !== 200) return;
  688. this.$message.success(/* '操作成功' */this.$t('MsgPrompt.operate_success_msg'));
  689. item.IsCompanyPublic=IsCompanyPublic
  690. })
  691. },
  692. /* 编辑 删除*/
  693. dealAction(key) {
  694. key === 'del' && this.handleDeleteClassify()
  695. const obj = this.classifyList.find(
  696. (x) => x.MyChartClassifyId === this.select_classify
  697. );
  698. key === 'edit' && this.editClassify(obj);
  699. },
  700. async handleDeleteClassify(){
  701. const res = await mychartInterface.getFrameNode({
  702. MyChartClassifyId:this.select_classify
  703. })
  704. if(res.Ret!==200) return
  705. this.detailArr = res.Data||[]
  706. if(this.detailArr.length){
  707. this.hintDialogShow = true
  708. return
  709. }
  710. this.$confirm(
  711. /* '若删除该分类,则分类下关联的所有图表将被全部删除, 是否继续?' */this.$t('Chart.OptMsg.del_classify_chart_msg'),
  712. /* '提示' */this.$t('Dialog.warn_tit'),
  713. {
  714. type: 'warning',
  715. }
  716. )
  717. .then(() => {
  718. mychartInterface
  719. .delClassify({
  720. MyChartClassifyId: this.select_classify,
  721. })
  722. .then((res) => {
  723. if (res.Ret !== 200) return;
  724. this.$message.success(/* '删除成功' */ this.$t('MsgPrompt.delete_msg'));
  725. this.getClassify();
  726. this.getPublicClassify();
  727. });
  728. })
  729. .catch(() => {});
  730. },
  731. /* 拖动开始 记录位置 */
  732. dragStartHandler({ oldIndex }) {
  733. this.startIndex = this.chartList[oldIndex].MyChartId;
  734. },
  735. /* 拖动结束 替换 */
  736. dragOverHandler() {
  737. mychartInterface
  738. .move({
  739. MyChartId: this.startIndex,
  740. MyChartClassifyId: this.select_classify,
  741. PrevMyChartId: this.preIndex || 0,
  742. NextMyChartId: this.nextIndex || 0,
  743. })
  744. .then((res) => {
  745. if (res.Ret !== 200) return;
  746. });
  747. },
  748. /* 拖动时 获取移动后的上一个位置id 若移到第一位则取0 获取后一个id 若是最后一个取0*/
  749. dragenter({ newIndex }) {
  750. console.log(newIndex)
  751. this.preIndex = newIndex > 0 ? this.chartList[newIndex - 1].MyChartId : 0;
  752. this.nextIndex = newIndex === this.chartList.length - 1 ? 0 : this.chartList[newIndex + 1].MyChartId
  753. },
  754. /* 拖动开始 记录位置 */
  755. menuDragStart({ oldIndex }) {
  756. this.startMenuIndex = this.classifyList[oldIndex].MyChartClassifyId;
  757. },
  758. /* 拖动结束 替换 */
  759. menuDragOver() {
  760. mychartInterface.moveClassify({
  761. MyChartClassifyId: this.startMenuIndex,
  762. NextClassifyId: this.nextMenuIndex || 0,
  763. PrevClassifyId: this.preMenuIndex || 0,
  764. }).then(res => {
  765. if(res.Ret !== 200) return;
  766. })
  767. },
  768. /* 拖动时 获取移动后的上一个位置id 若移到第一位则取0 获取后一个id 若是最后一个取0*/
  769. menuDragenter({ newIndex }) {
  770. this.preMenuIndex = newIndex > 0 ? this.classifyList[newIndex - 1].MyChartClassifyId : 0;
  771. this.nextMenuIndex = newIndex === this.classifyList.length - 1 ? 0 : this.classifyList[newIndex + 1].MyChartClassifyId
  772. },
  773. /* 向左收起/展开 */
  774. slideHandle() {
  775. this.isSlideLeft = !this.isSlideLeft;
  776. },
  777. /* 页码改变 */
  778. handleCurrentChange(page) {
  779. this.page_no = page;
  780. },
  781. /* 进入图库详情 */
  782. async viewChartDetail({ UniqueCode }) {
  783. this.chart_code = UniqueCode;
  784. // 获取当前分类下的所有图表 取code
  785. const allcharts = (this.select_classify || this.search_txt) ? await mychartInterface
  786. .myList({
  787. PageSize: 1000000,
  788. CurrentIndex: 1,
  789. MyChartClassifyId: this.select_classify || 0,
  790. MyChartId: this.search_txt || 0,
  791. }) : [];
  792. this.chartArrParams = allcharts.Data.List && allcharts.Data.List.length ? allcharts.Data.List.map(item => item.UniqueCode) : [];
  793. this.isOpenDetail = true;
  794. },
  795. chartCallBack() {
  796. this.page_no = 1;
  797. this.isOpenDetail = false;
  798. this.getChartList();
  799. },
  800. // 弹窗内移出删除图标后回调
  801. removeCallBack(code) {
  802. this.chartArrParams.splice(this.chartArrParams.findIndex(item => item === code), 1)
  803. },
  804. /* 移出我的图库 */
  805. removeMyChart({ MyChartId }) {
  806. if (!this.select_classify)
  807. return this.$message.warning(
  808. '当前图表所属多个分类,请选中具体分类移出'
  809. );
  810. mychartInterface
  811. .del({
  812. MyChartId,
  813. MyChartClassifyId: this.select_classify,
  814. })
  815. .then((res) => {
  816. if (res.Ret !== 200) return;
  817. this.$message.success(/* '移出成功' */this.$t('MsgPrompt.move_out_msg'));
  818. this.page_no = 1;
  819. this.getChartList();
  820. });
  821. },
  822. /* 移动到 打开分类弹窗 */
  823. async moveMychart(id) {
  824. this.dia_title = /* '复制图表分类' */ this.$t('MyEtaPage.label_copy_classify');
  825. this.move_id = id;
  826. this.dialogKeyArrs = [
  827. {
  828. label: /* '复制到' */ this.$t('MyEtaPage.label_copy_to'),
  829. prop: 'classify',
  830. type: 'select',
  831. placeholder: /* '请选择目录' */ this.$t('MyEtaPage.ph_menu'),
  832. multiple: true,
  833. },
  834. ];
  835. this.formData = {
  836. classify: [],
  837. };
  838. //获取当前图表所属分类并过滤
  839. const { Data } = await mychartInterface.getChartInClassify({ChartInfoId: id });
  840. this.selectArr = this.classifyList
  841. .map((item) => ({
  842. name: item.MyChartClassifyName,
  843. value: item.MyChartClassifyId,
  844. }))
  845. .filter((x) => !Data.includes(x.value));
  846. this.isClassifyDia = true;
  847. },
  848. },
  849. mounted() {
  850. if(this.$route.query.id) {
  851. this.select_classify = Number(this.$route.query.id)
  852. this.ispublic = 1
  853. }else {
  854. this.select_classify = sessionStorage.getItem('myChartOpt')
  855. ? Number(sessionStorage.getItem('myChartOpt'))
  856. : 0;
  857. this.ispublic=sessionStorage.getItem('myChartIspublic')? Number(sessionStorage.getItem('myChartIspublic')): '';
  858. }
  859. //从图库框架跳转来的
  860. if(this.$route.query.frameId){
  861. this.select_classify = Number(this.$route.query.frameId)
  862. this.ispublic = ''
  863. }
  864. this.getClassify();
  865. this.getPublicClassify();
  866. },
  867. };
  868. </script>
  869. <style lang="scss">
  870. @import "../chartFrame_manage/css/customTree.scss";
  871. .mychart_container {
  872. position: relative;
  873. .right-item-box {
  874. display:flex;
  875. align-items: center;
  876. img {
  877. width: 16px;
  878. }
  879. .el-dropdown-link-img {
  880. width: 18px;
  881. cursor: pointer;
  882. }
  883. }
  884. .right-content {
  885. position: fixed;
  886. left: 40%;
  887. top: 20%;
  888. background: #fff;
  889. padding: 6px 0;
  890. border: 1px solid #999;
  891. box-shadow: 0 1px 4px #999;
  892. z-index: 2;
  893. li {
  894. padding: 5px 60px;
  895. margin: 5px 0;
  896. color: #333;
  897. &:hover {
  898. background: #ddd;
  899. cursor: pointer;
  900. }
  901. }
  902. }
  903. .flip-list-move {
  904. transition: transform 0.4s;
  905. }
  906. .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner {
  907. background-color: #409eff !important;
  908. border-color: #409eff;
  909. }
  910. .el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner {
  911. background-color: #409eff !important;
  912. border-color: #409eff;
  913. }
  914. .el-card .el-card__header {
  915. padding: 14px 20px;
  916. }
  917. .slide-icon {
  918. padding: 20px 0;
  919. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.3);
  920. border-radius: 5px;
  921. cursor: pointer;
  922. position: absolute;
  923. top: 50%;
  924. transform: translateY(-50%);
  925. z-index: 99;
  926. &:hover {
  927. background-color: rgba(0, 0, 0, 0.05);
  928. }
  929. &.slide-left {
  930. right: 0;
  931. }
  932. &.slide-right {
  933. left: -30px;
  934. }
  935. }
  936. .el-icon-refresh {
  937. font-size: 17px;
  938. margin-left: 5px;
  939. cursor: pointer;
  940. }
  941. display: flex;
  942. div::-webkit-scrollbar {
  943. width: 5px !important;
  944. }
  945. .main-left {
  946. width: 300px;
  947. min-width: 300px;
  948. background: #fff;
  949. margin-right: 20px;
  950. border: 1px solid #ececec;
  951. border-radius: 4px;
  952. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.05);
  953. min-height: calc(100vh - 113px);
  954. overflow: hidden;
  955. position: relative;
  956. box-sizing: border-box;
  957. .left-top {
  958. padding: 30px 20px 15px;
  959. .add-cont {
  960. cursor: pointer;
  961. font-size: 15px;
  962. color: #409eff;
  963. }
  964. }
  965. .left-bottom {
  966. padding: 15px 0 30px;
  967. overflow: auto;
  968. max-height: calc(100vh - 290px);
  969. position: relative;
  970. margin-right: 20px;
  971. .classify-item {
  972. padding: 10px 30px;
  973. display: flex;
  974. justify-content: space-between;
  975. align-items: center;
  976. &.act {
  977. background: #e0eefd;
  978. color: #409eff;
  979. }
  980. }
  981. .classify-type {
  982. margin-bottom: 8px;
  983. padding-left: 15px;
  984. }
  985. .public-classify {
  986. margin-bottom: 20px;
  987. .tree-wrap{
  988. padding:15px;
  989. }
  990. }
  991. }
  992. .noclassify {
  993. margin: 50px 0;
  994. display: flex;
  995. align-items: center;
  996. justify-content: center;
  997. color: #409eff;
  998. font-size: 16px;
  999. cursor: pointer;
  1000. }
  1001. .move-btn {
  1002. height: 100%;
  1003. width: 4px;
  1004. position: absolute;
  1005. right: 0px;
  1006. top: 0;
  1007. z-index: 99;
  1008. &:hover {
  1009. cursor: col-resize;
  1010. }
  1011. }
  1012. }
  1013. .main-right {
  1014. width: 80%;
  1015. position: relative;
  1016. .mx-datepicker {
  1017. width: 220px !important;
  1018. }
  1019. .nodata {
  1020. height: calc(100vh - 240px);
  1021. text-align: center;
  1022. font-size: 16px;
  1023. color: #666;
  1024. .sharer {
  1025. color: #333;
  1026. font-size: 14px;
  1027. position: absolute;
  1028. right: 0;
  1029. top: 0;
  1030. }
  1031. }
  1032. /* =================== */
  1033. .chart-min-cont {
  1034. background: #fff;
  1035. border: 1px solid #ececec;
  1036. height: calc(100vh - 118px);
  1037. overflow: auto;
  1038. border-radius: 4px;
  1039. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.05);
  1040. .cont-top {
  1041. padding: 12px 30px;
  1042. border-bottom: 1px solid #ececec;
  1043. display: flex;
  1044. justify-content: space-between;
  1045. align-items: center;
  1046. box-shadow: 0px 3px 6px rgba(167, 167, 167, 0.09);
  1047. .top-left {
  1048. .year-btn {
  1049. font-size: 14px;
  1050. margin-right: 5px;
  1051. margin-bottom: 5px;
  1052. }
  1053. .btn-sty {
  1054. font-size: 16px;
  1055. padding: 10px;
  1056. border: 1px solid #409eff;
  1057. }
  1058. }
  1059. .top-right {
  1060. .span-item {
  1061. font-size: 16px;
  1062. color: #409eff;
  1063. cursor: pointer;
  1064. &:hover {
  1065. text-decoration: underline;
  1066. }
  1067. .el-icon-collection,
  1068. .el-icon-document-copy {
  1069. color: #409eff;
  1070. }
  1071. }
  1072. }
  1073. }
  1074. .cont-bottom {
  1075. padding: 30px;
  1076. .el-input__inner {
  1077. height: 27px;
  1078. line-height: 27px;
  1079. padding: 0 4px;
  1080. }
  1081. .el-input-number .el-input__inner {
  1082. padding: 0 34px 0 4px;
  1083. }
  1084. .el-color-picker--mini .el-color-picker__trigger {
  1085. width: 60px;
  1086. height: 25px;
  1087. padding: 0;
  1088. }
  1089. .el-color-picker--mini .el-color-picker__mask {
  1090. width: 60px;
  1091. height: 25px;
  1092. }
  1093. .el-table__expanded-cell {
  1094. padding: 20px 26px;
  1095. }
  1096. .highcharts-range-selector-group {
  1097. display: none;
  1098. .highcharts-input-group {
  1099. display: none;
  1100. }
  1101. }
  1102. .highcharts-axis-title {
  1103. display: block;
  1104. }
  1105. .calendar-cont {
  1106. display: block;
  1107. margin: 10px auto 0;
  1108. text-align: center;
  1109. }
  1110. /* =================== */
  1111. .chart-show-cont {
  1112. margin-bottom: 15px;
  1113. padding: 0 120px 20px;
  1114. position: relative;
  1115. .chart-title {
  1116. font-size: 16px;
  1117. font-weight: normal;
  1118. text-align: center;
  1119. margin-bottom: 10px;
  1120. }
  1121. .chart-author {
  1122. font-size: 14px;
  1123. color: #333;
  1124. position: absolute;
  1125. bottom: 20px;
  1126. right: 38px;
  1127. }
  1128. .chartWrapper {
  1129. position: relative;
  1130. .range-cont {
  1131. position: absolute;
  1132. top: 13%;
  1133. .min-data-input {
  1134. width: 70px;
  1135. display: block;
  1136. margin-top: 354px;
  1137. }
  1138. &.left {
  1139. left: -80px;
  1140. }
  1141. &.right {
  1142. right: -80px;
  1143. }
  1144. }
  1145. }
  1146. }
  1147. .options-cont {
  1148. display: flex;
  1149. flex-wrap: wrap;
  1150. justify-content: space-between;
  1151. }
  1152. }
  1153. }
  1154. }
  1155. .drawImg {
  1156. position: absolute;
  1157. top: -999px;
  1158. z-index: -100;
  1159. }
  1160. /* ===================== */
  1161. .chart-public-cont {
  1162. color: #333;
  1163. .el-card .el-card__header,
  1164. .el-card__body {
  1165. padding: 10px;
  1166. }
  1167. .cont-top {
  1168. display: flex;
  1169. justify-content: space-between;
  1170. }
  1171. .chart-public-list {
  1172. margin-top: 10px;
  1173. height: calc(100vh - 143px);
  1174. overflow: hidden;
  1175. overflow-y: auto;
  1176. .drag-cont {
  1177. width: 100%;
  1178. display: flex;
  1179. flex-wrap: wrap;
  1180. }
  1181. .dragShdow {
  1182. box-shadow: 0 1px 8px rgba(64, 158, 255, 0.8);
  1183. opacity: 0.5;
  1184. }
  1185. .public-chart-item {
  1186. .item-top {
  1187. display: flex;
  1188. justify-content: space-between;
  1189. align-items: center;
  1190. font-size: 16px;
  1191. font-weight: 600;
  1192. position: relative;
  1193. }
  1194. .chart-img {
  1195. width: 100%;
  1196. height: 230px;
  1197. object-fit: fill !important;
  1198. cursor: pointer;
  1199. }
  1200. .item-bottom {
  1201. margin-top: 10px;
  1202. display: flex;
  1203. justify-content: space-between;
  1204. color: #666;
  1205. font-size: 12px;
  1206. .join_txt {
  1207. color: #f00;
  1208. cursor: pointer;
  1209. &.move_txt {
  1210. color: #409eff;
  1211. }
  1212. }
  1213. }
  1214. }
  1215. }
  1216. }
  1217. }
  1218. .el-dropdown-menu-item-chat {
  1219. display: flex !important;
  1220. align-items: center !important;
  1221. img {
  1222. width: 16px;
  1223. margin-right: 8px;
  1224. }
  1225. &:hover {
  1226. background-color: #F5F7FA !important;
  1227. color: #606266 !important;
  1228. }
  1229. }
  1230. .el-dropdown-menu .el-dropdown-menu-item-chat-act {
  1231. color: #66b1ff !important;
  1232. }
  1233. </style>