create1.vue 61 KB

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