create1.vue 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339
  1. <!-- -->
  2. <template>
  3. <div >
  4. <el-breadcrumb class="divi2" separator-class="el-icon-arrow-right">
  5. <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
  6. <el-breadcrumb-item :to="{ path: '/visi-dataset'}">数据集管理</el-breadcrumb-item>
  7. <el-breadcrumb-item>静态数据集</el-breadcrumb-item>
  8. </el-breadcrumb>
  9. <el-divider class="divi"></el-divider>
  10. <div class="title_score">
  11. <!-- el-form 中添加 status-icon 可检测状态-->
  12. <el-form :inline="true" ref = "dataInfo" :model="dataInfo" :rules="datarules" class="demo-form-inline">
  13. <el-form-item label="数据集名称" prop="datasetName">
  14. <el-input style="width: 260px;" v-model="dataInfo.datasetName" placeholder="请输入数据集内容" ></el-input>
  15. </el-form-item>
  16. <el-form-item label="类别" prop="classificationtag" style="margin-left: 20px">
  17. <el-select v-model="dataInfo.classificationtag"
  18. filterable
  19. allow-create
  20. ref = 'classfi'
  21. @change="demo1()">
  22. <el-option style="width: 260px;" v-for="data in classification" :key="data.categoryId" :label="data.categoryName" :value="data.categoryId">
  23. </el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="备注" prop="remarks" style="margin-left: 20px" >
  27. <el-input style="width: 300px;" v-model = "dataInfo.remarks" ref = 'remarks' clearable placeholder="备注" ></el-input>
  28. </el-form-item>
  29. <el-form-item>
  30. <el-button type="primary" @click="getPythonKafkaTmp()">获得代码模板</el-button>
  31. </el-form-item>
  32. </el-form>
  33. </div>
  34. <div class="body"> <!-- 数据框整体大小 -->
  35. <div class="allDiv"> <!-- 初始界面 -->
  36. <div class="leftDiv"> <!-- 控制左边树形区域的div -->
  37. <div style="height: 60%">
  38. <div class="leftDivTitle"><!-- 控制左边树形区域的上方的div -->
  39. <el-tag style=" width: 100%;text-align: center;height: 31px">系统数据</el-tag>
  40. </div>
  41. <div class="leftDivTree" > <!-- 控制左边树形区域的下方的div -->
  42. <el-tree
  43. v-if="showTree"
  44. id = 'tree'
  45. node-key="subEquipmentid"
  46. :props="treeDefaultProps"
  47. ref="tree"
  48. :load="loadTreeNode"
  49. lazy
  50. draggable
  51. :allow-drag="allowdrag"
  52. :allow-drop="allowDrop"
  53. @node-drag-end = "treeNodeDragEnd">
  54. <!-- @node-click="treeNodeClick">-->
  55. <span class="custom-tree-node" slot-scope="{ node, data }">
  56. <span>
  57. <i :class="data.icon" style="margin-right: 4px"></i>{{ node.label }}
  58. </span>
  59. </span>
  60. </el-tree>
  61. </div>
  62. </div>
  63. <div style="height: 35.7%;margin-top: 3.1%">
  64. <el-tag style=" width: 100%;text-align: center;border-top:0.2px solid #000;height: 31px">本地数据</el-tag>
  65. <div class="leftDivTree" > <!-- 控制左边树形区域的下方的div -->
  66. <el-tree
  67. v-if="showTree"
  68. id = 'static_tree'
  69. :data="static_treedata"
  70. :props="treeDefaultProps"
  71. draggable
  72. :allow-drag="st_allowdrag"
  73. :allow-drop="st_allowDrop"
  74. @node-drag-end = "st_treeNodeDragEnd">
  75. <!-- @node-click="treeNodeClick">-->
  76. <span class="custom-tree-node" slot-scope="{ node, data }">
  77. <span>
  78. <i :class="data.icon" style="margin-right: 8px" ></i>{{ node.label }}
  79. </span>
  80. </span>
  81. </el-tree>
  82. </div>
  83. </div>
  84. </div>
  85. <div class="midDiv"> <!-- 控制中间区域的div -->
  86. <div class="midDivTop">
  87. <div class="midDivTopImg">
  88. <el-tooltip content="运行" placement="bottom-end" effect="dark">
  89. <i @mouseover="yunXingMouseOver"
  90. @mouseleave="yunXingMouseLeave" id='yunXing' @click="yunXingClick"
  91. style="height: 50px;width: 50px; margin: 10px 5px 10px 10px ;font-size: 23px;"
  92. class="iconfont icon-yunXang"></i>
  93. </el-tooltip>
  94. <el-tooltip content="预览" placement="bottom-end" effect="dark">
  95. <i @mouseover="yuLanMouseOver"
  96. @mouseleave="yuLanMouseLeave" id="yuLan" @click="preview"
  97. style="height: 25px;width: 25px; margin: 10px 5px 10px 10px;font-size: 23px;"
  98. class = 'iconfont icon-preview'>
  99. </i>
  100. </el-tooltip>
  101. <el-tooltip content="日志" effect="dark">
  102. <i @mouseover="riZhiMouseOver"
  103. @mouseleave="riZhiMouseLeave" id="riZhi" @click=shourizhi()
  104. style="height: 25px;width: 25px; margin: 10px 5px 10px 10px;font-size: 23px;"
  105. class = 'iconfont icon-tishi'>
  106. </i>
  107. </el-tooltip>
  108. </div>
  109. </div> <!-- 控制中间区域的上方div -->
  110. <div class="midDivData">
  111. <div class="dy_datasourceDiv" id="dy_drag" @dragover="dragDragOver" @dragleave="dragDragLeave">
  112. <el-divider><i class=" icon iconfont icon-xitong2"></i></el-divider>
  113. <div v-for="subEquipment in subEquipments" :key="subEquipment.key" style="display: inline-block">
  114. <div style="margin-left: 10px; margin-top:10px" @mouseover="subEquipment.quXiao = true" @mouseleave="subEquipment.quXiao = false">
  115. <i draggable="true" v-if="subEquipment.table"
  116. style="margin: 5px 10px 10px 15px;vertical-align: middle"
  117. :class=subEquipment.icon
  118. @click="handleClick(subEquipment.id)"
  119. @dblclick="dblClick(subEquipment.id)">
  120. </i>
  121. <i style="position: absolute;" :id = subEquipment.id v-if="subEquipment.quXiao"
  122. @mouseover="quXiaoMouseOver(subEquipment.id)"
  123. @mouseleave="quXiaoMouseLeave(subEquipment.id)"
  124. @click="quXiao(subEquipment.id)"
  125. class="iconfont icon-quxiao"></i>
  126. <span class="demonstration" style="vertical-align: middle;display: block;font-size: 1px; margin-top: 5px;text-align: center">{{ subEquipment.imageTable.tableName }}</span>
  127. </div>
  128. </div>
  129. </div>
  130. <div class="st_datasourceDiv" id="statle_drag" @dragover="st_dragDragOver" @dragleave="st_dragDragLeave">
  131. <el-divider><i class=" icon iconfont icon-local"></i></el-divider>
  132. <div v-for="localUp in localUps" :key="localUp.key" style="display: inline-block">
  133. <div style="margin-left: 10px; margin-top:10px" @mouseover="localUp.quXiao = true" @mouseleave="localUp.quXiao = false">
  134. <i draggable="true" v-if="true"
  135. style="margin: 5px 10px 10px 15px;vertical-align: middle"
  136. :class=localUp.icon
  137. @click="st_handleClick(localUp)"
  138. @dblclick="st_dblClick(localUp)">
  139. </i>
  140. <i style="position: absolute;" :id = localUp.id v-if="localUp.quXiao"
  141. @mouseover="quXiaoMouseOver(localUp.id)"
  142. @mouseleave="quXiaoMouseLeave(localUp.id)"
  143. @click="st_quXiao(localUp)"
  144. class="iconfont icon-quxiao"></i>
  145. <span class="demonstration" style=" text-align: center;display: block;font-size: 1px; margin-top: 5px;">{{ localUp.indexContent }}</span>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="rizhiDiv" v-if="showRiZhi">
  150. <el-tag>日志</el-tag>
  151. <div class="rizhiDivtext">
  152. <span v-text="soutRizhi"></span>
  153. </div>
  154. </div>
  155. </div><!-- 控制中间区域的数据输入区的div -->
  156. </div>
  157. <div class="rightDiv" v-if="true"> <!-- 控制右侧属性区域的div -->
  158. <el-tag style=" width: 100%;text-align: center;border-bottom: 0.2px solid #000000;" >{{detailTitle.worldName}}</el-tag>
  159. <el-table
  160. :data="tableData"
  161. :row-style="{height:'0'}"
  162. :cell-style="{padding:'0'}"
  163. v-loading = "dataListLoading"
  164. size="100%"
  165. height=95%
  166. border
  167. >
  168. <el-table-column v-for="tablelist in tablelists" :key="tablelist.id"
  169. :prop='tablelist.prop'
  170. :label="tablelist.label">
  171. </el-table-column>
  172. </el-table>
  173. </div>
  174. </div>
  175. <div class="pop"><!-- 各种弹窗 -->
  176. <!-- 子设备字段选择弹窗 -->
  177. <el-dialog title="子设备配置"
  178. :close-on-click-modal="false"
  179. :visible.sync="showEqumField"
  180. width="40%"
  181. @mouseover.native="showChooseAddTitle"
  182. append-to-body>
  183. <div style="text-align: center;margin-top: -20px;">
  184. <span style="width: 10%">子设备名称 : </span>
  185. <el-input v-model="detailTitle.worldName" style="margin-left: 20px; height:10%;width: 40%"></el-input>
  186. </div>
  187. <div style="margin-top: 10px;margin-left: 25px;">
  188. <el-transfer
  189. filterable
  190. :titles="['待选字段', '已选字段']"
  191. @change="changeMeasurepoint"
  192. v-model="sureSelect"
  193. :data="selectData"
  194. />
  195. </div>
  196. <span slot="footer" class="dialog-footer">
  197. <el-button @click="showEqumField = false">取 消</el-button>
  198. <el-button type="primary" @click="closeEqupField">确 定</el-button>
  199. </span>
  200. </el-dialog>
  201. <!-- 字段预览弹窗 -->
  202. <el-dialog title="预览"
  203. :visible.sync="showPreview"
  204. width="40%"
  205. append-to-body>
  206. <el-tabs type="border-card">
  207. <el-tab-pane>
  208. <span slot="label">{{predatasetName}}</span>
  209. <!-- <i class="iconfont icon-xitong4"></i>-->
  210. <el-divider class="tableDivider"></el-divider>
  211. <el-table
  212. :data="preTableDate"
  213. height="250"
  214. border
  215. v-loading = 'prewListLoading'
  216. style="width: 100%">
  217. <el-table-column v-for="preTalblelist in preTalbelists" :key="preTalblelist.id"
  218. :prop="preTalblelist.prop"
  219. :label="preTalblelist.label"
  220. width="180">
  221. </el-table-column>
  222. </el-table>
  223. </el-tab-pane>
  224. <!-- <el-tab-pane label="word"></el-tab-pane>-->
  225. <!-- <el-tab-pane label="图片"></el-tab-pane>-->
  226. </el-tabs>
  227. <span slot="footer" class="dialog-footer">
  228. <el-button @click="showPreview = false">取 消</el-button>
  229. <el-button type="primary" @click="showPreview = false">确 定</el-button>
  230. </span>
  231. </el-dialog>
  232. <el-dialog custom-class="cron-box-dialog-first" :visible.sync="dialogVisible" v-if="dialogVisible">
  233. <mycron v-bind:extractionPeriod.sync="dataInfo.extractionPeriod"></mycron>
  234. </el-dialog>
  235. <!-- 本地数据上传-->
  236. <static-up-load-excel v-if="st_upShow.excel" ref="staticUploadExcel" > </static-up-load-excel>
  237. <staticup-load-csv v-if="st_upShow.word" ref="staticUploadCsv"></staticup-load-csv>
  238. <empty v-if="st_upShow.other" ref="othersUpload"></empty>
  239. </div>
  240. </div>
  241. <div style="text-align: right;margin-top: -135px;margin-right: 80px;position:relative;z-index: 999">
  242. <el-button >取消</el-button>
  243. <el-button type="primary" @click="stdySubmit(dataInfo) " >确定</el-button>
  244. </div>
  245. <PythonKafkaTmp v-if="pythonKafkaVisible" ref="pythonKafkaTmp" @refreshDataList="getDataList"></PythonKafkaTmp>
  246. </div>
  247. </template>
  248. <script>
  249. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  250. // 例如:import 《组件名称》 from '《组件路径》';
  251. import mycron from './quartz/mycron'
  252. import staticUpLoadExcel from './com/static_upLoad_excel'
  253. import staticupLoadCsv from './com/static_upLoad_csv'
  254. import empty from './com/empty'
  255. import PythonKafkaTmp from '../alg/python-kafka-tmp.vue'
  256. import { MessageBox } from 'element-ui'
  257. import { Message } from 'element-ui'
  258. export default {
  259. // import引入的组件需要注入到对象中才能使用
  260. components: {mycron, staticUpLoadExcel, empty, PythonKafkaTmp, staticupLoadCsv},
  261. data () {
  262. var checkExtractionPeriod = (rule, value, callback) => {
  263. if (!value) {
  264. return callback(new Error('抽取周期不能为空'))
  265. } else {
  266. return callback()
  267. }
  268. }
  269. // 这里存放数据
  270. return {
  271. dataInfo: {
  272. datasetName: '', // 数据集名称
  273. classificationtag: 1,
  274. remarks: ''
  275. },
  276. measurepoint: [], // 你要的数据在这儿
  277. pythonKafkaVisible: false,
  278. dataListLoading: false,
  279. prewListLoading: false,
  280. classification: [],
  281. predatasetName: '数据集预览', // 预览是时候显示的表头信息
  282. // base_url: 'http://localhost:8086/',
  283. showTree: true, // 获取树的数据后 更新数据
  284. showInfo: false, // 属性数据预览
  285. showRiZhi: false, // 控制日志的显隐
  286. soutRiZhiSucess: '-------------------------------success--------------------------' + '\n\n',
  287. soutRizhi: '运行过程,将会显示在这儿 。再次点击日志图标,将关闭窗口', // 输出日志内容‘
  288. showPreview: false, // 控制预览窗口的显隐
  289. showTable: false,
  290. userID: this.$store.state.user.id, // 用户编号
  291. ildName: '', // 制作数据集时,之后留下的文件名称 方便改为用户指定的名字。
  292. subEquipments: [], // 存储拖拽的子设备
  293. yunXingUid: 0, // 点击运行后,命名产生的文件名
  294. localUps: [], // 存储本地上传的数据
  295. dragFlg: 0, // 判断是否拖拽至指定区域
  296. subEquipmentId: 0, // 拖拽子设备的id 从0开始
  297. st_upShow: {
  298. word: false,
  299. excel: false,
  300. pic: false,
  301. video: false,
  302. other: false
  303. }, // 本地文件上传
  304. localUpId: {
  305. id: 0,
  306. wordID: 0,
  307. excelID: 0,
  308. picID: 0,
  309. videoID: 0
  310. }, // 本地上传文件id
  311. selectData: [], // 存储子设备字段
  312. sureSelect: [], // 存储已经选择的子设备字段
  313. showEqumField: false, // 控制子设备段显隐
  314. imsql: [], // 向后台提交是数据 包括:所属煤矿、系统、子系统、设备等 以及选择的字段,hbase的地址
  315. st_imsql: [], // 向后台提交是本地数据
  316. // 记录当前双击的数据
  317. sign: {
  318. type: '',
  319. id: null
  320. },
  321. clicktime: null, // 用于解决双击会触发两次单击事件
  322. dialogVisible: false,
  323. detailTitle: { // 右侧属性框表头
  324. worldName: '属性信息'
  325. },
  326. tablelists: [], // 子设备字段名
  327. tableData: [], // 子设备数据
  328. preTalbelists: [{
  329. prop: 'ziduan',
  330. label: '字段'
  331. }], // 选择的子设备字段
  332. preTableDate: [], // 选择的子设备字段对应的数据
  333. static_treedata: [{
  334. icon: 'iconfont icon-Word',
  335. name: '文本数据 ',
  336. limit: 'word'
  337. }, {
  338. icon: 'iconfont icon-Excel',
  339. name: 'excel数据 ',
  340. limit: 'excel'
  341. }, {
  342. icon: 'iconfont icon-tupian',
  343. name: '图片数据 ',
  344. limit: 'pic'
  345. }, {
  346. icon: 'iconfont icon-shipin_huabanfuben',
  347. name: '视频数据 ',
  348. limit: 'video'
  349. }],
  350. treeDefaultProps: {
  351. children: 'children',
  352. label: 'name',
  353. isLeaf: 'leaf'
  354. },
  355. datarules: {
  356. datasetName: [
  357. { required: true, message: '请输入数据集名称', trigger: 'blur' },
  358. { min: 3, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' }
  359. ],
  360. extractionPeriod: [
  361. { validator: checkExtractionPeriod, trigger: 'blur' }
  362. ]
  363. }
  364. }
  365. },
  366. // 监听属性 类似于data概念
  367. computed: {},
  368. // 监控data中的数据变化
  369. watch: {
  370. 'dataInfo.datasetName' (oldval, newval) {
  371. this.predatasetName = newval + '预览'
  372. },
  373. 'dataInfo.extractionPeriod' () {
  374. this.$refs['dataInfo'].validateField('extractionPeriod')
  375. }
  376. },
  377. // 方法集合
  378. methods: {
  379. // 手动给穿梭框内容添加title
  380. showChooseAddTitle (e) {
  381. // let dom = e.target;
  382. // if (dom.title) return;
  383. // dom.title = dom.innerText;
  384. },
  385. changeMeasurepoint (value, direction, movedKeys) {
  386. let measurepointID
  387. // 对于静态数据集 字段也会触发 从而造成undefined 错误 但是对于数据不影响 ***************************************************
  388. for (let i = 0; i < movedKeys.length; i++) {
  389. const sign = movedKeys[i]
  390. measurepointID = this.selectData[sign].measurepointId
  391. if (direction === 'right') {
  392. this.measurepoint.push(measurepointID)
  393. } else {
  394. this.measurepoint.splice(this.measurepoint.indexOf(measurepointID), 1)
  395. }
  396. }
  397. },
  398. demo1 () {
  399. if (typeof this.dataInfo.classificationtag !== 'number') {
  400. MessageBox.confirm(
  401. `确定新增分类[${this.dataInfo.classificationtag}]?`,
  402. '提示',
  403. {
  404. confirmButtonText: '确定',
  405. cancelButtonText: '取消',
  406. type: 'warning'
  407. }
  408. ).then(() => {
  409. this.$http({
  410. url: this.$http.adornUrl(`/category/save`),
  411. method: 'post',
  412. data: this.$http.adornData({
  413. 'categoryId': undefined,
  414. 'categoryName': this.dataInfo.classificationtag
  415. })
  416. }).then(({data}) => {
  417. if (data && data.code === 0) {
  418. // 更新this.dataInfo.classificationtag 为最新的分类ID
  419. this.classificationList()
  420. this.$refs.classfi.blur()
  421. this.$refs.remarks.focus()
  422. // = this.dataInfo.classificationtag
  423. }
  424. })
  425. }).catch(() => {
  426. this.dataInfo.classificationtag = ''
  427. })
  428. }
  429. },
  430. yunXingMouseOver () {
  431. document.getElementById('yunXing').className = 'iconfont icon-yunXang1'
  432. },
  433. yunXingMouseLeave () {
  434. document.getElementById('yunXing').className = 'iconfont icon-yunXang'
  435. },
  436. async yunXingClick () {
  437. this.showRiZhi = true
  438. this.soutRizhi = '检测设备状态完毕,开始抽取数据....' + '\n\n' + '....' // 输出日志内容
  439. this.yunXingUid = new Date().getTime()
  440. for (let i = 0; i < this.imsql.length; i++) {
  441. if (i === 0) {
  442. this.imsql[i].oldFileName = this.userID + '_' + this.imsql[i].subEquipmentID + '_' + this.imsql[i].id
  443. this.imsql[i].newFileName = this.imsql[i].oldFileName
  444. if (this.imsql.length === 1) {
  445. this.imsql[i].oldFileName = this.userID + '_' + this.yunXingUid
  446. this.imsql[i].newFileName = this.userID + '_' + this.yunXingUid
  447. }
  448. } else if (i === this.imsql.length - 1) {
  449. this.imsql[i].oldFileName = this.imsql[i - 1].newFileName
  450. this.imsql[i].newFileName = this.userID + '_' + this.yunXingUid
  451. } else {
  452. this.imsql[i].oldFileName = this.imsql[i - 1].newFileName
  453. this.imsql[i].newFileName = this.userID + '_' + this.imsql[i].subEquipmentID + '_' + this.imsql[i].id
  454. }
  455. }
  456. var onlyStatic = true
  457. for (let j = 0; j < this.imsql.length; j++) {
  458. await this.$http({
  459. url: this.$http.adornUrl('/dataset/dynamic/makeDyDataSet'),
  460. method: 'post',
  461. data: this.$http.adornData(this.imsql[j], false)
  462. }).then(subresult => {
  463. var context = subresult.data
  464. this.soutRizhi = context.info + '\n\n' + this.soutRizhi
  465. })
  466. onlyStatic = false
  467. }
  468. if (this.st_imsql.length > 0) {
  469. this.soutRizhi = '\n' + '开始组合本地数据' + '\n\n' + this.soutRizhi
  470. }
  471. for (let i = 0; i < this.st_imsql.length; i++) {
  472. if (i === 0) {
  473. this.st_imsql[i].oldFileName = this.userID + '_' + this.yunXingUid
  474. this.st_imsql[i].newFileName = this.st_imsql[i].oldFileName
  475. if (this.st_imsql.length === 1) {
  476. this.st_imsql[i].oldFileName = this.userID + '_' + this.yunXingUid
  477. this.st_imsql[i].newFileName = this.userID + '_' + this.yunXingUid
  478. }
  479. } else if (i === this.st_imsql.length - 1) {
  480. this.st_imsql[i].oldFileName = this.st_imsql[i - 1].newFileName
  481. this.st_imsql[i].newFileName = this.userID + '_' + this.yunXingUid
  482. } else {
  483. this.st_imsql[i].oldFileName = this.st_imsql[i - 1].newFileName
  484. this.st_imsql[i].newFileName = this.userID + '_' + this.st_imsql[i].subEquipmentID + '_' + this.st_imsql[i].id
  485. }
  486. }
  487. for (let sti = 0; sti < this.st_imsql.length; sti++) {
  488. var massage = {
  489. 'st_imsql': this.st_imsql[sti],
  490. 'onlyStatic': onlyStatic
  491. }
  492. await this.$http({
  493. url: this.$http.adornUrl('/dataset/static/makeStaticDataSet'),
  494. method: 'post',
  495. data: this.$http.adornData(massage, false)
  496. }).then(subresult => {
  497. this.soutRizhi = subresult.data.info + '\n\n' + this.soutRizhi
  498. })
  499. }
  500. this.soutRizhi = this.soutRiZhiSucess + '静态数据测试抽取完成,点击确定制作数据集' + '\n\n' + this.soutRizhi
  501. },
  502. yuLanMouseOver () {
  503. document.getElementById('yuLan').className = 'iconfont icon-preview1'
  504. },
  505. yuLanMouseLeave () {
  506. document.getElementById('yuLan').className = 'iconfont icon-preview'
  507. },
  508. preview () {
  509. this.prewListLoading = true
  510. this.preTalbelists = [] // 将原始默认数据清空
  511. for (var i = 0; i < this.imsql.length; i++) {
  512. for (let j = 0; j < this.imsql[i].chosedata.length; j++) {
  513. this.preTalbelists.push({
  514. prop: this.imsql[i].subEquipmentID + '_' + this.imsql[i].chosedata[j],
  515. label: this.imsql[i].subEquipmentID + '_' + this.imsql[i].chosedataZh[j]
  516. })
  517. }
  518. }
  519. // 加载静态 列数据
  520. for (let sti = 0; sti < this.st_imsql.length; sti++) {
  521. for (let stj = 0; stj < this.st_imsql[sti].sql.length; stj++) {
  522. this.preTalbelists.push({
  523. prop: this.st_imsql[sti].id + '_' + this.st_imsql[sti].sql[stj],
  524. label: this.st_imsql[sti].sql[stj]
  525. })
  526. }
  527. }
  528. // 获取数据
  529. this.$http({
  530. url: this.$http.adornUrl('/dataset/dynamic/getprecontent'),
  531. method: 'post',
  532. data: this.$http.adornData(this.imsql, false)
  533. }).then(preDatas => {
  534. this.$http({
  535. url: this.$http.adornUrl('/dataset/staticup/getstapre'),
  536. method: 'post',
  537. data: this.$http.adornData({
  538. 'data': preDatas.data.preContent,
  539. 'loacl': this.st_imsql
  540. }, false)
  541. }).then(res => {
  542. this.preTableDate = res.data.data
  543. this.prewListLoading = false
  544. })
  545. })
  546. this.showPreview = true
  547. },
  548. riZhiMouseOver () {
  549. document.getElementById('riZhi').className = 'iconfont icon-tishi1'
  550. },
  551. riZhiMouseLeave () {
  552. document.getElementById('riZhi').className = 'iconfont icon-tishi'
  553. },
  554. shourizhi () {
  555. this.showRiZhi = !this.showRiZhi
  556. },
  557. quXiaoMouseOver (id) {
  558. document.getElementById(id).className = 'iconfont icon-quxiao1'
  559. },
  560. quXiaoMouseLeave (id) {
  561. document.getElementById(id).className = 'iconfont icon-quxiao'
  562. },
  563. quXiao (id) {
  564. this.dataListLoading = false
  565. for (let i = 0; i < this.subEquipments.length; i++) {
  566. // 找到对应的设备 删除
  567. if (id === this.subEquipments[i].id) {
  568. this.$refs.tree.getNode(this.subEquipments[i].sql.subEquipmentID).data.icon = 'iconfont icon-xitong3'
  569. this.$refs.tree.getNode(this.subEquipments[i].sql.subEquipmentID).data.limit = 'children'
  570. // 看当前左侧属性栏显示的数据 ,是否为该设备 ,如果是,进行清除
  571. if (this.detailTitle.worldName === this.subEquipments[i].imageTable.tableName) {
  572. this.detailTitle.worldName = '属性信息'
  573. this.tablelists = []
  574. this.tableData = []
  575. }
  576. // 删除对应的测量点ID
  577. this.subEquipments[i].filedList.forEach((info) => {
  578. var number = this.measurepoint.indexOf(info)
  579. if (number === -1) {
  580. this.measurepoint.splice(number, 1)
  581. }
  582. })
  583. // 删除
  584. this.subEquipments.splice(i, 1)
  585. }
  586. }
  587. for (let j = 0; j < this.imsql.length; j++) {
  588. if (id === this.imsql[j].id) {
  589. this.imsql.splice(j, 1)
  590. }
  591. }
  592. },
  593. st_quXiao (info) {
  594. for (let i = 0; i < this.localUps.length; i++) {
  595. if (info.id === this.localUps[i].id) {
  596. this.localUps.splice(i, 1)
  597. if (this.detailTitle.worldName === info.fileName) {
  598. this.detailTitle.worldName = '属性信息'
  599. this.tablelists = []
  600. this.tableData = []
  601. }
  602. }
  603. }
  604. for (let j = 0; j < this.st_imsql.length; j++) {
  605. if (info.id === this.st_imsql[j].id) {
  606. this.st_imsql.splice(j, 1)
  607. }
  608. }
  609. },
  610. allowdrag (node) {
  611. if (node.data.limit === 'children') { return true }
  612. },
  613. allowDrop () {
  614. return false // 设置树节点内不可拖拽
  615. },
  616. dragDragOver (e) {
  617. this.dragFlg = 1
  618. e.preventDefault()
  619. },
  620. dragDragLeave (e) {
  621. this.dragFlg = 0
  622. },
  623. st_allowdrag (node) {
  624. if (node.data.limit === 'word' || node.data.limit === 'excel' || node.data.limit === 'pic' || node.data.limit === 'video') { return true }
  625. },
  626. st_allowDrop () {
  627. return false // 设置树节点内不可拖拽
  628. },
  629. st_dragDragOver (e) {
  630. this.dragFlg = 0
  631. this.st_dragFlg = 1
  632. e.preventDefault()
  633. },
  634. st_dragDragLeave (e) {
  635. this.st_dragFlg = 0
  636. },
  637. st_treeNodeDragEnd (node) {
  638. if (this.st_dragFlg === 1) {
  639. var localUp = {
  640. id: this.localUpId.id,
  641. table: false, // 子设备图标显隐显隐
  642. nodeId: node.id,
  643. quXiao: false, // 子设备上方取消图标的显隐
  644. fileName: '', // 文件名
  645. upUrl: '', // 上传后的地址
  646. indexContent: '', // 图片上方的内容
  647. filedList: [], // 数据库中子设备字段名
  648. sureSelectList: [], // 选择的子设备字段名
  649. icon: '', // 使用的图标
  650. icons: [], // 所有图标
  651. type: '', // 文件类型
  652. isUp: false // 是否已经上传文件
  653. }
  654. this.localUpId.id++
  655. if (node.data.limit === 'word') {
  656. localUp.icons.push('iconfont icon-Word')
  657. localUp.icons.push('iconfont icon-Word1')
  658. localUp.icon = localUp.icons[0]
  659. this.localUpId.wordID++
  660. localUp.indexContent = 'word_' + this.localUpId.wordID
  661. localUp.type = 'word'
  662. }
  663. if (node.data.limit === 'excel') {
  664. localUp.icons.push('iconfont icon-Excel')
  665. localUp.icons.push('iconfont icon-Excel1')
  666. localUp.icon = localUp.icons[0]
  667. this.localUpId.excelID++
  668. localUp.indexContent = 'excel_' + this.localUpId.excelID
  669. localUp.type = 'excel'
  670. }
  671. if (node.data.limit === 'pic') {
  672. localUp.icons.push('iconfont icon-tupian')
  673. localUp.icons.push('iconfont icon-tupian1')
  674. localUp.icon = localUp.icons[0]
  675. this.localUpId.picID++
  676. localUp.indexContent = '图片_' + this.localUpId.picID
  677. localUp.type = 'pic'
  678. }
  679. if (node.data.limit === 'video') {
  680. localUp.icons.push('iconfont icon-shipin_huabanfuben')
  681. localUp.icons.push('iconfont icon-shipin_huabanfuben1')
  682. localUp.icon = localUp.icons[0]
  683. this.localUpId.videoID++
  684. localUp.indexContent = '视频_' + this.localUpId.videoID
  685. localUp.type = 'video'
  686. }
  687. this.localUps.push(localUp)
  688. this.st_dragFlg = 0
  689. }
  690. },
  691. treeNodeDragEnd (node) {
  692. if (this.dragFlg === 1 && node.data.limit === 'children') {
  693. // 修改属性值,表示该节点已经拖拽过
  694. node.data.limit = 'children-1'
  695. node.data.icon = 'iconfont icon-xitong4'
  696. // this.$set(node.data, 'icon', 'iconfont icon-xitong4')
  697. const subEquipment = {
  698. id: this.subEquipmentId,
  699. table: false, // 子设备图标显隐显隐
  700. nodeId: node.id,
  701. quXiao: false, // 子设备上方取消图标的显隐
  702. indexContent: '', // 图片上方的内容
  703. selectList: [], // 数据库中子设备字段名
  704. sureSelectList: [], // 选择的子设备字段名
  705. filedList: [], // 数据库的字段名
  706. icon: 'icon iconfont icon-xitong1', // 图标
  707. sql: {
  708. id: '', // 记录对应的节点id
  709. coal: '', // 所属煤矿
  710. system: '', // 所属系统
  711. subsystem: '', // 所属子系统
  712. equipment: '', // 所属设备
  713. subEquipment: '', // 子设备名称
  714. subEquipmentID: '', // 子设备名称id
  715. hbaseTableName: '', // 子设备对应的数据存放地址
  716. userID: this.userID, // 执行操作的用户id
  717. chosedata: []// 选择子设备的字段
  718. },
  719. imageTable: {
  720. tableName: '',
  721. tableDB: ''
  722. }
  723. }
  724. subEquipment.imageTable.tableName = node.data.name
  725. subEquipment.imageTable.tableDB = node.parent.data.name
  726. subEquipment.sql.hbaseTableName = node.data.hbaseTableName
  727. subEquipment.sql.subEquipmentID = node.data.subEquipmentid
  728. // 获取hbase 表头信息
  729. this.$http({
  730. url: this.$http.adornUrl('/dataset/dynamic/getheads'),
  731. method: 'post',
  732. data: this.$http.adornData(subEquipment.sql, false)
  733. }).then(tablists => {
  734. var headers = tablists.data.hbaseTableHeaders
  735. if (headers) {
  736. for (let i = 0; i < headers.length; i++) {
  737. var list = {
  738. key: i,
  739. measurepointId: headers[i].measurepointId,
  740. prop: headers[i].name_en,
  741. label: headers[i].name_zh
  742. }
  743. subEquipment.filedList.push(list)
  744. }
  745. }
  746. })
  747. //
  748. // // 拖拽结束后,如果属性区域没显示数据,自动显示拖拽的设备
  749. // if (this.tablelists.length === 0) {
  750. // this.detailTitle.worldName = node.data.name
  751. // this.tablelists = subEquipment.filedList
  752. // }
  753. this.subEquipments.push(subEquipment)
  754. this.subEquipmentId = this.subEquipmentId + 1
  755. for (let i = 0; i < this.subEquipments.length; i++) {
  756. if (node.id === this.subEquipments[i].nodeId) {
  757. this.subEquipments[i].table = true
  758. this.subEquipments[i].indexContent = this.subEquipments[i].imageTable.tableDB + '.' + this.subEquipments[i].imageTable.tableName
  759. this.subEquipments[i].quXiao = false
  760. }
  761. }
  762. this.dragFlg = 0
  763. }
  764. },
  765. treeNodeClick (data, node) {
  766. if (node.data.limit === 'children') {
  767. this.detailTitle.worldName = node.data.name
  768. this.equimentClick()
  769. }
  770. },
  771. handleClick (id) {
  772. this.equimentClick(id)
  773. clearTimeout(this.clicktime) // 首先清除计时器
  774. this.clicktime = setTimeout(() => {
  775. // 这里执行你自己的方法或者业务逻辑
  776. this.equimentClick(id)
  777. }, 300)
  778. },
  779. // 双击事件
  780. dblClick (id) {
  781. clearTimeout(this.clicktime) // 清除
  782. // 这里可以添加你自己双击事件的方法或者逻辑
  783. this.equimentDoubleClick(id)
  784. },
  785. equimentClick (id) {
  786. this.dataListLoading = true
  787. for (let i = 0; i < this.subEquipments.length; i++) {
  788. if (id === this.subEquipments[i].id) {
  789. // 处理两次单击同一个设备
  790. if (this.detailTitle.worldName !== this.subEquipments[i].imageTable.tableName) {
  791. this.tablelists = this.subEquipments[i].filedList
  792. this.detailTitle.worldName = this.subEquipments[i].imageTable.tableName
  793. this.tableData = []
  794. // 获取右侧表格数据
  795. this.$http({
  796. url: this.$http.adornUrl('/dataset/dynamic/getContent'),
  797. method: 'post',
  798. data: this.$http.adornData(this.subEquipments[i].sql, false)
  799. }).then(contextResponse => {
  800. if (contextResponse.data.code === 500) {
  801. this.tableData = []
  802. } else {
  803. // console.log(contextResponse)
  804. const subeqpmContent = JSON.parse(JSON.stringify(contextResponse.data.equmentAll))
  805. this.tableData = subeqpmContent
  806. }
  807. this.dataListLoading = false
  808. })
  809. }
  810. this.showInfo = true
  811. break
  812. }
  813. }
  814. if (this.tableData.length > 0) {
  815. this.dataListLoading = false
  816. }
  817. },
  818. equimentDoubleClick (id) {
  819. this.showEqumField = true
  820. for (let i = 0; i < this.subEquipments.length; i++) {
  821. if (id === this.subEquipments[i].id) {
  822. // 构造向后台传输的数据
  823. this.subEquipments[i].sql.id = this.subEquipments[i].id
  824. this.subEquipments[i].sql.equipment = this.subEquipments[i].imageTable.tableDB
  825. this.subEquipments[i].sql.subEquipment = this.subEquipments[i].imageTable.tableName
  826. this.sign = {
  827. type: 'system',
  828. id: id
  829. }
  830. this.selectData = [] // 将原始字段置空
  831. this.sureSelect = this.subEquipments[i].sureSelectList
  832. this.selectData = this.subEquipments[i].filedList
  833. // if (this.subEquipments[i].selectList.length === 0) { // 判断是否已有字段数据
  834. // this.axios.post(this.base_url + 'getcolumns', this.subEquipments[i].sql).then(response => {
  835. // for (let j = 0; j < response.data.length; j++) {
  836. // this.selectData.push({
  837. // key: j,
  838. // label: response.data[j].name
  839. // })
  840. // }
  841. // })
  842. // this.subEquipments[i].selectList = this.selectData
  843. // } else {
  844. // this.selectData = this.subEquipments[i].selectList
  845. // }
  846. break
  847. }
  848. }
  849. },
  850. closeEqupField () {
  851. this.showEqumField = false
  852. // 根据选择的ID 找出对应的字段名 存储在sql 中
  853. const chooseFiledEn = []
  854. const chooseFiledZh = []
  855. for (let i = 0; i < this.sureSelect.length; i++) {
  856. const sign = this.sureSelect[i]
  857. chooseFiledEn.push(this.selectData[sign].prop)
  858. chooseFiledZh.push(this.selectData[sign].label)
  859. }
  860. // 保存已经选择的字段
  861. if (this.sign.type === 'system') {
  862. for (let i = 0; i < this.subEquipments.length; i++) {
  863. if (this.sign.id === this.subEquipments[i].id) {
  864. // console.log(this.subEquipments[i])
  865. this.subEquipments[i].sureSelectList = this.sureSelect
  866. this.subEquipments[i].sql.chosedata = chooseFiledEn
  867. this.subEquipments[i].sql.chosedataZh = chooseFiledZh
  868. var imsign = true
  869. for (let j = 0; j < this.imsql.length; j++) {
  870. if (this.imsql[j].id === this.subEquipments[i].sql.id) { // 判断设备数据是否已添加到列表中
  871. this.imsql[j] = this.subEquipments[i].sql // 更新数据
  872. imsign = false
  873. }
  874. }
  875. if (this.subEquipments[i].sureSelectList.length > 0) {
  876. this.subEquipments[i].icon = 'icon iconfont icon-xitong1_1'
  877. } else {
  878. this.subEquipments[i].icon = 'icon iconfont icon-xitong1'
  879. }
  880. if (imsign) {
  881. this.imsql.push(this.subEquipments[i].sql)
  882. }
  883. break
  884. }
  885. }
  886. } else if (this.sign.type === 'local') {
  887. for (let j = 0; j < this.localUps.length; j++) {
  888. if (this.sign.id === this.localUps[j].id) {
  889. this.localUps[j].sureSelectList = this.sureSelect
  890. this.localUps[j].sql = chooseFiledEn
  891. var st_im = {
  892. id: this.localUps[j].id,
  893. userID: this.userID,
  894. sql: this.localUps[j].sql,
  895. upUrl: this.localUps[j].upUrl,
  896. type: this.localUps[j].type,
  897. fileName: this.localUps[j].fileName
  898. }
  899. var stmsign = true
  900. for (let sj = 0; sj < this.st_imsql.length; sj++) {
  901. if (this.st_imsql[sj].id === st_im.id) { // 判断设备数据是否已添加到列表中
  902. this.st_imsql[sj] = st_im // 更新数据
  903. stmsign = false
  904. }
  905. }
  906. if (stmsign) {
  907. this.st_imsql.push(st_im)
  908. }
  909. }
  910. }
  911. }
  912. // 保存
  913. },
  914. stdySubmit (dataInfo) {
  915. if (this.yunXingUid === 0) {
  916. Message.info('请先点击运行')
  917. return
  918. }
  919. this.$refs['dataInfo'].validate((valid) => {
  920. if (!valid) {
  921. return false
  922. } else {
  923. if (typeof this.dataInfo.classificationtag !== 'number') {
  924. for (let clss of this.classification) {
  925. if (clss.categoryName === this.dataInfo.classificationtag) {
  926. this.dataInfo.classificationtag = clss.categoryId
  927. break
  928. }
  929. }
  930. }
  931. var info = {
  932. oldname: this.userID + '_' + this.yunXingUid, // 制作数据集使用的原始名字 便于后台用于将原数据集 重命名
  933. datasetName: this.dataInfo.datasetName, // 数据集名称
  934. remarks: this.dataInfo.remarks,
  935. classification: this.dataInfo.classificationtag,
  936. userId: this.userID
  937. }
  938. MessageBox.confirm(`确定新建静态数据集?`, '提示', {
  939. confirmButtonText: '确定',
  940. cancelButtonText: '取消',
  941. type: 'warning'
  942. }).then(() => {
  943. this.$http({
  944. url: this.$http.adornUrl('/dataset/static/stSubmit'),
  945. method: 'post',
  946. data: this.$http.adornData(info, false)
  947. }).then(res => {
  948. var resContent = res.data
  949. if (resContent && resContent.code === 0) {
  950. Message({
  951. message: '数据集' + this.dataInfo.datasetName + '创建成功',
  952. type: 'success'
  953. })
  954. this.$router.replace({path: '/visi-dataset', query: {'status': '1'}})
  955. this.$destroy()
  956. } else {
  957. Message({
  958. message: '数据集' + this.dataInfo.datasetName + '创建失败',
  959. type: 'error'
  960. })
  961. }
  962. })
  963. }).catch(() => {})
  964. }
  965. })
  966. },
  967. st_handleClick (info) {
  968. clearTimeout(this.clicktime) // 首先清除计时器
  969. this.clicktime = setTimeout(() => {
  970. // 这里执行你自己的方法或者业务逻辑
  971. this.st_equimentClick(info)
  972. }, 300)
  973. },
  974. // 双击事件
  975. st_dblClick (id) {
  976. clearTimeout(this.clicktime) // 清除
  977. // 这里可以添加你自己双击事件的方法或者逻辑
  978. this.st_equimentDoubleClick(id)
  979. },
  980. st_equimentClick (info) {
  981. if (!info.isUp) {
  982. if (info.type === 'excel') {
  983. this.st_upShow.excel = true
  984. this.$nextTick(() => {
  985. this.$refs.staticUploadExcel.init(info)
  986. })
  987. } else if (info.type === 'word') {
  988. this.st_upShow.word = true
  989. this.$nextTick(() => {
  990. this.$refs.staticUploadCsv.init(info)
  991. })
  992. } else {
  993. this.st_upShow.other = true
  994. this.$nextTick(() => {
  995. this.$refs.othersUpload.init(info)
  996. })
  997. }
  998. } else {
  999. this.dataListLoading = true
  1000. this.tableData = []
  1001. this.tablelists = []
  1002. this.detailTitle.worldName = info.fileName
  1003. this.tablelists = info.filedList
  1004. this.tableData = info.excelData
  1005. this.dataListLoading = false
  1006. }
  1007. },
  1008. st_equimentDoubleClick (info) {
  1009. if (!info.isUp) {
  1010. if (info.type === 'excel') {
  1011. this.st_upShow.excel = true
  1012. this.$nextTick(() => {
  1013. this.$refs.staticUploadExcel.init(info)
  1014. })
  1015. } else if (info.type === 'word') {
  1016. this.st_upShow.word = true
  1017. this.$nextTick(() => {
  1018. this.$refs.staticUploadCsv.init(info)
  1019. })
  1020. } else {
  1021. this.st_upShow.other = true
  1022. this.$nextTick(() => {
  1023. this.$refs.othersUpload.init(info)
  1024. })
  1025. }
  1026. } else {
  1027. this.selectData = []
  1028. this.sureSelect = info.sureSelectList
  1029. this.showEqumField = true
  1030. this.selectData = info.filedList
  1031. this.sign = {
  1032. type: 'local',
  1033. id: info.id
  1034. }
  1035. }
  1036. },
  1037. classificationList () {
  1038. this.classification = []
  1039. this.$http({
  1040. url: this.$http.adornUrl('/category/select'),
  1041. method: 'get'
  1042. }).then(({ data }) => {
  1043. var ss = []
  1044. for (var i = 0; i < data.list.length; i++) {
  1045. ss[i] = data.list[i]
  1046. }
  1047. this.classification = Array.from(new Set(ss))
  1048. })
  1049. },
  1050. // 获取代码模板
  1051. getPythonKafkaTmp () {
  1052. this.pythonKafkaVisible = true
  1053. this.$nextTick(() => {
  1054. this.$refs.pythonKafkaTmp.init(this.measurepoint.join())
  1055. })
  1056. },
  1057. getSubSystem (resolve) {
  1058. this.$http({
  1059. url: this.$http.adornUrl('/dataset/tree/getsubSystem'),
  1060. method: 'post'
  1061. }).then(subrespond => {
  1062. let subSystemAll = []
  1063. let subSystemContent = subrespond.data
  1064. if (subSystemContent.length === 0) {
  1065. Message.error(subrespond.msg)
  1066. } else {
  1067. for (let j = 0; j < subSystemContent.length; j++) {
  1068. var subSystem = {
  1069. name: subSystemContent[j].name,
  1070. subSustemid: subSystemContent[j].id,
  1071. limit: 'subSystem',
  1072. icon: 'iconfont icon-xitongfuwu',
  1073. leaf: false
  1074. }
  1075. subSystemAll.push(subSystem)
  1076. }
  1077. }
  1078. return resolve(subSystemAll)
  1079. })
  1080. },
  1081. getEquipment (subSustemid, resolve) {
  1082. const subSystemData = {
  1083. subSystemid: subSustemid
  1084. }
  1085. this.$http({
  1086. url: this.$http.adornUrl('/dataset/tree/getequipment'),
  1087. method: 'post',
  1088. data: this.$http.adornData(subSystemData, false)
  1089. }).then(eqprespond => {
  1090. let equipmentAll = []
  1091. const eqpSystemContent = eqprespond.data
  1092. if (eqpSystemContent.length === 0) {
  1093. Message.error(eqprespond.msg)
  1094. } else {
  1095. for (let k = 0; k < eqpSystemContent.length; k++) {
  1096. var equipment = {
  1097. name: eqpSystemContent[k].name,
  1098. equipmentid: eqpSystemContent[k].id,
  1099. limit: 'equipment',
  1100. hbaseTableName: '',
  1101. icon: 'iconfont icon-xitongfuwu',
  1102. leaf: false
  1103. }
  1104. equipmentAll.push(equipment)
  1105. }
  1106. }
  1107. return resolve(equipmentAll)
  1108. })
  1109. },
  1110. getSubEquipment (equipmentid, resolve) {
  1111. const equimentData = {
  1112. equipment: equipmentid
  1113. }
  1114. this.$http({
  1115. url: this.$http.adornUrl('/dataset/tree/getsubequipment'),
  1116. method: 'post',
  1117. data: this.$http.adornData(equimentData, false)
  1118. }).then(subEqpRespond => {
  1119. let subEquimentAll = []
  1120. const subEqpSystemContent = subEqpRespond.data
  1121. if (subEqpSystemContent.length === 0) {
  1122. Message.error(subEqpRespond.msg)
  1123. } else {
  1124. for (let m = 0; m < subEqpSystemContent.length; m++) {
  1125. var subEquiment = {
  1126. name: subEqpSystemContent[m].name,
  1127. subEquipmentid: subEqpSystemContent[m].id,
  1128. hbaseTableName: subEqpSystemContent[m].hbaseTableName,
  1129. limit: 'children',
  1130. icon: 'iconfont icon-xitong3',
  1131. leaf: true
  1132. }
  1133. subEquimentAll.push(subEquiment)
  1134. }
  1135. }
  1136. return resolve(subEquimentAll)
  1137. })
  1138. },
  1139. // 左侧树的懒加载
  1140. loadTreeNode (node, resolve) {
  1141. if (node.level === 0) {
  1142. this.getSubSystem(resolve)
  1143. } else if (node.level === 1) {
  1144. this.getEquipment(node.data.subSustemid, resolve)
  1145. } else {
  1146. this.getSubEquipment(node.data.equipmentid, resolve)
  1147. }
  1148. }
  1149. },
  1150. // 生命周期 - 创建完成(可以访问当前this实例)
  1151. mounted () {
  1152. this.classificationList()
  1153. },
  1154. // 生命周期 - 挂载完成(可以访问DOM元素)
  1155. created () {},
  1156. beforeCreate () {}, // 生命周期 - 创建之前
  1157. beforeMount () {}, // 生命周期 - 挂载之前
  1158. beforeUpdate () {}, // 生命周期 - 更新之前
  1159. updated () {}, // 生命周期 - 更新之后
  1160. beforeDestroy () {}, // 生命周期 - 销毁之前
  1161. destroyed () {}, // 生命周期 - 销毁完成
  1162. activated () {} // 如果页面有keep-alive缓存功能,这个函数会触发
  1163. }
  1164. </script>
  1165. <style scoped>
  1166. .divi2 {
  1167. display: block;
  1168. height: 1px;
  1169. width: 100%;
  1170. position: relative;
  1171. }
  1172. .divi {
  1173. display: block;
  1174. height: 1px;
  1175. width: 100%;
  1176. margin: 24px 0;
  1177. background-color: #dcdfe6;
  1178. }
  1179. .title_score{
  1180. margin-top: 30px;
  1181. margin-left: 180px;
  1182. }
  1183. .body {
  1184. min-width: 1250px;
  1185. height: 800px;
  1186. position: relative;
  1187. margin: 1px 25px 0px 100px;
  1188. }
  1189. .allDiv{
  1190. width: 100%;
  1191. height: 80%;
  1192. border-left: 0.2px solid #000;
  1193. }
  1194. .leftDiv{
  1195. width: 20%;
  1196. height: 100%;
  1197. float: left;
  1198. border-bottom:0.2px solid #000;
  1199. border-top:0.2px solid #000;
  1200. /*//overflow-y: auto;*/
  1201. }
  1202. .leftDivTree{
  1203. width: 100%;
  1204. height: 93.7%;
  1205. overflow: scroll;
  1206. }
  1207. .el-tree {
  1208. display: inline-block;
  1209. min-width: 100%;
  1210. }
  1211. .custom-tree-node {
  1212. flex: 1;
  1213. display: flex;
  1214. align-items: center;
  1215. justify-content: space-between;
  1216. font-size: 14px;
  1217. padding-right: 8px;
  1218. }
  1219. .midDiv{
  1220. width: 49.5%;
  1221. height: 100%;
  1222. float: left;
  1223. border-top:0.2px solid #000;
  1224. border-bottom:0.2px solid #000;
  1225. border-left:0.2px solid #000;
  1226. overflow-y: scroll;
  1227. }
  1228. .midDivTop{
  1229. height:6.3%;
  1230. width: 100%;
  1231. }
  1232. .midDivTopImg{
  1233. /*padding-top: 5px;*/
  1234. /*height: 31px;*/
  1235. }
  1236. .midDivData{
  1237. width: 100%;
  1238. height: 93.7%;
  1239. margin-top: -10px;
  1240. background: url("../../../assets/datasetImg/background.png");
  1241. }
  1242. .dy_datasourceDiv {
  1243. width: 100%;
  1244. height: 60%;
  1245. }
  1246. .st_datasourceDiv {
  1247. width: 100%;
  1248. height: 32.3%;
  1249. }
  1250. .dy_datasourceDiv .el-divider--horizontal
  1251. {
  1252. margin: 0;
  1253. }
  1254. .st_datasourceDiv .el-divider--horizontal
  1255. {
  1256. margin: 0;
  1257. }
  1258. .rizhiDiv{
  1259. width: 49.3%;
  1260. height:15%;
  1261. position: absolute;
  1262. margin-top: -5.8%;
  1263. margin-left: 2px;
  1264. /*overflow:auto*/
  1265. /*bottom: 12.6px;*/
  1266. }
  1267. .rizhiDivtext{
  1268. width: 100%;
  1269. height: 75.5%;
  1270. font-size: 1px;
  1271. /*border: 0.2px solid #000;*/
  1272. overflow: auto;
  1273. margin-top: 10px;
  1274. /*background: #ffff;*/
  1275. white-space: pre-wrap;
  1276. }
  1277. .rightDiv{
  1278. width: 30%;
  1279. height: 100%;
  1280. float: left;
  1281. overflow: auto;
  1282. /*padding: 2px;*/
  1283. border:0.5px solid #000;
  1284. }
  1285. .icon {
  1286. width: 1em; height: 1em;
  1287. vertical-align: -0.15em;
  1288. fill: currentColor;
  1289. overflow: hidden;
  1290. }
  1291. .el-tree.iconfont{
  1292. margin-right: 100px;
  1293. }
  1294. </style>