design-node-config.vue 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226
  1. <template>
  2. <div class="ant-tabs-tabpane">
  3. <el-tabs default-active-key="1" @change="callback" visible.sync="visible">
  4. <el-tab-pane key="1" label="节点设置">
  5. <el-form :layout="formLayout">
  6. <el-form-item name="nodeName" label=" 节点名称">
  7. <el-input placeholder="请输入节点名称" v-model="nodeName" />
  8. </el-form-item>
  9. <el-form-item name="templateName" label=" 模块名称">
  10. <el-input placeholder="input placeholder" v-model="templateName" />
  11. </el-form-item>
  12. <el-form-item
  13. label="image"
  14. :label-col="formItemLayout.labelCol"
  15. :wrapper-col="formItemLayout.wrapperCol"
  16. >
  17. <el-input placeholder="input placeholder" v-model="templateImage" />
  18. </el-form-item>
  19. <!-- <el-form-item :wrapper-col="buttonItemLayout.wrapperCol">
  20. <el-button type="primary" @click="primary"> 保存 </el-button>
  21. </el-form-item> -->
  22. </el-form>
  23. </el-tab-pane>
  24. <el-tab-pane key="2" label="参数设置">
  25. <!-- <el-form :layout="formLayout">
  26. <el-form-item label="获取到的参数列表" size="mini">
  27. <el-table :data="sourcedatalist" style="width: 100%" border>
  28. <el-table-column prop="name" label="名称(参数)" width="100">
  29. </el-table-column>
  30. <el-table-column prop="from" label="来源及引用方式" width="180">
  31. </el-table-column>
  32. </el-table>
  33. <el-table :data="sourceartilist" style="width: 100%" border>
  34. <el-table-column prop="name" label="名称(文件)" width="100">
  35. </el-table-column>
  36. <el-table-column prop="from" label="来源及引用方式" width="180">
  37. </el-table-column>
  38. </el-table>
  39. </el-form-item>
  40. <el-form-item
  41. label="输入参数列表"
  42. :label-col="formItemLayout.labelCol"
  43. :wrapper-col="formItemLayout.wrapperCol"
  44. v-model="argumentsparameters"
  45. >
  46. <el-input
  47. v-for="argupara in argumentsparameters"
  48. :key="argupara.name"
  49. :label="argupara.name"
  50. placeholder="请输入参数值"
  51. width="50px"
  52. v-model="argupara.value"
  53. ><template slot="prepend">{{ argupara.name }}</template></el-input
  54. >
  55. </el-form-item>
  56. <el-form-item
  57. label="输入参数(文件)列表"
  58. :label-col="formItemLayout.labelCol"
  59. :wrapper-col="formItemLayout.wrapperCol"
  60. v-model="argumentsartifacts"
  61. >
  62. <el-input
  63. v-for="arguarti in argumentsartifacts"
  64. :key="arguarti.name"
  65. :label="arguarti.name"
  66. placeholder="请输入参数值"
  67. width="50px"
  68. v-model="arguarti.valuefrom"
  69. ><template slot="prepend">{{ arguarti.name }}</template>
  70. </el-input>
  71. </el-form-item>
  72. <el-form-item label="输出参数列表" size="mini">
  73. <el-table :data="outputsparameters" style="width: 100%" border>
  74. <el-table-column prop="name" label="名称(参数类型)" width="180">
  75. </el-table-column>
  76. </el-table>
  77. <el-table :data="outputsartifacts" style="width: 100%" border>
  78. <el-table-column prop="name" label="名称(文件类型)" width="180">
  79. </el-table-column>
  80. </el-table>
  81. </el-form-item>
  82. <el-form-item :wrapper-col="buttonItemLayout.wrapperCol">
  83. <el-button type="primary" @click="primary"> 保存 </el-button>
  84. </el-form-item>
  85. </el-form> -->
  86. <el-form :layout="formLayout">
  87. <el-form-item name="parainput"></el-form-item>
  88. <el-table :data="argumentsparameters" border style="width: 100%">
  89. <el-table-column label="参数类型" align="center">
  90. <el-table-column
  91. prop="paraname"
  92. header-align="center"
  93. align="center"
  94. label="名称"
  95. >
  96. </el-table-column>
  97. <el-table-column
  98. prop="paratype"
  99. header-align="center"
  100. align="center"
  101. label="参数类型"
  102. >
  103. </el-table-column>
  104. <el-table-column
  105. prop="paradesc"
  106. header-align="center"
  107. align="center"
  108. label="描述"
  109. >
  110. </el-table-column>
  111. <el-table-column
  112. prop="paravalue"
  113. header-align="center"
  114. align="center"
  115. width="200"
  116. label="输入"
  117. >
  118. <template slot-scope="scope">
  119. <input
  120. v-model="scope.row.paravalue"
  121. placeholder="请输入内容"
  122. />
  123. </template>
  124. </el-table-column>
  125. <el-table-column
  126. prop="quotevalue"
  127. header-align="center"
  128. align="center"
  129. width="200"
  130. label="引用其他算法节点"
  131. >
  132. <template slot-scope="scope1">
  133. <!-- <input v-model="scope.row.paravalue" placeholder="请输入内容" /> -->
  134. <el-cascader
  135. :props="props"
  136. filterable
  137. clearable
  138. @blur="selectBlur($event, scope1.row)"
  139. v-model="scope1.row.quotevalue"
  140. :options="cascadeoptionpara"
  141. @change="cascadeparahandleChange"
  142. ></el-cascader>
  143. </template>
  144. </el-table-column>
  145. </el-table-column>
  146. </el-table>
  147. <el-form-item name="fileinput"></el-form-item>
  148. <el-table :data="argumentsartifacts" border style="width: 100%">
  149. <el-table-column label="文件类型" align="center">
  150. <el-table-column
  151. prop="paraname"
  152. header-align="center"
  153. align="center"
  154. label="名称"
  155. >
  156. </el-table-column>
  157. <el-table-column
  158. prop="parapath 可不显示"
  159. header-align="center"
  160. align="center"
  161. label="文件类型"
  162. >
  163. </el-table-column>
  164. <el-table-column
  165. prop="paradesc"
  166. header-align="center"
  167. align="center"
  168. label="描述"
  169. >
  170. </el-table-column>
  171. <el-table-column
  172. prop="inputnodefilevalue"
  173. header-align="center"
  174. align="center"
  175. width="200"
  176. label="引用输入节点"
  177. >
  178. <template slot-scope="scope0">
  179. <el-select
  180. v-model="scope0.row.inputnodefilevalue"
  181. multiple
  182. placeholder="请选择"
  183. >
  184. <el-option
  185. v-for="item in inputnodefilemap"
  186. :key="item.name"
  187. :label="item.name"
  188. :value="item.fileurl"
  189. >
  190. </el-option>
  191. </el-select>
  192. </template>
  193. </el-table-column>
  194. <el-table-column
  195. prop="quotevalue"
  196. header-align="center"
  197. align="center"
  198. width="200"
  199. label="引用其他算法节点"
  200. >
  201. <template slot-scope="scope1">
  202. <!-- <input v-model="scope.row.paravalue" placeholder="请输入内容" /> -->
  203. <el-cascader
  204. filterable
  205. clearable
  206. @blur="selectBlur($event, scope1.row)"
  207. v-model="scope1.row.quotevalue"
  208. :options="cascadeoption"
  209. @change="cascadehandleChange"
  210. ></el-cascader>
  211. </template>
  212. </el-table-column>
  213. <el-table-column
  214. header-align="center"
  215. align="center"
  216. width="200"
  217. label="上传"
  218. >
  219. <template slot-scope="scope1">
  220. <el-upload
  221. class="upload-demo"
  222. action="#"
  223. :on-preview="handlePreview"
  224. :on-remove="handleRemove"
  225. :before-remove="beforeRemove"
  226. multiple
  227. :limit="10"
  228. :on-exceed="handleExceed"
  229. :on-change="
  230. function (file, fileList) {
  231. return fileChange(file, fileList, scope1.$index);
  232. }
  233. "
  234. :file-list="scope1.row.filelist"
  235. >
  236. <el-button size="small" type="primary">点击上传</el-button>
  237. <!-- <div slot="tip" class="el-upload__tip">请上传代码文件</div> -->
  238. </el-upload>
  239. <!-- <el-upload
  240. class="upload-demo"
  241. action="#"
  242. :on-preview="handlePreview"
  243. :on-remove="handleRemove"
  244. :before-remove="beforeRemove"
  245. multiple
  246. :limit="3"
  247. :on-exceed="handleExceed"
  248. :file-list="scope1.row.filelist"
  249. >
  250. <el-button size="small" type="primary">点击上传</el-button>
  251. <div slot="tip" class="el-upload__tip">
  252. 只能上传jpg/png文件,且不超过500kb
  253. </div>
  254. </el-upload> -->
  255. </template>
  256. </el-table-column>
  257. </el-table-column>
  258. </el-table>
  259. <el-form-item
  260. :wrapper-col="buttonItemLayout.wrapperCol"
  261. label-width="50%"
  262. >
  263. <el-button type="primary" @click="primary"> 保存 </el-button>
  264. </el-form-item>
  265. </el-form>
  266. </el-tab-pane>
  267. <!-- 输出参数设置 -->
  268. <el-tab-pane key="3" label="节点输出" @tab-click="getOutputparavalue">
  269. <el-form :layout="formLayout">
  270. <!-- <div class="sub-title"> 参数型输出</div> -->
  271. <el-form-item name="paraoutput"></el-form-item>
  272. <el-table
  273. :data="outputsparameters"
  274. :key="outputparakey"
  275. border
  276. style="width: 100%"
  277. >
  278. <el-table-column label="参数型输出" align="center">
  279. <el-table-column
  280. prop="paraname"
  281. header-align="center"
  282. align="center"
  283. label="输出参数名称"
  284. >
  285. </el-table-column>
  286. <el-table-column
  287. prop="paratype"
  288. header-align="center"
  289. align="center"
  290. label="参数类型"
  291. >
  292. </el-table-column>
  293. <el-table-column
  294. prop="paradesc"
  295. header-align="center"
  296. align="center"
  297. label="描述"
  298. >
  299. </el-table-column>
  300. <el-table-column
  301. prop="paravalue"
  302. header-align="center"
  303. align="center"
  304. label="结果"
  305. >
  306. </el-table-column>
  307. </el-table-column>
  308. </el-table>
  309. <!-- <div class="sub-title"> 文件型输出</div> -->
  310. <el-form-item
  311. name="fileoutput"
  312. label=""
  313. label-width="50%"
  314. ></el-form-item>
  315. <el-table :data="outputsartifacts" border style="width: 100%">
  316. <el-table-column label="文件型输出" align="center">
  317. <el-table-column
  318. prop="paraname"
  319. header-align="center"
  320. align="center"
  321. label="输出文件名称"
  322. >
  323. </el-table-column>
  324. <el-table-column
  325. prop="paratype"
  326. header-align="center"
  327. align="center"
  328. label="参数类型"
  329. >
  330. </el-table-column>
  331. <el-table-column
  332. prop="paradesc"
  333. header-align="center"
  334. align="center"
  335. label="描述"
  336. >
  337. </el-table-column>
  338. </el-table-column>
  339. <el-table-column
  340. fixed="right"
  341. header-align="center"
  342. align="center"
  343. width="150"
  344. label="操作"
  345. >
  346. <template slot-scope="scope">
  347. <el-button
  348. type="text"
  349. size="small"
  350. @click="previewfile(scope.row.paraname, scope.row.valuefrom)"
  351. >预览
  352. </el-button>
  353. <el-button
  354. type="text"
  355. size="small"
  356. @click="
  357. downloadoutputresult(
  358. scope.row.paraname,
  359. scope.row.valuefrom
  360. )
  361. "
  362. >下载</el-button
  363. >
  364. </template>
  365. </el-table-column>
  366. </el-table>
  367. </el-form>
  368. </el-tab-pane>
  369. <el-tab-pane key="4" label="节点日志" v-show="nodepodVisi">
  370. <el-radio-group
  371. v-model="containertype"
  372. default-value="main"
  373. @change="podcontainerchange"
  374. >
  375. <el-radio label="main" value="main">main</el-radio>
  376. <el-radio label="init" value="init">init</el-radio>
  377. <el-radio label="wait" value="wait">wait</el-radio>
  378. </el-radio-group>
  379. <!-- <div style="max-height: 800px; position: relative"> -->
  380. <div class="log-box" style="position: relative; overflow: scroll">
  381. <div v-if="this.podcontentlogsplit.length">
  382. <p
  383. class="logList-item"
  384. v-for="(item, index) in this.podcontentlogsplit"
  385. :key="index"
  386. >
  387. {{ item }}
  388. </p>
  389. </div>
  390. <p v-else>暂无数据</p>
  391. </div>
  392. <!-- <el-descriptions
  393. title="节点日志"
  394. border
  395. >
  396. <el-descriptions-item label="日志">{{this.podcontentlog}}</el-descriptions-item>
  397. </el-descriptions> -->
  398. <!-- <a-descriptions
  399. title=""
  400. layout="vertical"
  401. bordered
  402. style="white-space: pre-wrap"
  403. >
  404. <a-descriptions-item v-bind:label="this.containertype">
  405. {{ this.podcontentlog }}
  406. </a-descriptions-item>
  407. </a-descriptions> -->
  408. </el-tab-pane>
  409. </el-tabs>
  410. </div>
  411. </template>
  412. <script>
  413. // import { Tabs } from "antd";
  414. // import classNames from "classnames";
  415. import { MessageBox } from "element-ui";
  416. import { Message } from "element-ui";
  417. export default {
  418. data() {
  419. return {
  420. visible: false,
  421. list: [1, 2], //下拉数据列表
  422. value: "", //选择下拉列表中选项后的值
  423. getlistLoading: false, //获取到下拉列表的数据前默认改选择器不可用
  424. cascadeoptionfile: [],
  425. cascadeoption: [], //文件类型级联 目录
  426. cascadeoptionpara: [], //参数类型级联目录
  427. props: { multiple: true }, //设置多选
  428. shareScopeEnd: [], //多选 参数设置
  429. nodeName: null,
  430. templateName: null,
  431. templateImage: null,
  432. templateCommand: null,
  433. templateArgs: null,
  434. inputsparameters: null,
  435. inputsartifacts: null,
  436. argumentsparameters: null,
  437. argumentsartifacts: null,
  438. outputsparameters: null,
  439. outputsartifacts: null,
  440. cell: null,
  441. sourcedatalist: [],
  442. sourceartilist: [],
  443. algoparaInput: null,
  444. algoparaUserInput: null,
  445. algoparaGetInput: null,
  446. algoparaOutput: null,
  447. algoparaInputargu: null,
  448. algonodeSource: null,
  449. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url----一个节点一个
  450. // inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用-----每个节点的每个文件类型的输入都应该有
  451. paraselectvisible: false,
  452. parainputvisible: true,
  453. values: "",
  454. options: [
  455. {
  456. value: "无保留意见",
  457. label: "无保留意见",
  458. },
  459. {
  460. value: "保留意见",
  461. label: "保留意见",
  462. },
  463. ],
  464. url: "",
  465. fileList: [], //20211125
  466. formLayout: "horizontal", //:layout="formLayout"
  467. form: this.$form.createForm(this, { name: "coordinated" }),
  468. labelPosition: "left", //:label-position="labelPosition" label-width="80px"
  469. containertype: "main", //日志类型
  470. workflowName: "", //工作流名称
  471. idTemplateNameMap: null, //节点id与template映射关系
  472. podcontent: { main: "", wait: "", init: "" }, //日志具体内容
  473. nodepodVisi: false,
  474. podcontentlog: "",
  475. podcontentlogsplit: [],
  476. wftemplateName: "", //节点对应的 templateName
  477. workflowStatus: "", //工作流运行状态
  478. outputparakey: 1, //outputparameters table key
  479. podphase: "", //节点对应podphase 状态
  480. };
  481. },
  482. created() {},
  483. mounted() {
  484. // this.init();
  485. },
  486. methods: {
  487. handleFormLayoutChange(e) {
  488. this.formLayout = e.target.value;
  489. },
  490. callback(key) {
  491. console.log(key);
  492. },
  493. init1(celldata, cell, workflowName, idTemplateNameMap, workflowStatus) {
  494. this.visible = true;
  495. // this.conditionForm.sourcedatalist =sourcedatalist;
  496. this.templateName = celldata.templateName;
  497. this.templateImage = celldata.templateImage;
  498. this.templateCommand = celldata.templateCommand;
  499. this.templateArgs = celldata.templateArgs;
  500. this.inputsparameters = celldata.inputsparameters;
  501. this.inputsartifacts = celldata.inputsartifacts;
  502. this.outputsparameters = celldata.outputsparameters;
  503. this.outputsartifacts = celldata.outputsartifacts;
  504. this.argumentsparameters = celldata.argumentsparameters;
  505. this.argumentsartifacts = celldata.argumentsartifacts;
  506. this.sourcedatalist = celldata.sourcedatalist;
  507. this.sourceartilist = celldata.sourceartilist;
  508. this.nodeName = celldata.nodeName;
  509. //20211118
  510. this.algoparaInput = celldata.algoparaInput;
  511. this.algoparaOutput = celldata.algoparaOutput;
  512. this.algoparaUserInput = this.algoparaInput.userInput;
  513. this.algoparaGetInput = this.algoparaInput.getInput;
  514. this.algonodeSource = celldata.algonodeSource; //正确引用
  515. this.inputnodefilemap = celldata.inputnodefilemap;
  516. this.cell = cell;
  517. //节点日志处理
  518. this.workflowName = workflowName;
  519. this.idTemplateNameMap = idTemplateNameMap;
  520. this.workflowStatus = workflowStatus;
  521. this.wftemplateName = celldata.wftempname;
  522. console.log("节点日志处理");
  523. if (this.workflowName != "") {
  524. this.getnodepodContent();
  525. this.podcontentVisi = true;
  526. }
  527. this.getOutputparavalue(); //获取输出
  528. // console.log("userInput getInput");
  529. // console.log(this.algoparaInput);
  530. // console.log(this.algoparaOutput);
  531. // console.log("添加value 属性前");
  532. // console.log(this.algoparaUserInput);
  533. // console.log(this.algoparaGetInput);
  534. //遍历UserInput
  535. for (var i = 0; i < this.algoparaUserInput.length; i++) {
  536. if (!this.algoparaUserInput[i].hasOwnProperty("paravalue")) {
  537. this.algoparaUserInput[i].paravalue = null;
  538. }
  539. }
  540. for (var i = 0; i < this.algoparaGetInput.length; i++) {
  541. if (!this.algoparaGetInput[i].hasOwnProperty("paravalue")) {
  542. this.algoparaGetInput[i].paravalue = null;
  543. }
  544. }
  545. for (var i = 0; i < this.outputsparameters.length; i++) {
  546. if (!this.outputsparameters[i].hasOwnProperty("paravalue")) {
  547. this.outputsparameters[i].paravalue = null;
  548. }
  549. }
  550. for (var i = 0; i < this.outputsartifacts.length; i++) {
  551. // if (!this.outputsartifacts[i].hasOwnProperty("value")) {
  552. // this.outputsartifacts[i].value = "";
  553. // }
  554. if (!this.outputsartifacts[i].hasOwnProperty("valuefrom")) {
  555. this.outputsartifacts[i].valuefrom = ""; //对应后端valueFrom --from
  556. }
  557. }
  558. for (var i = 0; i < this.argumentsparameters.length; i++) {
  559. if (!this.argumentsparameters[i].hasOwnProperty("paravalue")) {
  560. this.argumentsparameters[i].paravalue = ""; //对应后端paravalue
  561. }
  562. if (!this.argumentsparameters[i].hasOwnProperty("quotevalue")) {
  563. this.argumentsparameters[i].quotevalue = []; //对应 级联选择项
  564. }
  565. if (!this.argumentsparameters[i].hasOwnProperty("valuefrom")) {
  566. this.argumentsparameters[i].valuefrom = []; //对应 级联选择项
  567. }
  568. }
  569. for (var i = 0; i < this.argumentsartifacts.length; i++) {
  570. if (!this.argumentsartifacts[i].hasOwnProperty("quotevalue")) {
  571. this.argumentsartifacts[i].quotevalue = []; //级联选择项
  572. }
  573. if (!this.argumentsartifacts[i].hasOwnProperty("valuefrom")) {
  574. this.argumentsartifacts[i].valuefrom = ""; //对应后端valueFrom --from
  575. }
  576. if (!this.argumentsartifacts[i].hasOwnProperty("filelist")) {
  577. this.argumentsartifacts[i].filelist = [];
  578. }
  579. if (!this.argumentsartifacts[i].hasOwnProperty("fileurls")) {
  580. this.argumentsartifacts[i].fileurls = []; //对应后端http
  581. }
  582. if (!this.argumentsartifacts[i].hasOwnProperty("inputnodefilevalue")) {
  583. this.argumentsartifacts[i].inputnodefilevalue = []; // 输入节点引入
  584. }
  585. }
  586. //设置 引用其他节点 文件类型级联选择项
  587. this.cascadeoption = [];
  588. for (
  589. var i = 0;
  590. this.algonodeSource && i < this.algonodeSource.length;
  591. i++
  592. ) {
  593. const curnode = this.algonodeSource[i];
  594. const childrenOption = {}; //每一个节点 作为一个 []中的{} 第一级
  595. childrenOption.value = curnode.getData().nodeName;
  596. childrenOption.label = curnode.getData().nodeName;
  597. //20211124 ---- 参数选择部分,设置参数选择器 ---设置para 和artifact
  598. // const curnodeoutput = curnode.getData().algoparaOutput;
  599. const curnodeoutputartifact = curnode.getData().outputsartifacts;
  600. console.log("第二级参数");
  601. const childoutput = []; //第一级的children
  602. for (var j = 0; j < curnodeoutputartifact.length; j++) {
  603. console.log(curnodeoutputartifact[j]);
  604. const secchildOption = {}; //第一级children[] 中的{}---------第二级
  605. secchildOption.value = curnodeoutputartifact[j].paraname; //第二级
  606. secchildOption.label = curnodeoutputartifact[j].paraname; //第二级
  607. childoutput.push(secchildOption); //[中添加{}] 想第一级的children 中添加第二级
  608. }
  609. childrenOption.children = childoutput; //设置第一级的children
  610. this.cascadeoption.push(childrenOption); //[中添加{}] 第一级
  611. }
  612. //设置 引用其他节点 参数类型级联选择项
  613. // this.cascadeoption = [];
  614. this.cascadeoptionpara = [];
  615. for (
  616. var i = 0;
  617. this.algonodeSource && i < this.algonodeSource.length;
  618. i++
  619. ) {
  620. const paracurnode = this.algonodeSource[i];
  621. const parachildrenOption = {}; //每一个节点 作为一个 []中的{} 第一级
  622. parachildrenOption.value = paracurnode.getData().nodeName;
  623. parachildrenOption.label = paracurnode.getData().nodeName;
  624. //20211124 ---- 参数选择部分,设置参数选择器 ---设置para
  625. // const curnodeoutput = curnode.getData().algoparaOutput;
  626. const curnodeoutputparameter = paracurnode.getData().outputsparameters;
  627. console.log("第二级参数");
  628. const parachildoutput = []; //第一级的children
  629. for (var j = 0; j < curnodeoutputparameter.length; j++) {
  630. console.log(curnodeoutputparameter[j]);
  631. const parasecchildOption = {}; //第一级children[] 中的{}---------第二级
  632. parasecchildOption.value = curnodeoutputparameter[j].paraname; //第二级
  633. parasecchildOption.label = curnodeoutputparameter[j].paraname; //第二级
  634. parachildoutput.push(parasecchildOption); //[中添加{}] 想第一级的children 中添加第二级
  635. }
  636. parachildrenOption.children = parachildoutput; //设置第一级的children
  637. this.cascadeoptionpara.push(parachildrenOption); //[中添加{}] 第一级
  638. }
  639. },
  640. primary() {
  641. //20211119
  642. this.algoparaInput.userInput = this.algoparaUserInput;
  643. this.algoparaInput.getInput = this.algoparaGetInput;
  644. // this.algonodeSource = this.algonodeSource;
  645. this.cell.setData({ algoparaInput: this.algoparaInput });
  646. this.cell.setData({ algonodeSource: this.algonodeSource });
  647. console.log("design-node-config primary");
  648. console.log(this.argumentsartifacts);
  649. this.cell.setData({ nodeName: this.nodeName });
  650. this.cell.setData({ argumentsparameters: this.argumentsparameters });
  651. this.cell.setData({ argumentsartifacts: this.argumentsartifacts });
  652. this.cell.setData({ inputnodefilemap: this.inputnodefilemap });
  653. // this.cell.setData({ outputsparameters: this.outputsparameters });
  654. //20210922 zhang 是否需要保存 获取到的源数据
  655. this.$emit("primaryNodeclick", this.conditionForm, this.cell);
  656. },
  657. //新建边时,边源节点及目的节点均为 算法节点,目的节点获取源节点 相关输出参数
  658. changeSourcedata(celldata, cell) {
  659. // //20210918 zhang source
  660. // //初始化过程时 需将其sourcedalist 直接赋值
  661. // //产生连线时 需更新sourcelist ,获取 连线头的节点的outputsourcelist
  662. // this.sourcedatalist = celldata.sourcedatalist;
  663. // this.sourceartilist = celldata.sourceartilist;
  664. // //20210922 是在 design-graph1.vue进行判断 ,此处仅进行刷新保存
  665. // console.log("design-node-config sourcedatalist ");
  666. // this.cell.setData({ sourcedatalist: this.sourcedatalist });
  667. // this.cell.setData({ sourceartilist: this.sourceartilist });
  668. this.algonodeSource = celldata.algonodeSource;
  669. console.log("design-node-config sourcedatalist ");
  670. console.log("this.cell");
  671. console.log(this.cell);
  672. // this.cell.setData({ algonodeSource: this.algonodeSource });
  673. console.log(this.algonodeSource);
  674. //更新文件及参数类型 级联选择器选项
  675. this.cascadeoption = [];
  676. for (var i = 0; i < this.algonodeSource.length; i++) {
  677. const curnode = this.algonodeSource[i];
  678. const childrenOption = {}; //每一个节点 作为一个 []中的{} 第一级
  679. childrenOption.value = curnode.getData().nodeName;
  680. childrenOption.label = curnode.getData().nodeName;
  681. //20211124 ---- 参数选择部分,设置参数选择器 ---设置para 和artifact
  682. // const curnodeoutput = curnode.getData().algoparaOutput;
  683. const curnodeoutputartifact = curnode.getData().outputsartifacts;
  684. console.log("第二级参数");
  685. const childoutput = []; //第一级的children
  686. for (var j = 0; j < curnodeoutputartifact.length; j++) {
  687. console.log(curnodeoutputartifact[j]);
  688. const secchildOption = {}; //第一级children[] 中的{}---------第二级
  689. secchildOption.value = curnodeoutputartifact[j].paraname; //第二级
  690. secchildOption.label = curnodeoutputartifact[j].paraname; //第二级
  691. childoutput.push(secchildOption); //[中添加{}] 想第一级的children 中添加第二级
  692. }
  693. childrenOption.children = childoutput; //设置第一级的children
  694. this.cascadeoption.push(childrenOption); //[中添加{}] 第一级
  695. }
  696. //设置 引用其他节点 参数类型级联选择项
  697. // this.cascadeoption = [];
  698. this.cascadeoptionpara = [];
  699. for (
  700. var i = 0;
  701. this.algonodeSource && i < this.algonodeSource.length;
  702. i++
  703. ) {
  704. const paracurnode = this.algonodeSource[i];
  705. const parachildrenOption = {}; //每一个节点 作为一个 []中的{} 第一级
  706. parachildrenOption.value = paracurnode.getData().nodeName;
  707. parachildrenOption.label = paracurnode.getData().nodeName;
  708. //20211124 ---- 参数选择部分,设置参数选择器 ---设置para
  709. // const curnodeoutput = curnode.getData().algoparaOutput;
  710. const curnodeoutputparameter = paracurnode.getData().outputsparameters;
  711. console.log("第二级参数");
  712. const parachildoutput = []; //第一级的children
  713. for (var j = 0; j < curnodeoutputparameter.length; j++) {
  714. console.log(curnodeoutputparameter[j]);
  715. const parasecchildOption = {}; //第一级children[] 中的{}---------第二级
  716. parasecchildOption.value = curnodeoutputparameter[j].paraname; //第二级
  717. parasecchildOption.label = curnodeoutputparameter[j].paraname; //第二级
  718. parachildoutput.push(parasecchildOption); //[中添加{}] 想第一级的children 中添加第二级
  719. }
  720. parachildrenOption.children = parachildoutput; //设置第一级的children
  721. this.cascadeoptionpara.push(parachildrenOption); //[中添加{}] 第一级
  722. }
  723. },
  724. //新建边时,源节点为输入节点,算法节点内部获取输入节点对应的文件 name及url
  725. changeinputnodemap(celldata, cell, sallfilemap) {
  726. celldata.inputnodefilemap = sallfilemap;
  727. cell.setData({ inputnodefilemap: sallfilemap });
  728. this.inputnodefilemap = sallfilemap;
  729. },
  730. // 实现select选择框可下拉单选,也可输入赋值
  731. handleSearch(value) {
  732. this.handleChange(value);
  733. },
  734. handleChange(value) {
  735. this.value = value != null && value != "" ? value : [];
  736. },
  737. handleBlur(value) {
  738. this.value = value;
  739. if (this.list.indexOf(value) == -1) {
  740. this.list.push(value);
  741. }
  742. },
  743. // selectBlur(e) {
  744. // // 意见类型
  745. // if (e.target.value !== "") {
  746. // this.value = e.target.value + "(其他)";
  747. // this.$forceUpdate(); // 强制更新
  748. // }
  749. // },
  750. selectBlur(e, row) {
  751. // this.inputContent = e.target.value ;
  752. // row.value = e.target.value;
  753. },
  754. selectClear() {
  755. this.value = "";
  756. this.$forceUpdate();
  757. },
  758. selectChange(val) {
  759. this.value = val;
  760. this.$forceUpdate();
  761. },
  762. cascadehandleChange(value) {},
  763. cascadeparahandleChange(value) {
  764. console.log("多选参数");
  765. console.log(value);
  766. // console.log(quotevalue)
  767. // 是否与上次的类型相同
  768. // let changeFlag = false;
  769. // let changeItem = null;
  770. // if (this.shareScopeEnd.length == 0) {
  771. // this.quotevalue = val
  772. // } else {
  773. // // 与原数组比对
  774. // this.value.forEach((item) => {
  775. // if (item[0] !== this.shareScopeEnd[0][0]) { // 一级标签不同
  776. // changeFlag = true
  777. // changeItem = item
  778. // } else if (item[1] != this.shareScopeEnd[0][1]) { // 一级标签相同但是二级标签不同
  779. // changeFlag = true
  780. // changeItem = item
  781. // } else if ((!item[2] && this.shareScopeEnd[0][2]) || (item[2] && !this.shareScopeEnd[0][2])) {
  782. // changeFlag = true
  783. // changeItem = item
  784. // }
  785. // })
  786. // }
  787. // if (changeFlag) {
  788. // this.value = []
  789. // this.value.push(changeItem)
  790. // }
  791. // this.shareScopeEnd = this.value
  792. },
  793. // 以下4个函数是文件上传功能的
  794. handleRemove(file, fileList) {
  795. console.log(file, fileList);
  796. },
  797. handlePreview(file) {
  798. console.log(file);
  799. },
  800. handleExceed(files, fileList) {
  801. Message.warning(
  802. `当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
  803. files.length + fileList.length
  804. } 个文件`
  805. );
  806. },
  807. beforeRemove(file, fileList) {
  808. return MessageBox.confirm(`确定移除 ${file.name}?`);
  809. },
  810. // 文件改变时
  811. fileChange(file, fileList, index) {
  812. // this.fileList=fileList;
  813. // this.fileList.append(file);
  814. //20211125 该函数遍历了两边
  815. console.log("fileChange");
  816. console.log(index);
  817. console.log(file);
  818. console.log(fileList);
  819. this.argumentsartifacts[index].filelist = fileList;
  820. console.log(this.argumentsartifacts[index].filelist);
  821. this.argumentsartifacts[index].filelist.push(file);
  822. console.log(this.argumentsartifacts[index].filelist);
  823. },
  824. // handleRemove(file, fileList) {
  825. // console.log(file, fileList);
  826. // },
  827. // handlePreview(file) {
  828. // console.log(file);
  829. // },
  830. // handleExceed(files, fileList) {
  831. // this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
  832. // },
  833. // beforeRemove(file, fileList) {
  834. // return MessageBox.confirm(`确定移除 ${ file.name }?`);
  835. // }
  836. //查询日志
  837. //获取单个节点 日志
  838. //调用是已经判断过当前是否已经运行并得到workflowName
  839. getnodepodContent() {
  840. var intervalID = window.setInterval(() => {
  841. // this.getWorkflowStatus();
  842. console.log("获取节点日志");
  843. this.$http({
  844. url: this.$http.adornUrl("/visi/visiworkflow/getpodlog2"),
  845. method: "get",
  846. params: this.$http.adornParams({
  847. workflowName: this.workflowName,
  848. idTemplateNameMap: this.idTemplateNameMap,
  849. nodeId: this.cell.id,
  850. }),
  851. })
  852. .then(({ data }) => {
  853. if (data && data.code === 0) {
  854. this.$nextTick(() => {
  855. this.workflowContentlog = data.workflowContent;
  856. this.podcontent = data.podcontent;
  857. if (this.containertype == "main") {
  858. this.podcontentlog = this.podcontent.main;
  859. this.podcontentlogsplit =
  860. this.podcontent.main.split(/[(\r\n)\r\n]+/);
  861. }
  862. if (this.containertype == "init") {
  863. this.podcontentlog = this.podcontent.init;
  864. this.podcontentlogsplit =
  865. this.podcontent.init.split(/[(\r\n)\r\n]+/);
  866. }
  867. if (this.containertype == "wait") {
  868. this.podcontentlog = this.podcontent.wait;
  869. this.podcontentlogsplit =
  870. this.podcontent.wait.split(/[(\r\n)\r\n]+/);
  871. }
  872. this.podphase = data.podphase;
  873. // this.handleLog();
  874. // console.log("podcontent");
  875. // console.log(this.podcontent);
  876. // console.log(this.podcontent.main);
  877. // console.log(this.podcontent.init);
  878. // console.log(this.podcontent.wait);
  879. // console.log(this.podphase);
  880. // this.podlogs = data.podlogs;
  881. // console.log("workflowcontent")
  882. // console.log(this.workflowContentlog);
  883. // console.log("podlogs")
  884. // console.log(this.podlogs);
  885. });
  886. }
  887. })
  888. .then(() => {
  889. // this.visible = true
  890. // this.$nextTick(() => {
  891. // this.$refs['dataForm'].resetFields()
  892. // })
  893. // 取消该定时设置
  894. if (
  895. this.podphase == "Succeeded" ||
  896. this.podphase == "Error" ||
  897. this.podphase == "Failed"
  898. ) {
  899. // if (this.workflowStatus == "Succeeded") {
  900. // this.workflowstatustag.name = "Succeeded";
  901. // this.workflowstatustag.type = "success";
  902. // } else if (
  903. // this.workflowStatus == "Error" ||
  904. // this.workflowStatus == "Failed"
  905. // ) {
  906. // this.workflowstatustag.name = "Failed";
  907. // this.workflowstatustag.type = "danger";
  908. // }
  909. console.log("关闭定时器-podlog");
  910. window.clearInterval(intervalID);
  911. }
  912. });
  913. }, 3000);
  914. },
  915. podcontainerchange(e) {
  916. if (this.containertype == "main") {
  917. this.podcontentlog = this.podcontent.main;
  918. this.podcontentlogsplit = this.podcontent.main.split(/[(\r\n)\r\n]+/);
  919. }
  920. if (this.containertype == "init") {
  921. this.podcontentlog = this.podcontent.init;
  922. this.podcontentlogsplit = this.podcontent.init.split(/[(\r\n)\r\n]+/);
  923. }
  924. if (this.containertype == "wait") {
  925. this.podcontentlog = this.podcontent.wait;
  926. this.podcontentlogsplit = this.podcontent.wait.split(/[(\r\n)\r\n]+/);
  927. }
  928. // if(e.target.value=="main"){
  929. // this.podcontentlog = this.podcontent.main;
  930. // }
  931. // if(e.target.value=="init"){
  932. // this.podcontentlog = this.podcontent.init;
  933. // }
  934. // if(e.target.value=="wait"){
  935. // this.podcontentlog = this.podcontent.wait;
  936. // }
  937. },
  938. //下载 output 数据
  939. downloadoutputresult(paraname, valuefrom) {
  940. this.$http({
  941. url: this.$http.adornUrl("/visi/visinodeidtemplatemap/downloadoutput"),
  942. method: "get",
  943. params: this.$http.adornParams({
  944. workflowName: this.workflowName,
  945. wftemplateName: this.wftemplateName,
  946. outputartiparaName: paraname,
  947. outputartiparapath: valuefrom,
  948. }),
  949. }).then(({ data }) => {
  950. if (data && data.code === 0) {
  951. console.log("输出节点 下载数据集");
  952. console.log(data.outputfileUrl);
  953. window.open(data.outputfileUrl);
  954. } else {
  955. Message.error("下载失败");
  956. }
  957. });
  958. },
  959. //预览 output 数据
  960. previewfile(paraname, valuefrom) {
  961. this.$http({
  962. url: this.$http.adornUrl("/visi/visinodeidtemplatemap/downloadoutput"),
  963. method: "get",
  964. params: this.$http.adornParams({
  965. workflowName: this.workflowName,
  966. wftemplateName: this.wftemplateName,
  967. outputartiparaName: paraname,
  968. outputartiparapath: valuefrom,
  969. }),
  970. }).then(({ data }) => {
  971. if (data && data.code === 0) {
  972. console.log("输出节点 下载数据集");
  973. console.log(data.outputfileUrl);
  974. const artifiletype = data.artifiletype;
  975. const artifileurl = data.outputfileUrl;
  976. console.log("文件类型");
  977. console.log(artifileurl);
  978. console.log(artifileurl);
  979. // window.location.href=data.outputfileUrl;
  980. // window.location.href=data.downloadUrl;
  981. if (artifiletype == "csv") {
  982. console.log("csv类型");
  983. let routeData = this.$router.resolve({
  984. path: "/visi-previewcsv",
  985. query: {
  986. csvurl: artifileurl,
  987. },
  988. });
  989. window.open(routeData.href, "_blank");
  990. } else {
  991. console.log("其他");
  992. window.open(artifileurl);
  993. }
  994. } else {
  995. Message.error("下载失败");
  996. }
  997. });
  998. },
  999. // 输出参数页面tab 选中时,获取参数类型输出值-----已改为 节点 init处调用
  1000. getOutputparavalue() {
  1001. //如果工作流状态为 succeed 时,调用该方法获取值
  1002. if (
  1003. this.outputsparameters &&
  1004. this.outputsparameters.length != 0 &&
  1005. this.workflowStatus == "Succeeded"
  1006. ) {
  1007. this.$http({
  1008. url: this.$http.adornUrl(
  1009. "/visi/visinodeidtemplatemap/getoutputparavalue"
  1010. ),
  1011. method: "get",
  1012. params: this.$http.adornParams({
  1013. workflowName: this.workflowName,
  1014. wftemplateName: this.wftemplateName,
  1015. }),
  1016. }).then(({ data }) => {
  1017. if (data && data.code === 0) {
  1018. var outparavalueJson = JSON.stringify(data.outparavalueJson);
  1019. var jsonObj = JSON.parse(outparavalueJson); //转换为json对象
  1020. console.log(jsonObj);
  1021. for (var i = 0; i < jsonObj.length; i++) {
  1022. // alert(jsonObj[i].name); //取json中的值
  1023. for (var j = 0; j < this.outputsparameters.length; j++) {
  1024. if (jsonObj[i].name == this.outputsparameters[j].paraname) {
  1025. this.outputsparameters[j].paravalue = jsonObj[i].value;
  1026. }
  1027. }
  1028. }
  1029. this.outputparakey = Math.random();
  1030. } else {
  1031. Message.error("输出参数结果获取失败");
  1032. }
  1033. });
  1034. }
  1035. },
  1036. //获取webSocket消息
  1037. handleLog() {
  1038. var websocket = null;
  1039. var host = "ws://127.0.0.1:8082/renren-fast/webSocket/log";
  1040. // if (window.location.protocol == 'http:') {
  1041. // host = 'ws://' + window.location.host + '/websocket';
  1042. // } else {
  1043. // host = 'wss://' + window.location.host + '/websocket';
  1044. // }
  1045. //判断当前浏览器是否支持WebSocket
  1046. if ("WebSocket" in window) {
  1047. this.websocket = new WebSocket(host);
  1048. } else if ("MozWebSocket" in window) {
  1049. this.websocket = new MozWebSocket(host);
  1050. } else {
  1051. alert("该浏览器不支持WebSocket!");
  1052. }
  1053. console.log(host);
  1054. this.initWebSocket();
  1055. // if ("WebSocket" in window) {
  1056. // let url = `ws://localhost/websocket`;
  1057. // console.log(url);
  1058. // this.websocket = new WebSocket(url);
  1059. // this.initWebSocket();
  1060. // }
  1061. },
  1062. //初始化webSocket
  1063. initWebSocket() {
  1064. // 连接错误
  1065. this.websocket.onerror = () => {
  1066. console.log(
  1067. "WebSocket连接发生错误 状态码:" + this.websocket.readyState
  1068. );
  1069. };
  1070. // 连接成功
  1071. this.websocket.onopen = () => {
  1072. console.log(
  1073. "WebSocket连接成功 状态码:" + this.websocket.readyState
  1074. );
  1075. };
  1076. this.websocket.onclose = () => {
  1077. console.log("WebSocket断开 状态码:" + this.websocket.readyState);
  1078. };
  1079. // 收到消息的回调
  1080. this.websocket.onmessage = (event) => {
  1081. // this.consumeCount = this.consumeCount + 1;
  1082. // if (this.filter && event.data.indexOf(this.keyword) == -1) {
  1083. // return
  1084. // }
  1085. // var curIndex=id;
  1086. // this.podcontentlog = this.podcontent.main;
  1087. if (event.data.match("获取节点日志结束")) {
  1088. console.log(event.data);
  1089. this.websocket.close();
  1090. } else {
  1091. this.podcontent = JSON.parse(event.data);
  1092. this.containertype = "main";
  1093. this.podcontentlog = this.podcontent.main;
  1094. this.podcontentlogsplit = this.podcontent.main.split(/[(\r\n)\r\n]+/);
  1095. console.log("event.data" + event.data);
  1096. }
  1097. /* else{
  1098. this.websocket.close();
  1099. } */
  1100. };
  1101. },
  1102. },
  1103. computed: {
  1104. formItemLayout() {
  1105. const { formLayout } = this;
  1106. return formLayout === "horizontal"
  1107. ? {
  1108. labelCol: { span: 4 },
  1109. wrapperCol: { span: 14 },
  1110. }
  1111. : {};
  1112. },
  1113. buttonItemLayout() {
  1114. const { formLayout } = this;
  1115. return formLayout === "horizontal"
  1116. ? {
  1117. wrapperCol: { span: 14, offset: 4 },
  1118. }
  1119. : {};
  1120. },
  1121. },
  1122. };
  1123. </script>
  1124. <style>
  1125. .ant-tabs-tabpane {
  1126. background: #fff;
  1127. padding: 5px;
  1128. width: 100%;
  1129. height: 100%;
  1130. }
  1131. .ant-tabs-tab {
  1132. flex: 1 1 50px;
  1133. padding: 7px 16px;
  1134. display: flex;
  1135. justify-content: center;
  1136. width: 100%;
  1137. height: 100%;
  1138. }
  1139. .el-select .el-input {
  1140. /* width: 130px; */
  1141. width: 100%;
  1142. /* width: 0px; */
  1143. }
  1144. .input-with-select .el-input-group__prepend {
  1145. background-color: #fff;
  1146. }
  1147. .el-form-item.el-input {
  1148. width: 150px;
  1149. }
  1150. .logList-item {
  1151. padding: 8px 0;
  1152. margin: 0;
  1153. font: normal 13px/1.2 "Courier", sans-serif;
  1154. }
  1155. .log-box {
  1156. /* min-height: 500px; */
  1157. /* max-height: 800px; */
  1158. height: 100%;
  1159. padding: 10px;
  1160. margin: 10px;
  1161. background-color: #fff;
  1162. }
  1163. </style>