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