You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Model.vue 23 kB

4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. <template>
  2. <div>
  3. <div class="ui container" id="header">
  4. <el-row style="margin-top: 15px">
  5. <el-table
  6. ref="table"
  7. :data="tableData"
  8. style="min-width: 100%"
  9. row-key="rowKey"
  10. lazy
  11. :load="load"
  12. :tree-props="{ children: 'Children', hasChildren: 'hasChildren' }"
  13. :header-cell-style="tableHeaderStyle"
  14. >
  15. <el-table-column
  16. prop="name"
  17. :label="i18n.model_name"
  18. align="left"
  19. min-width="20%"
  20. >
  21. <template slot-scope="scope">
  22. <div class="expand-icon" v-if="scope.row.hasChildren === false">
  23. <i class="el-icon-arrow-right"></i>
  24. </div>
  25. <!-- <i class="el-icon-time"></i> -->
  26. <span v-if="!scope.row.Children" :class="scope.row.modelType == '1' ? 'm-local' : 'm-online'">{{ scope.row.modelType == '1' ? i18n.local : i18n.online }}</span>
  27. <a
  28. class="text-over"
  29. :href="showinfoHref + encodeURIComponent(scope.row.name)"
  30. :title="scope.row.name"
  31. >{{ scope.row.name }}</a
  32. >
  33. </template>
  34. </el-table-column>
  35. <el-table-column
  36. prop="version"
  37. :label="i18n.model_version"
  38. align="center"
  39. min-width="6%"
  40. >
  41. <template slot-scope="scope">
  42. <span class="text-over" :title="scope.row.version">{{
  43. scope.row.version
  44. }}</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column
  48. prop="versionCount"
  49. :label="i18n.model_version_num"
  50. align="center"
  51. min-width="7%"
  52. >
  53. <template slot-scope="scope">
  54. <span class="text-over" :title="scope.row.versionCount">{{
  55. scope.row.versionCount
  56. }}</span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column
  60. prop="size"
  61. :label="i18n.model_size"
  62. align="center"
  63. min-width="10%"
  64. >
  65. <template slot-scope="scope">
  66. <span class="text-over">{{ renderSize(scope.row.size) }}</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column
  70. prop="engineName"
  71. :label="i18n.model_egine"
  72. align="center"
  73. min-width="8%"
  74. >
  75. <template slot-scope="scope">
  76. <span class="text-over" :title="scope.row.engineName">{{
  77. scope.row.engineName
  78. }}</span>
  79. </template>
  80. </el-table-column>
  81. <el-table-column
  82. prop="computeResource"
  83. :label="i18n.model_compute_resource"
  84. align="center"
  85. min-width="8%"
  86. >
  87. <template slot-scope="scope">
  88. <span class="text-over">{{ scope.row.computeResource }}</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column
  92. prop="isPrivate"
  93. :label="i18n.model_status"
  94. align="center"
  95. min-width="6.75%"
  96. >
  97. <template slot-scope="scope">
  98. <span class="text-over" :title="scope.row.status_title">
  99. <i style="vertical-align: middle" :class="scope.row.status"></i
  100. ></span>
  101. <span class="text-over" :title="scope.row.isPrivate">
  102. {{transStatus(scope.row.isPrivate)}}
  103. </span>
  104. </template>
  105. </el-table-column>
  106. <el-table-column
  107. prop="createdUnix"
  108. :label="i18n.model_create_time"
  109. align="center"
  110. min-width="13.75%"
  111. >
  112. <template slot-scope="scope">
  113. {{ transTime(scope.row.createdUnix) }}
  114. </template>
  115. </el-table-column>
  116. <el-table-column
  117. prop="userName"
  118. :label="i18n.model_creator"
  119. align="center"
  120. min-width="6.75%"
  121. >
  122. <template slot-scope="scope">
  123. <a
  124. :href="!scope.row.userName ? '#' : '/' + scope.row.userName"
  125. :title="scope.row.userName || defaultAvatarName"
  126. >
  127. <img
  128. class="ui avatar image"
  129. :src="scope.row.userRelAvatarLink || defaultAvatar"
  130. />
  131. </a>
  132. </template>
  133. </el-table-column>
  134. <el-table-column
  135. :label="i18n.model_operation"
  136. min-width="15%"
  137. align="center"
  138. >
  139. <template slot-scope="scope">
  140. <div class="space-around" >
  141. <a class="op-btn"
  142. v-show="scope.row.modelType == 1"
  143. :href="url + 'create_local_model_1?type=1&name=' + encodeURIComponent(scope.row.name) + '&id=' + scope.row.id"
  144. :class="{ disabled: !scope.row.isCanOper }"
  145. >{{ i18n.modify }}</a>
  146. <a class="op-btn" v-show="scope.row.modelType != 1" style="color:transparent;cursor:default;" >{{ i18n.modify }}</a>
  147. <a class="op-btn" v-show="repoIsPrivate == false && scope.row.isPrivate==true && scope.row.isCanOper" @click="
  148. modifyModelStatus(scope.row.id, scope.row.cName, scope.row.rowKey,false)
  149. ">{{ i18n.modelaccess_setpublic }}</a>
  150. <a class="op-btn" v-show="repoIsPrivate == false && scope.row.isPrivate==false && scope.row.isCanOper" @click="
  151. modifyModelStatus(scope.row.id, scope.row.cName, scope.row.rowKey,true)
  152. ">{{ i18n.modelaccess_setprivate }}</a>
  153. <a class="op-btn"
  154. :href="loadhref + scope.row.id"
  155. :class="{ disabled: !scope.row.isCanDownload }"
  156. >{{ i18n.model_download }}</a>
  157. <a class="op-btn"
  158. :class="{ disabled: !scope.row.isCanDelete }"
  159. @click="
  160. deleteModel(scope.row.id, scope.row.cName, scope.row.rowKey)
  161. "
  162. >{{ i18n.model_delete }}</a>
  163. </div>
  164. </template>
  165. </el-table-column>
  166. </el-table>
  167. </el-row>
  168. <div class="ui container" style="margin-top: 50px; text-align: center">
  169. <el-pagination
  170. background
  171. @size-change="handleSizeChange"
  172. @current-change="handleCurrentChange"
  173. :current-page="currentPage"
  174. :page-sizes="[5, 10, 15]"
  175. :page-size="pageSize"
  176. layout="total, sizes, prev, pager, next, jumper"
  177. :total="totalNum"
  178. >
  179. </el-pagination>
  180. </div>
  181. </div>
  182. </div>
  183. </template>
  184. <script>
  185. import { modifyModelStatus } from '~/apis/modules/modelmanage';
  186. const { _AppSubUrl, _StaticUrlPrefix, csrf } = window.config;
  187. const REPOISPRIVATE = window.REPO_IS_PRIVATE;
  188. export default {
  189. components: {},
  190. data() {
  191. return {
  192. i18n: {},
  193. currentPage: 1,
  194. pageSize: 10,
  195. totalNum: 0,
  196. params: { page: 0, pageSize: 10 },
  197. tableData: [],
  198. url: "",
  199. isLoading: true,
  200. loadNodeMap: new Map(),
  201. submitId: {},
  202. defaultAvatar: "/user/avatar/Ghost/-1",
  203. defaultAvatarName: "Ghost",
  204. data: "",
  205. timer: null,
  206. timerFlag: false,
  207. repoIsPrivate: REPOISPRIVATE,
  208. };
  209. },
  210. methods: {
  211. load(tree, treeNode, resolve) {
  212. try {
  213. this.loadNodeMap.set(tree.cName, { tree, treeNode, resolve });
  214. this.$axios
  215. .get(this.url + "show_model_child_api", {
  216. params: {
  217. name: tree.cName,
  218. },
  219. })
  220. .then((res) => {
  221. let trainTaskInfo;
  222. let tableData;
  223. tableData = res.data;
  224. for (let i = 0; i < tableData.length; i++) {
  225. trainTaskInfo = JSON.parse(tableData[i].trainTaskInfo || '{}');
  226. tableData[i].engineName = this.getEngineName(tableData[i]);
  227. // tableData[i].computeResource = trainTaskInfo.ComputeResource;
  228. tableData[i].computeResource = tableData[i].type == '0' ? 'CPU/GPU' : 'NPU';
  229. tableData[i].cName = tableData[i].name;
  230. tableData[i].rowKey = tableData[i].id + Math.random();
  231. tableData[i].name = "";
  232. tableData[i].versionCount = "";
  233. tableData[i].Children = true;
  234. }
  235. resolve(tableData || []);
  236. });
  237. } catch (e) {
  238. this.loading = false;
  239. }
  240. },
  241. tableHeaderStyle({ row, column, rowIndex, columnIndex }) {
  242. if (rowIndex === 0) {
  243. return "background:#f5f5f6;color:#606266";
  244. }
  245. },
  246. handleSizeChange(val) {
  247. this.params.pageSize = val;
  248. this.getModelList();
  249. },
  250. handleCurrentChange(val) {
  251. this.params.page = val;
  252. this.getModelList();
  253. },
  254. showcreateVue(name, version, label) {
  255. let title = this.i18n.model_create_version_title;
  256. $(".ui.modal.second")
  257. .modal({
  258. centered: false,
  259. onShow: function () {
  260. $("#model_header").text(title);
  261. $('input[name="name"]').addClass("model_disabled");
  262. $('input[name="name"]').attr("readonly", "readonly");
  263. $('input[name="modelSelectedFile"]').attr("readonly", "readonly");
  264. $('input[name="version"]').addClass("model_disabled");
  265. $(".ui.dimmer").css({
  266. "background-color": "rgb(136, 136, 136,0.7)",
  267. });
  268. $("#job-name").empty();
  269. $("#name").val(name);
  270. $("#label").val(label);
  271. let version_string = versionAdd(version);
  272. $("#version").val(version_string);
  273. loadTrainList();
  274. },
  275. onHide: function () {
  276. document.getElementById("formId").reset();
  277. $('input[name="name"]').removeClass("model_disabled");
  278. $('input[name="name"]').removeAttr("readonly");
  279. $('input[name="modelSelectedFile"]').removeAttr("readonly");
  280. var cityObj = $("#modelSelectedFile");
  281. cityObj.attr("value", "");
  282. $("#choice_model").dropdown("clear");
  283. $("#choice_version").dropdown("clear");
  284. $("#choice_Engine").dropdown("clear");
  285. $(".ui.dimmer").css({ "background-color": "" });
  286. $(".ui.error.message").text();
  287. $(".ui.error.message").css("display", "none");
  288. },
  289. })
  290. .modal("show");
  291. },
  292. check() {
  293. let jobid = document.getElementById("jobId").value;
  294. let versionname = document.getElementById("versionName").value;
  295. let name = document.getElementById("name").value;
  296. let version = document.getElementById("version").value;
  297. let modelSelectedFile =
  298. document.getElementById("modelSelectedFile").value;
  299. if (jobid == "") {
  300. $(".required.ten.wide.field").addClass("error");
  301. return false;
  302. } else {
  303. $(".required.ten.wide.field").removeClass("error");
  304. }
  305. if (modelSelectedFile == "") {
  306. $("#modelSelectedFile").addClass("error");
  307. return false;
  308. } else {
  309. $("#modelSelectedFile").removeClass("error");
  310. }
  311. if (versionname == "") {
  312. $(".required.six.widde.field").addClass("error");
  313. return false;
  314. } else {
  315. $(".required.six.widde.field").removeClass("error");
  316. }
  317. if (name == "") {
  318. $("#modelname").addClass("error");
  319. return false;
  320. } else {
  321. $("#modelname").removeClass("error");
  322. }
  323. if (versionname == "") {
  324. $("#verionname").addClass("error");
  325. return false;
  326. } else {
  327. $("#verionname").removeClass("error");
  328. }
  329. return true;
  330. },
  331. submit() {
  332. let context = this;
  333. let flag = this.check();
  334. if (flag) {
  335. let cName = $("input[name='name']").val();
  336. let version = $("input[name='version']").val();
  337. let data = $("#formId").serialize();
  338. const initModel = $("input[name='initModel']").val();
  339. let url_href =
  340. version === "0.0.1"
  341. ? context.url_create_newModel
  342. : context.url_create_newVersion;
  343. $("#mask").css({ display: "block", "z-index": "9999" });
  344. $.ajax({
  345. url: url_href,
  346. type: "POST",
  347. data: data,
  348. success: function (res) {
  349. context.getModelList();
  350. $("input[name='modelSelectedFile']").val("");
  351. $(".ui.modal.second").modal("hide");
  352. if (initModel === "0") {
  353. location.reload();
  354. }
  355. },
  356. error: function (xhr) {
  357. // 隐藏 loading
  358. // 只有请求不正常(状态码不为200)才会执行
  359. $(".ui.error.message").text(xhr.responseText);
  360. $(".ui.error.message").css("display", "block");
  361. },
  362. complete: function (xhr) {
  363. $("#mask").css({ display: "none", "z-index": "1" });
  364. },
  365. });
  366. } else {
  367. return false;
  368. }
  369. },
  370. loadrefresh(row) {
  371. const store = this.$refs.table.store;
  372. if (!this.loadNodeMap.get(row.cName)) {
  373. const parent = store.states.data;
  374. const index = parent.findIndex((child) => child.rowKey == row.rowKey);
  375. this.getModelList();
  376. } else {
  377. let { tree, treeNode, resolve } = this.loadNodeMap.get(row.cName);
  378. const keys = Object.keys(store.states.lazyTreeNodeMap);
  379. if (keys.includes(row.rowKey)) {
  380. this.getModelList();
  381. } else {
  382. let parentRow = store.states.data.find(
  383. (child) => child.cName == row.cName
  384. );
  385. let childrenIndex = store.states.lazyTreeNodeMap[
  386. parentRow.rowKey
  387. ].findIndex((child) => child.rowKey == row.rowKey);
  388. parentRow.versionCount = parentRow.versionCount - 1;
  389. const parent = store.states.lazyTreeNodeMap[parentRow.rowKey];
  390. if (parent.length === 1) {
  391. this.getModelList();
  392. } else {
  393. parent.splice(childrenIndex, 1);
  394. }
  395. }
  396. }
  397. },
  398. modifyModelStatus(id, name, rowKey,isPrivate) {
  399. let row = { cName: name, id: id, rowKey: rowKey };
  400. let data = {'id':id,'isPrivate':isPrivate};
  401. modifyModelStatus(data);
  402. _this.loadrefresh(row);
  403. },
  404. deleteModel(id, name, rowKey) {
  405. let row = { cName: name, id: id, rowKey: rowKey };
  406. let _this = this;
  407. let flag = 1;
  408. $(".ui.basic.modal.first")
  409. .modal({
  410. onDeny: function () {
  411. flag = false;
  412. },
  413. onApprove: function () {
  414. _this.$axios
  415. .delete(_this.url + "delete_model", {
  416. params: {
  417. id: id,
  418. },
  419. })
  420. .then((res) => {
  421. _this.loadrefresh(row);
  422. // _this.getModelList()
  423. });
  424. flag = true;
  425. },
  426. onHidden: function () {
  427. if (flag == false) {
  428. $(".alert")
  429. .html("您已取消操作")
  430. .removeClass("alert-success")
  431. .addClass("alert-danger")
  432. .show()
  433. .delay(1500)
  434. .fadeOut();
  435. } else {
  436. $(".alert")
  437. .html("删除成功")
  438. .removeClass("alert-danger")
  439. .addClass("alert-success")
  440. .show()
  441. .delay(1500)
  442. .fadeOut();
  443. }
  444. },
  445. })
  446. .modal("show");
  447. },
  448. getEngineName(model) {
  449. if (model.engine == 0) {
  450. return "PyTorch";
  451. } else if (model.engine == 1 || model.engine == 121) {
  452. return "TensorFlow";
  453. } else if (
  454. model.engine == 2 ||
  455. model.engine == 122 ||
  456. model.engine == 35
  457. ) {
  458. return "MindSpore";
  459. } else if (model.engine == 4) {
  460. return "PaddlePaddle";
  461. } else if (model.engine == 5) {
  462. return "OneFlow";
  463. } else if (model.engine == 6) {
  464. return "MXNet";
  465. } else {
  466. return "Other";
  467. }
  468. },
  469. intervalModelist() {
  470. if (!this.timerFlag) {
  471. this.timer = setInterval(() => {
  472. this.getModelList();
  473. }, 10000);
  474. }
  475. },
  476. getModelList() {
  477. let countStatus = 0;
  478. try {
  479. this.loadNodeMap.clear();
  480. this.$axios
  481. .get(this.url + "show_model_api", {
  482. params: this.params,
  483. })
  484. .then((res) => {
  485. $(".ui.grid").removeAttr("style");
  486. $("#loadContainer").removeClass("loader");
  487. let trainTaskInfo;
  488. this.tableData = res.data.data;
  489. for (let i = 0; i < this.tableData.length; i++) {
  490. trainTaskInfo = JSON.parse(this.tableData[i].trainTaskInfo || '{}');
  491. this.tableData[i].cName = this.tableData[i].name;
  492. this.tableData[i].rowKey = this.tableData[i].id + Math.random();
  493. this.tableData[i].engineName = this.getEngineName(
  494. this.tableData[i]
  495. );
  496. // this.tableData[i].computeResource = trainTaskInfo.ComputeResource;
  497. this.tableData[i].computeResource = this.tableData[i].type == '0' ? 'CPU/GPU' : 'NPU';
  498. this.tableData[i].hasChildren = res.data.data[i].versionCount === 1 ? false : true;
  499. if (this.tableData[i].status !== 1) {
  500. countStatus++;
  501. }
  502. switch (this.tableData[i].status) {
  503. case 1:
  504. this.tableData[i].status = "WAITING";
  505. this.tableData[i].status_title = this.i18n.model_wait;
  506. break;
  507. case 2:
  508. this.tableData[i].status = "FAILED";
  509. this.tableData[i].status_title = this.tableData[i].statusDesc;
  510. break;
  511. default:
  512. this.tableData[i].status = "SUCCEEDED";
  513. this.tableData[i].status_title = this.i18n.model_success;
  514. break;
  515. }
  516. }
  517. this.totalNum = res.data.count;
  518. if (countStatus === this.tableData.length) {
  519. clearInterval(this.timer);
  520. this.timer = null;
  521. this.timerFlag = false;
  522. } else {
  523. this.intervalModelist();
  524. this.timerFlag = true;
  525. }
  526. })
  527. .catch((err) => {
  528. console.log(err);
  529. });
  530. } catch (e) {
  531. console.log(e);
  532. }
  533. },
  534. },
  535. computed: {
  536. loadhref() {
  537. return this.url + "downloadall?id=";
  538. },
  539. showinfoHref() {
  540. return this.url + "show_model_info?name=";
  541. },
  542. transStatus(){
  543. return function (state) {
  544. if(state){
  545. return this.i18n.modelaccess_private;
  546. }
  547. return this.i18n.modelaccess_public;
  548. }
  549. },
  550. transTime() {
  551. return function (time) {
  552. let date = new Date(time * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
  553. let Y = date.getFullYear() + "-";
  554. let M =
  555. (date.getMonth() + 1 < 10
  556. ? "0" + (date.getMonth() + 1)
  557. : date.getMonth() + 1) + "-";
  558. let D =
  559. (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
  560. let h =
  561. (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) +
  562. ":";
  563. let m =
  564. (date.getMinutes() < 10
  565. ? "0" + date.getMinutes()
  566. : date.getMinutes()) + ":";
  567. let s =
  568. date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  569. return Y + M + D + h + m + s;
  570. };
  571. },
  572. renderSize() {
  573. return function (value) {
  574. if (null == value || value == "") {
  575. return "0 Bytes";
  576. }
  577. var unitArr = new Array(
  578. "Bytes",
  579. "KB",
  580. "MB",
  581. "GB",
  582. "TB",
  583. "PB",
  584. "EB",
  585. "ZB",
  586. "YB"
  587. );
  588. var index = 0;
  589. var srcsize = parseFloat(value);
  590. index = Math.floor(Math.log(srcsize) / Math.log(1024));
  591. var size = srcsize / Math.pow(1024, index);
  592. size = size.toFixed(2); //保留的小数位数
  593. return size + unitArr[index];
  594. };
  595. },
  596. },
  597. mounted() {
  598. this.submitId = document.getElementById("submitId");
  599. this.intervalModelist();
  600. this.url = location.href.split("show_model")[0];
  601. this.submitId.addEventListener("click", this.submit);
  602. this.url_create_newVersion = this.url + "create_model";
  603. this.url_create_newModel = this.url + "create_new_model";
  604. },
  605. created() {
  606. if (document.documentElement.attributes["lang"].nodeValue == "en-US") {
  607. this.i18n = this.$locale.US;
  608. } else {
  609. this.i18n = this.$locale.CN;
  610. }
  611. this.getModelList();
  612. },
  613. beforeDestroy() {
  614. // 实例销毁之前对点击事件进行解绑
  615. this.submitId.removeEventListener("click", this.submit);
  616. clearInterval(this.timer);
  617. },
  618. };
  619. </script>
  620. <style scoped>
  621. .text-over {
  622. overflow: hidden;
  623. text-overflow: ellipsis;
  624. vertical-align: middle;
  625. white-space: nowrap;
  626. }
  627. .m-local {
  628. background-color: rgb(22, 132, 252);
  629. color: white;
  630. padding: 2px 3px;
  631. border-radius: 4px;
  632. font-size: 12px;
  633. margin-right: 2px;
  634. }
  635. .m-online {
  636. background-color: rgb(91, 185, 115);
  637. color: white;
  638. padding: 2px 3px;
  639. border-radius: 4px;
  640. font-size: 12px;
  641. margin-right: 2px;
  642. }
  643. .el-icon-arrow-right {
  644. font-family: element-icons !important;
  645. speak: none;
  646. font-style: normal;
  647. font-weight: 400;
  648. font-feature-settings: normal;
  649. font-variant: normal;
  650. text-transform: none;
  651. line-height: 1;
  652. vertical-align: middle;
  653. display: inline-block;
  654. -webkit-font-smoothing: antialiased;
  655. -moz-osx-font-smoothing: grayscale;
  656. border: 1px solid #d4d4d5;
  657. border-radius: 50%;
  658. color: #d4d4d5;
  659. margin-right: 4px;
  660. }
  661. .el-icon-arrow-right::before {
  662. content: "\e6e0";
  663. }
  664. .expand-icon {
  665. display: inline-block;
  666. width: 20px;
  667. line-height: 20px;
  668. height: 20px;
  669. text-align: center;
  670. margin-right: 3px;
  671. font-size: 12px;
  672. }
  673. /deep/ .el-table_1_column_1.is-left .cell {
  674. padding-right: 0px !important;
  675. white-space: nowrap;
  676. }
  677. /deep/ .el-table__expand-icon .el-icon-arrow-right {
  678. font-family: element-icons !important;
  679. speak: none;
  680. font-style: normal;
  681. font-weight: 400;
  682. font-feature-settings: normal;
  683. font-variant: normal;
  684. text-transform: none;
  685. line-height: 1;
  686. vertical-align: middle;
  687. display: inline-block;
  688. -webkit-font-smoothing: antialiased;
  689. -moz-osx-font-smoothing: grayscale;
  690. border: 1px solid #3291f8;
  691. border-radius: 50%;
  692. color: #3291f8;
  693. margin-right: 4px;
  694. }
  695. .space-around {
  696. display: flex;
  697. justify-content: space-around;
  698. }
  699. .op-btn-c {
  700. text-align: right;
  701. padding-right: 20px;
  702. }
  703. .op-btn {
  704. margin: 0 0 0 5px;
  705. }
  706. .disabled {
  707. cursor: default;
  708. pointer-events: none;
  709. color: rgba(0, 0, 0, 0.6) !important;
  710. opacity: 0.45 !important;
  711. }
  712. </style>