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.

modelmanage-common-detail.vue 24 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. <template>
  2. <div>
  3. <div class="ui header">
  4. <div class="ui breadcrumb">
  5. <a class="section" :href="`${repo}/modelmanage/show_model`">{{ $t('modelManage.modelManage') }}</a>
  6. <div class="divider"> / </div>
  7. <div class="active section">{{ this.state.name }}</div>
  8. </div>
  9. <div class="version">
  10. <el-select v-model="curVersion" @change="changeVersion" placeholder="">
  11. <el-option v-for="item in modelList" :value="item.version" :key="item.version" :label="item.version">
  12. </el-option>
  13. </el-select>
  14. </div>
  15. </div>
  16. <div class="content">
  17. <div class="detail-info">
  18. <div class="title">{{ $t('modelManage.basicInfo') }}:</div>
  19. <div class="area-c">
  20. <div class="area">
  21. <div class="row">
  22. <div class="tit">{{ $t('modelManage.useCluster') }}:</div>
  23. <div class="val">
  24. <div class="txt-wrap" :title="state.typeStr">
  25. {{ state.typeStr }}
  26. </div>
  27. </div>
  28. </div>
  29. <div class="row">
  30. <div class="tit">{{ $t('modelManage.modelSize') }}:</div>
  31. <div class="val">
  32. <div class="txt-wrap" :title="state.modelSize">{{ state.modelSize }}</div>
  33. </div>
  34. </div>
  35. <div class="row" :class="isEidtDescr ? 'edit-row' : ''">
  36. <div class="tit">{{ $t('modelManage.descr') }}:</div>
  37. <div class="val" :class="isEidtDescr ? 'edit-val' : ''">
  38. <div v-if="!isEidtDescr" class="txt-wrap" :title="state.description"
  39. style="max-width:100%;width:unset;padding-right:20px;">
  40. <span>{{ state.description }}</span>
  41. <i v-if="canOperate" style="position:absolute;right:0;top:3px;color:rgb(22, 132, 252);cursor:pointer;"
  42. class="el-icon-edit" @click="editDescr = state._description; isEidtDescr = true;"></i>
  43. </div>
  44. <div class="txt-edit" v-if="isEidtDescr">
  45. <el-input type="textarea" v-model="editDescr" :maxLength="255"
  46. :placeholder="$t('modelManage.modelDescrInputTips')"></el-input>
  47. <i style="position:absolute;right:-4px;bottom:20px;color:rgb(255, 37, 37);cursor:pointer;"
  48. class="icon times" @click="isEidtDescr = false;"></i>
  49. <i style="position:absolute;right:-5px;bottom:2px;color:rgb(39, 177, 72);cursor:pointer;"
  50. @click="submitEidt('descr')" class="icon check"></i>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="area">
  56. <div class="row">
  57. <div class="tit">{{ $t('modelManage.modelEngine') }}:</div>
  58. <div class="val">
  59. <div class="txt-wrap" :title="state.engineName">{{ state.engineName }}</div>
  60. </div>
  61. </div>
  62. <div class="row">
  63. <div class="tit">{{ $t('modelManage.createTime') }}:</div>
  64. <div class="val">
  65. <div class="txt-wrap" :title="state.createTime">{{ state.createTime }}</div>
  66. </div>
  67. </div>
  68. <div class="row" :class="isEidtLabel ? 'edit-row' : ''">
  69. <div class="tit">{{ $t('modelManage.label') }}:</div>
  70. <div class="val" :class="isEidtLabel ? 'edit-val' : ''">
  71. <div v-if="!isEidtLabel" class="txt-wrap" :title="state.label"
  72. style="max-width:100%;width:unset;padding-right:20px;">
  73. <span>{{ state.label }}</span>
  74. <i v-if="canOperate" style="position:absolute;right:0;top:3px;color:rgb(22, 132, 252);cursor:pointer;"
  75. class="el-icon-edit" @click="editLabel = state._label; isEidtLabel = true;"></i>
  76. </div>
  77. <div class="txt-edit" v-if="isEidtLabel">
  78. <el-input v-model="editLabel" :maxLength="255" :placeholder="$t('modelManage.modelLabelInputTips')"
  79. @input="labelInput"></el-input>
  80. <i style="position:absolute;right:-5px;bottom:20px;color:rgb(255, 37, 37);cursor:pointer;"
  81. class="icon times" @click="isEidtLabel = false;"></i>
  82. <i style="position:absolute;right:-5px;bottom:2px;color:rgb(39, 177, 72);cursor:pointer;"
  83. @click="submitEidt('label')" class="icon check"></i>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <div v-show="isExpanded" style="margin-top:8px;" class="title">{{ $t('modelManage.trainTaskInfo') }}:</div>
  90. <div v-show="isExpanded" class="area-c">
  91. <div class="area">
  92. <div class="row">
  93. <div class="tit">{{ $t('modelManage.trainTask') }}:</div>
  94. <div class="val">
  95. <div class="txt-wrap" v-html="state.displayJobName"></div>
  96. </div>
  97. </div>
  98. <div class="row">
  99. <div class="tit">{{ $t('modelManage.codeBranch') }}:</div>
  100. <div class="val">
  101. <div class="txt-wrap" v-html="state.branchName"></div>
  102. </div>
  103. </div>
  104. <div class="row">
  105. <div class="tit">{{ $t('modelManage.bootFile') }}:</div>
  106. <div class="val">
  107. <div class="txt-wrap" :title="state.bootFile">{{ state.bootFile }}</div>
  108. </div>
  109. </div>
  110. <div class="row">
  111. <div class="tit">{{ $t('modelManage.trainDataset') }}:</div>
  112. <div class="val">
  113. <div class="txt-wrap" :title="state.datasetName">{{ state.datasetName }}</div>
  114. </div>
  115. </div>
  116. </div>
  117. <div class="area">
  118. <div class="row">
  119. <div class="tit">{{ $t('modelManage.specInfo') }}:</div>
  120. <div class="val">
  121. <div class="txt-wrap" :title="state.specStr">{{ state.specStr }}</div>
  122. </div>
  123. </div>
  124. <div class="row">
  125. <div class="tit">{{ $t('modelManage.workServerNumber') }}:</div>
  126. <div class="val">
  127. <div class="txt-wrap" :title="state.workServerNumber">{{ state.workServerNumber }}</div>
  128. </div>
  129. </div>
  130. <div class="row">
  131. <div class="tit">{{ $t('modelManage.runParameters') }}:</div>
  132. <div class="val">
  133. <div class="txt-wrap" :title="state.parameters">{{ state.parameters }}</div>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. </div>
  139. <div class="expand-line">
  140. <div class="line"></div>
  141. <div class="expand-btn" @click="isExpanded = !isExpanded">
  142. <i class="icon chevron circle down" :class="isExpanded ? 'up' : ''"></i>
  143. <span>{{ isExpanded ? $t('modelManage.collapseDetails') : $t('modelManage.seeMore') }}</span>
  144. </div>
  145. <div class="line"></div>
  146. </div>
  147. <div class="files-info">
  148. <div class="top">
  149. <div style="width:100%;margin-right:20px;">
  150. <div class="title">{{ $t('modelManage.modelFilesList') }}:</div>
  151. <div class="title files-path-c" style="margin-top:8px;margin-bottom:4px">
  152. <div class="file-path" v-for="(item, index) in filePath">
  153. <span v-if="index == filePath.length - 1" class="path-name">{{ item.label }}</span>
  154. <a v-if="index != filePath.length - 1" class="path-name canback" @click="goBackDir(item)">{{ item.label
  155. }}</a>
  156. <span style="color:rgba(0,0,0,.4);" class="divider"> / </span>
  157. </div>
  158. </div>
  159. </div>
  160. <div>
  161. <el-button v-if="modelType == 1 && canOperate" type="primary" icon="el-icon-upload" @click="goUploadPage">
  162. {{ $t('modelManage.uploadModelFiles') }}
  163. </el-button>
  164. </div>
  165. </div>
  166. <div class="table-container">
  167. <el-table ref="tableRef" :data="filesList" row-key="sn" style="width: 100%" v-loading="loading" stripe>
  168. <el-table-column column-key="FileName" prop="FileName" sortable
  169. :sort-method="(a, b) => a.FileName.toLocaleLowerCase().localeCompare(b.FileName.toLocaleLowerCase())"
  170. :label="$t('modelManage.fileName')" align="left" header-align="left">
  171. <template slot-scope="scope">
  172. <div class="tbl-file-name">
  173. <a v-if="scope.row.IsDir" @click="goNextDir(scope.row)" href="javascript:;">
  174. <div class="fitted" :title="scope.row.FileName">
  175. <i class="icon folder" width="16" height="16" aria-hidden="true"></i>
  176. <span>{{ scope.row.FileName }}</span>
  177. </div>
  178. </a>
  179. <a v-else :class="!canOperate ? 'disabled-download' : ''"
  180. :href="canOperate ? `${repo}/modelmanage/${state.id}/downloadsingle?parentDir=${filePath.length > 1 ? encodeURIComponent(filePath.map(item => item.path).join('/').slice(1) + '/') : ''}&fileName=${scope.row.FileName}` : 'javascript:;'">
  181. <div class="fitted" :title="scope.row.FileName">
  182. <i class="icon file" width="16" height="16" aria-hidden="true"></i>
  183. <span>{{ scope.row.FileName }}</span>
  184. </div>
  185. </a>
  186. </div>
  187. </template>
  188. </el-table-column>
  189. <el-table-column column-key="SizeShow" prop="SizeShow" sortable :sort-method="(a, b) => a.Size - b.Size"
  190. :label="$t('modelManage.fileSize')" align="center" header-align="center" width="200">
  191. </el-table-column>
  192. <el-table-column column-key="ModTime" prop="ModTime" sortable
  193. :sort-method="(a, b) => a.ModTimeNum - b.ModTimeNum" :label="$t('modelManage.updateTime')" align="center"
  194. header-align="center" width="200">
  195. </el-table-column>
  196. <el-table-column v-if="modelType == 1 && canDelete" column-key="operate" prop="operate"
  197. :label="$t('modelManage.operate')" align="center" header-align="center" width="200">
  198. <template slot-scope="scope">
  199. <span v-if="!scope.row.IsDir" class="btn-del" @click="deleteFile(scope.row)">{{ $t('modelManage.delete')
  200. }}</span>
  201. </template>
  202. </el-table-column>
  203. </el-table>
  204. </div>
  205. </div>
  206. </div>
  207. </div>
  208. </template>
  209. <script>
  210. import { getModelInfoByName, modifyModel, getModelFiles, deleteModelFile } from '~/apis/modules/modelmanage';
  211. import { getUrlSearchParams, getListValueWithKey, transFileSize, renderSpecStr } from '~/utils';
  212. import { MODEL_ENGINES } from '~/const';
  213. import { formatDate } from 'element-ui/lib/utils/date-util';
  214. const REPO_NAME = location.pathname.split('/')[2];
  215. const MAX_LABEL_COUNT = 5;
  216. export default {
  217. data() {
  218. return {
  219. modelType: '0', // 1-本地, 0-线上
  220. canOperate: false,
  221. canDelete: false,
  222. isExpanded: false,
  223. loading: false,
  224. repo: location.pathname.split('/').slice(0, 3).join('/'),
  225. state: {
  226. type: 0,
  227. id: '',
  228. name: '',
  229. version: '0.0.1',
  230. engine: '0',
  231. label: '',
  232. description: '',
  233. },
  234. editDescr: '',
  235. isEidtDescr: false,
  236. editLabel: '',
  237. isEidtLabel: false,
  238. engineList: MODEL_ENGINES,
  239. curVersion: '',
  240. modelList: [],
  241. filesList: [],
  242. filePath: [],
  243. };
  244. },
  245. components: {},
  246. methods: {
  247. getDirFiles(dir) {
  248. dir = dir.length ? dir.slice(1) : '';
  249. getModelFiles({
  250. repo: this.repo,
  251. ID: this.state.id,
  252. parentDir: dir,
  253. }).then(res => {
  254. const list = res.data || [];
  255. list.forEach(item => {
  256. item.SizeShow = item.IsDir ? '' : transFileSize(item.Size);
  257. item.ModTimeNum = new Date(item.ModTime).getTime();
  258. })
  259. list.sort((a, b) => b.ModTimeNum - a.ModTimeNum);
  260. this.filesList = list;
  261. this.$refs['tableRef']?.clearSort();
  262. }).catch(err => {
  263. console.log(err);
  264. });
  265. },
  266. goNextDir(item) {
  267. this.filePath.push({
  268. label: item.FileName,
  269. path: item.FileName
  270. });
  271. const dir = this.filePath.map((item) => item.path).join('/');
  272. this.getDirFiles(dir);
  273. },
  274. goBackDir(item) {
  275. const index = this.filePath.findIndex(pth => item === pth);
  276. this.filePath = this.filePath.slice(0, index + 1);
  277. const dir = this.filePath.map((item) => item.path).join('/');
  278. this.getDirFiles(dir);
  279. },
  280. changeVersion(version, noFileRefresh) {
  281. const data = this.modelList.filter((model) => model.version == version)[0];
  282. this.modelType = data.modelType;
  283. this.canOperate = data.isCanOper;
  284. this.canDelete = data.isCanDelete;
  285. this.state.type = data.type;
  286. this.state.typeStr = data.type == 0 ? 'CPU/GPU' : data.type == 1 ? 'NPU' : '';
  287. this.state.id = data.id;
  288. this.state.name = data.name;
  289. this.state.version = data.version;
  290. this.state.engine = data.engine.toString();
  291. this.state.engineName = getListValueWithKey(MODEL_ENGINES, data.engine.toString());
  292. this.state.modelSize = transFileSize(data.size);
  293. this.state.label = data.label || '--';
  294. this.state._label = data.label;
  295. this.state.description = data.description || '--';
  296. this.state._description = data.description;
  297. this.state.createTime = formatDate(new Date(data.createdUnix * 1000), 'yyyy-MM-dd HH:mm:ss');
  298. const trainTaskInfo = data.trainTaskInfo ? JSON.parse(data.trainTaskInfo) : '';
  299. Object.assign(this.state, {
  300. displayJobName: '--',
  301. branchName: '--',
  302. bootFile: '--',
  303. datasetName: '--',
  304. parameters: '--',
  305. workServerNumber: '--',
  306. specStr: '--',
  307. });
  308. if (trainTaskInfo) {
  309. const parameters = trainTaskInfo.Parameters ? JSON.parse(trainTaskInfo.Parameters).parameter : [];
  310. const parametersStr = parameters.map((item) => { return item.label + '=' + item.value }).join('; ');
  311. const taskType = trainTaskInfo.Type;
  312. let taskUrl = location.href.split('modelmanage')[0];
  313. if (taskType == 0) {
  314. taskUrl = taskUrl + 'cloudbrain/train-job/' + trainTaskInfo.JobID;
  315. } else if (taskType == 1) {
  316. taskUrl = taskUrl + 'modelarts/train-job/' + trainTaskInfo.JobID;
  317. } else if (taskType == 2) {
  318. taskUrl = taskUrl + 'grampus/train-job/' + trainTaskInfo.JobID;
  319. }
  320. const versionName = trainTaskInfo.VersionName;
  321. const versionHtml = versionName ? `<span class="append-txt" title="${versionName}">${versionName}</span>` : '';
  322. const codeCommitID = data.codeCommitID;
  323. const codeCommitIDHtml = codeCommitID ? `<span class="append-txt" title="${codeCommitID}">${codeCommitID.slice(0, 10)}</span>` : '';
  324. let specObj;
  325. try {
  326. specObj = trainTaskInfo.FlavorName ? JSON.parse(trainTaskInfo.FlavorName) : '';
  327. } catch (e) {
  328. specObj = trainTaskInfo.FlavorName;
  329. }
  330. const sepcStr = typeof specObj == 'object' ? renderSpecStr(specObj, false) : specObj;
  331. Object.assign(this.state, {
  332. displayJobName: `<a href="${taskUrl}" title="${trainTaskInfo.DisplayJobName}">${trainTaskInfo.DisplayJobName}</a>${versionHtml}`,
  333. branchName: `<span>${trainTaskInfo.BranchName}</span>${codeCommitIDHtml}`,
  334. bootFile: trainTaskInfo.BootFile,
  335. datasetName: trainTaskInfo.DatasetName,
  336. parameters: parametersStr || '--',
  337. workServerNumber: trainTaskInfo.WorkServerNumber || '--',
  338. specStr: sepcStr || '--',
  339. });
  340. }
  341. this.curVersion = version;
  342. if (!noFileRefresh) {
  343. this.filePath = [{ label: version, path: '' }];
  344. this.getDirFiles('')
  345. }
  346. },
  347. goUploadPage() {
  348. window.location.href = `${this.repo}/modelmanage/create_local_model_2?type=1&name=${encodeURIComponent(this.state.name)}&id=${this.state.id}`;
  349. },
  350. backToModelListPage() {
  351. const list = window.location.href.split('/');
  352. list.pop();
  353. list.push('show_model');
  354. window.location.href = list.join('/');
  355. },
  356. labelInput() {
  357. const hasEndSpace = this.editLabel[this.editLabel.length - 1] == ' ';
  358. const list = this.editLabel.trim().split(' ').filter(label => label != '');
  359. this.editLabel = list.slice(0, MAX_LABEL_COUNT).join(' ') + (hasEndSpace && list.length < MAX_LABEL_COUNT ? ' ' : '');
  360. },
  361. submitEidt(type) {
  362. const obj = {
  363. repo: this.repo,
  364. type: this.state.type,
  365. id: this.state.id,
  366. name: this.state.name,
  367. version: this.state.version,
  368. engine: this.state.engine,
  369. label: type == 'label' ? this.editLabel : this.state.label,
  370. description: type == 'descr' ? this.editDescr : this.state.description,
  371. };
  372. modifyModel(obj).then(res => {
  373. res = res.data;
  374. if (res && res.code == '0') {
  375. if (type == 'label') {
  376. this.state.label = this.editLabel;
  377. this.state._label = this.editLabel;
  378. this.isEidtLabel = false;
  379. } else if (type == 'descr') {
  380. this.state.description = this.editDescr;
  381. this.state._description = this.editDescr;
  382. this.isEidtDescr = false;
  383. }
  384. } else {
  385. this.$message({
  386. type: 'error',
  387. message: this.$t('modelManage.infoModificationFailed'),
  388. });
  389. }
  390. }).catch(err => {
  391. console.log(err);
  392. this.$message({
  393. type: 'error',
  394. message: this.$t('modelManage.infoModificationFailed'),
  395. });
  396. });
  397. },
  398. deleteFile(file) {
  399. this.$confirm(this.$t('modelManage.deleteModelFileConfirmTips'), this.$t('tips'), {
  400. confirmButtonText: this.$t('confirm1'),
  401. cancelButtonText: this.$t('cancel'),
  402. type: 'warning',
  403. lockScroll: false,
  404. }).then(() => {
  405. this.loading = true;
  406. deleteModelFile({
  407. repo: this.repo,
  408. id: this.state.id,
  409. fileName: file.FileName,
  410. }).then(res => {
  411. res = res.data;
  412. if (res.code == '0') {
  413. setTimeout(() => {
  414. this.loading = false;
  415. this.updateModelInfo();
  416. const dir = this.filePath.map((item) => item.path).join('/');
  417. this.getDirFiles(dir);
  418. }, 30);
  419. } else {
  420. this.loading = false;
  421. this.$message({
  422. type: 'error',
  423. message: this.$t('modelManage.modelFileDeleteFailed'),
  424. });
  425. }
  426. }).catch(err => {
  427. console.log(err);
  428. this.$message({
  429. type: 'error',
  430. message: this.$t('modelManage.modelFileDeleteFailed'),
  431. });
  432. });
  433. }).catch(() => { });
  434. },
  435. updateModelInfo() {
  436. getModelInfoByName({
  437. repo: this.repo,
  438. name: this.state.name,
  439. }).then(res => {
  440. const list = res.data || [];
  441. this.modelList = list;
  442. const noFileRefresh = true;
  443. this.changeVersion(this.curVersion, noFileRefresh);
  444. }).catch(err => {
  445. console.log(err);
  446. });
  447. },
  448. },
  449. mounted() {
  450. const urlParams = getUrlSearchParams();
  451. if (urlParams.name) {
  452. this.state.name = urlParams.name;
  453. this.loading = true;
  454. getModelInfoByName({
  455. repo: this.repo,
  456. name: urlParams.name,
  457. }).then(res => {
  458. this.loading = false;
  459. const list = res.data || [];
  460. this.modelList = list;
  461. if (list && list.length) {
  462. const data = list[0];
  463. this.changeVersion(data.version);
  464. }
  465. }).catch(err => {
  466. this.loading = false;
  467. console.log(err);
  468. this.backToModelListPage();
  469. });
  470. } else {
  471. this.backToModelListPage();
  472. }
  473. },
  474. beforeDestroy() {
  475. },
  476. };
  477. </script>
  478. <style scoped lang="less">
  479. .header {
  480. display: flex;
  481. align-items: center;
  482. .version {
  483. margin-left: 16px;
  484. width: 90px;
  485. }
  486. }
  487. .content {
  488. .title {
  489. font-weight: 550;
  490. font-size: 14px;
  491. color: rgb(16, 16, 16);
  492. margin-bottom: 10px;
  493. }
  494. .detail-info {
  495. border: 1px solid rgb(232, 232, 232);
  496. border-bottom: none;
  497. padding: 22px;
  498. padding-bottom: 1px;
  499. .area-c {
  500. display: flex;
  501. .area {
  502. flex: 1;
  503. .row {
  504. display: flex;
  505. height: 32px;
  506. margin-bottom: 4px;
  507. align-items: center;
  508. &.edit-row {
  509. height: unset;
  510. }
  511. .tit {
  512. width: 160px;
  513. text-align: right;
  514. color: rgb(136, 136, 136);
  515. }
  516. .val {
  517. flex: 1;
  518. color: rgb(16, 16, 16);
  519. position: relative;
  520. height: 20px;
  521. &.edit-val {
  522. height: unset;
  523. }
  524. .txt-wrap {
  525. position: absolute;
  526. overflow: hidden;
  527. text-overflow: ellipsis;
  528. white-space: nowrap;
  529. width: 100%;
  530. /deep/.append-txt {
  531. margin-left: 6px;
  532. background-color: gainsboro;
  533. padding: 2px;
  534. border-radius: 2px;
  535. font-size: 12px;
  536. }
  537. }
  538. }
  539. .txt-edit {
  540. padding-right: 20px;
  541. }
  542. }
  543. }
  544. }
  545. }
  546. .expand-line {
  547. display: flex;
  548. align-items: center;
  549. border: 1px solid rgb(232, 232, 232);
  550. border-top: none;
  551. border-bottom: none;
  552. padding: 16px 0;
  553. .line {
  554. flex: 1;
  555. height: 1px;
  556. background-color: rgb(232, 232, 232);
  557. margin: 0 22px;
  558. }
  559. .expand-btn {
  560. color: rgba(22, 132, 252, 1);
  561. cursor: pointer;
  562. .icon {
  563. margin-right: 2px;
  564. font-size: 14px;
  565. color: rgba(22, 132, 252, 0.8),
  566. }
  567. }
  568. }
  569. .files-info {
  570. border: 1px solid rgb(232, 232, 232);
  571. border-top: none;
  572. border-bottom: none;
  573. .top {
  574. padding: 0 22px 8px 22px;
  575. display: flex;
  576. align-items: center;
  577. justify-content: space-between;
  578. }
  579. .files-path-c {
  580. margin-bottom: 4px;
  581. height: 20px;
  582. .file-path {
  583. margin-right: 6px;
  584. float: left;
  585. .path-name {
  586. &.canback {
  587. color: #4183c4;
  588. }
  589. }
  590. }
  591. }
  592. .table-container {
  593. /deep/ .el-table__header {
  594. th {
  595. background: rgb(245, 245, 246);
  596. color: rgb(16, 16, 16);
  597. font-weight: 400;
  598. font-size: 14px;
  599. }
  600. }
  601. /deep/ .el-table__body {
  602. td {
  603. color: rgb(16, 16, 16);
  604. font-weight: 400;
  605. font-size: 14px;
  606. }
  607. }
  608. .tbl-file-name {
  609. height: 32px;
  610. display: flex;
  611. align-items: center;
  612. overflow: hidden;
  613. font-size: 16px;
  614. font-weight: 500;
  615. position: relative;
  616. a {
  617. max-width: 100%;
  618. .fitted {
  619. overflow: hidden;
  620. text-overflow: ellipsis;
  621. white-space: nowrap;
  622. max-width: 100%;
  623. }
  624. }
  625. .disabled-download {
  626. cursor: default;
  627. pointer-events: none;
  628. color: rgba(0, 0, 0, .6) !important;
  629. opacity: .45 !important;
  630. }
  631. }
  632. .btn-del {
  633. color: #0366d6;
  634. cursor: pointer;
  635. }
  636. }
  637. }
  638. }
  639. .el-select-dropdown__item.selected {
  640. color: rgba(0, 0, 0, .95);
  641. }
  642. /deep/ .el-select {
  643. .is-focus {
  644. .el-input__inner {
  645. border-color: #85b7d9;
  646. }
  647. }
  648. }
  649. .el-select {
  650. /deep/ .el-input__inner {
  651. font-weight: 600;
  652. }
  653. }
  654. /deep/ .el-input__inner {
  655. &:focus {
  656. border-color: #85b7d9;
  657. }
  658. }
  659. /deep/ .el-textarea__inner {
  660. &:focus {
  661. border-color: #85b7d9;
  662. }
  663. }
  664. </style>