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

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
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
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
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
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
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
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
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
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  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="!canOperate ? 'disabled-download' : ''"
  186. :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:;'">
  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. canDelete: false,
  228. isExpanded: false,
  229. loading: false,
  230. repo: location.pathname.split('/').slice(0, 3).join('/'),
  231. state: {
  232. type: 0,
  233. id: '',
  234. name: '',
  235. version: '0.0.1',
  236. engine: '0',
  237. label: '',
  238. description: '',
  239. },
  240. editDescr: '',
  241. isEidtDescr: false,
  242. editLabel: '',
  243. isEidtLabel: false,
  244. engineList: MODEL_ENGINES,
  245. curVersion: '',
  246. modelList: [],
  247. filesList: [],
  248. filePath: [],
  249. };
  250. },
  251. components: {},
  252. methods: {
  253. getDirFiles(dir) {
  254. dir = dir.length ? dir.slice(1) : '';
  255. getModelFiles({
  256. repo: this.repo,
  257. ID: this.state.id,
  258. parentDir: dir,
  259. }).then(res => {
  260. const list = res.data || [];
  261. list.forEach(item => {
  262. item.SizeShow = item.IsDir ? '' : transFileSize(item.Size);
  263. item.ModTimeNum = new Date(item.ModTime).getTime();
  264. })
  265. list.sort((a, b) => b.ModTimeNum - a.ModTimeNum);
  266. this.filesList = list;
  267. this.$refs['tableRef']?.clearSort();
  268. }).catch(err => {
  269. console.log(err);
  270. });
  271. },
  272. goNextDir(item) {
  273. this.filePath.push({
  274. label: item.FileName,
  275. path: item.FileName
  276. });
  277. const dir = this.filePath.map((item) => item.path).join('/');
  278. this.getDirFiles(dir);
  279. },
  280. goBackDir(item) {
  281. const index = this.filePath.findIndex(pth => item === pth);
  282. this.filePath = this.filePath.slice(0, index + 1);
  283. const dir = this.filePath.map((item) => item.path).join('/');
  284. this.getDirFiles(dir);
  285. },
  286. changeVersion(version, noFileRefresh) {
  287. const data = this.modelList.filter((model) => model.version == version)[0];
  288. this.modelType = data.modelType;
  289. this.canOperate = data.isCanOper;
  290. this.canDelete = data.isCanDelete;
  291. this.state.type = data.type;
  292. this.state.typeStr = data.type == 0 ? 'CPU/GPU' : data.type == 1 ? 'NPU' : '';
  293. this.state.id = data.id;
  294. this.state.name = data.name;
  295. this.state.version = data.version;
  296. this.state.engine = data.engine.toString();
  297. this.state.engineName = getListValueWithKey(MODEL_ENGINES, data.engine.toString());
  298. this.state.modelSize = transFileSize(data.size);
  299. this.state.label = data.label || '--';
  300. this.state._label = data.label;
  301. this.state.description = data.description || '--';
  302. this.state._description = data.description;
  303. this.state.isPrivate= (data.isPrivate == true ? this.$t('modelManage.modelAccessPrivate'):this.$t('modelManage.modelAccessPublic'));
  304. this.state.createTime = formatDate(new Date(data.createdUnix * 1000), 'yyyy-MM-dd HH:mm:ss');
  305. const trainTaskInfo = data.trainTaskInfo ? JSON.parse(data.trainTaskInfo) : '';
  306. Object.assign(this.state, {
  307. displayJobName: '--',
  308. branchName: '--',
  309. bootFile: '--',
  310. datasetName: '--',
  311. parameters: '--',
  312. workServerNumber: '--',
  313. specStr: '--',
  314. });
  315. if (trainTaskInfo) {
  316. const parameters = trainTaskInfo.Parameters ? JSON.parse(trainTaskInfo.Parameters).parameter : [];
  317. const parametersStr = parameters.map((item) => { return item.label + '=' + item.value }).join('; ');
  318. const taskType = trainTaskInfo.Type;
  319. let taskUrl = location.href.split('modelmanage')[0];
  320. if (taskType == 0) {
  321. taskUrl = taskUrl + 'cloudbrain/train-job/' + trainTaskInfo.JobID;
  322. } else if (taskType == 1) {
  323. taskUrl = taskUrl + 'modelarts/train-job/' + trainTaskInfo.JobID;
  324. } else if (taskType == 2) {
  325. taskUrl = taskUrl + 'grampus/train-job/' + trainTaskInfo.JobID;
  326. }
  327. const versionName = trainTaskInfo.VersionName;
  328. const versionHtml = versionName ? `<span class="append-txt" title="${versionName}">${versionName}</span>` : '';
  329. const codeCommitID = data.codeCommitID;
  330. const codeCommitIDHtml = codeCommitID ? `<span class="append-txt" title="${codeCommitID}">${codeCommitID.slice(0, 10)}</span>` : '';
  331. let specObj;
  332. try {
  333. specObj = trainTaskInfo.FlavorName ? JSON.parse(trainTaskInfo.FlavorName) : '';
  334. } catch (e) {
  335. specObj = trainTaskInfo.FlavorName;
  336. }
  337. const sepcStr = typeof specObj == 'object' ? renderSpecStr(specObj, false) : specObj;
  338. Object.assign(this.state, {
  339. displayJobName: `<a href="${taskUrl}" title="${trainTaskInfo.DisplayJobName}">${trainTaskInfo.DisplayJobName}</a>${versionHtml}`,
  340. branchName: `<span>${trainTaskInfo.BranchName}</span>${codeCommitIDHtml}`,
  341. bootFile: trainTaskInfo.BootFile,
  342. datasetName: trainTaskInfo.DatasetName,
  343. parameters: parametersStr || '--',
  344. workServerNumber: trainTaskInfo.WorkServerNumber || '1',
  345. specStr: sepcStr || '--',
  346. });
  347. }
  348. this.curVersion = version;
  349. if (!noFileRefresh) {
  350. this.filePath = [{ label: version, path: '' }];
  351. this.getDirFiles('')
  352. }
  353. },
  354. goUploadPage() {
  355. window.location.href = `${this.repo}/modelmanage/create_local_model_2?type=1&name=${encodeURIComponent(this.state.name)}&id=${this.state.id}`;
  356. },
  357. backToModelListPage() {
  358. const list = window.location.href.split('/');
  359. list.pop();
  360. list.push('show_model');
  361. window.location.href = list.join('/');
  362. },
  363. labelInput() {
  364. const hasEndSpace = this.editLabel[this.editLabel.length - 1] == ' ';
  365. const list = this.editLabel.trim().split(' ').filter(label => label != '');
  366. this.editLabel = list.slice(0, MAX_LABEL_COUNT).join(' ') + (hasEndSpace && list.length < MAX_LABEL_COUNT ? ' ' : '');
  367. },
  368. submitEidt(type) {
  369. const obj = {
  370. repo: this.repo,
  371. type: this.state.type,
  372. id: this.state.id,
  373. name: this.state.name,
  374. version: this.state.version,
  375. engine: this.state.engine,
  376. label: type == 'label' ? this.editLabel : this.state.label,
  377. description: type == 'descr' ? this.editDescr : this.state.description,
  378. };
  379. modifyModel(obj).then(res => {
  380. res = res.data;
  381. if (res && res.code == '0') {
  382. if (type == 'label') {
  383. this.state.label = this.editLabel;
  384. this.state._label = this.editLabel;
  385. this.isEidtLabel = false;
  386. } else if (type == 'descr') {
  387. this.state.description = this.editDescr;
  388. this.state._description = this.editDescr;
  389. this.isEidtDescr = false;
  390. }
  391. } else {
  392. this.$message({
  393. type: 'error',
  394. message: this.$t('modelManage.infoModificationFailed'),
  395. });
  396. }
  397. }).catch(err => {
  398. console.log(err);
  399. this.$message({
  400. type: 'error',
  401. message: this.$t('modelManage.infoModificationFailed'),
  402. });
  403. });
  404. },
  405. deleteFile(file) {
  406. this.$confirm(this.$t('modelManage.deleteModelFileConfirmTips'), this.$t('tips'), {
  407. confirmButtonText: this.$t('confirm1'),
  408. cancelButtonText: this.$t('cancel'),
  409. type: 'warning',
  410. lockScroll: false,
  411. }).then(() => {
  412. this.loading = true;
  413. deleteModelFile({
  414. repo: this.repo,
  415. id: this.state.id,
  416. fileName: file.FileName,
  417. }).then(res => {
  418. res = res.data;
  419. if (res.code == '0') {
  420. setTimeout(() => {
  421. this.loading = false;
  422. this.updateModelInfo();
  423. const dir = this.filePath.map((item) => item.path).join('/');
  424. this.getDirFiles(dir);
  425. }, 30);
  426. } else {
  427. this.loading = false;
  428. this.$message({
  429. type: 'error',
  430. message: this.$t('modelManage.modelFileDeleteFailed'),
  431. });
  432. }
  433. }).catch(err => {
  434. console.log(err);
  435. this.$message({
  436. type: 'error',
  437. message: this.$t('modelManage.modelFileDeleteFailed'),
  438. });
  439. });
  440. }).catch(() => { });
  441. },
  442. updateModelInfo() {
  443. getModelInfoByName({
  444. repo: this.repo,
  445. name: this.state.name,
  446. }).then(res => {
  447. const list = res.data || [];
  448. this.modelList = list;
  449. const noFileRefresh = true;
  450. this.changeVersion(this.curVersion, noFileRefresh);
  451. }).catch(err => {
  452. console.log(err);
  453. });
  454. },
  455. },
  456. mounted() {
  457. const urlParams = getUrlSearchParams();
  458. if (urlParams.name) {
  459. this.state.name = urlParams.name;
  460. this.loading = true;
  461. getModelInfoByName({
  462. repo: this.repo,
  463. name: urlParams.name,
  464. }).then(res => {
  465. this.loading = false;
  466. const list = res.data || [];
  467. this.modelList = list;
  468. if (list && list.length) {
  469. const data = list[0];
  470. this.changeVersion(data.version);
  471. }
  472. }).catch(err => {
  473. this.loading = false;
  474. console.log(err);
  475. this.backToModelListPage();
  476. });
  477. } else {
  478. this.backToModelListPage();
  479. }
  480. },
  481. beforeDestroy() {
  482. },
  483. };
  484. </script>
  485. <style scoped lang="less">
  486. .header {
  487. display: flex;
  488. align-items: center;
  489. .version {
  490. margin-left: 16px;
  491. width: 90px;
  492. }
  493. }
  494. .content {
  495. .title {
  496. font-weight: 550;
  497. font-size: 14px;
  498. color: rgb(16, 16, 16);
  499. margin-bottom: 10px;
  500. }
  501. .detail-info {
  502. border: 1px solid rgb(232, 232, 232);
  503. border-bottom: none;
  504. padding: 22px;
  505. padding-bottom: 1px;
  506. .area-c {
  507. display: flex;
  508. .area {
  509. flex: 1;
  510. .row {
  511. display: flex;
  512. height: 32px;
  513. margin-bottom: 4px;
  514. align-items: center;
  515. &.edit-row {
  516. height: unset;
  517. }
  518. .tit {
  519. width: 160px;
  520. text-align: right;
  521. color: rgb(136, 136, 136);
  522. }
  523. .val {
  524. flex: 1;
  525. color: rgb(16, 16, 16);
  526. position: relative;
  527. height: 20px;
  528. &.edit-val {
  529. height: unset;
  530. }
  531. .txt-wrap {
  532. position: absolute;
  533. overflow: hidden;
  534. text-overflow: ellipsis;
  535. white-space: nowrap;
  536. width: 100%;
  537. /deep/.append-txt {
  538. margin-left: 6px;
  539. background-color: gainsboro;
  540. padding: 2px;
  541. border-radius: 2px;
  542. font-size: 12px;
  543. }
  544. }
  545. }
  546. .txt-edit {
  547. padding-right: 20px;
  548. }
  549. }
  550. }
  551. }
  552. }
  553. .expand-line {
  554. display: flex;
  555. align-items: center;
  556. border: 1px solid rgb(232, 232, 232);
  557. border-top: none;
  558. border-bottom: none;
  559. padding: 16px 0;
  560. .line {
  561. flex: 1;
  562. height: 1px;
  563. background-color: rgb(232, 232, 232);
  564. margin: 0 22px;
  565. }
  566. .expand-btn {
  567. color: rgba(22, 132, 252, 1);
  568. cursor: pointer;
  569. .icon {
  570. margin-right: 2px;
  571. font-size: 14px;
  572. color: rgba(22, 132, 252, 0.8),
  573. }
  574. }
  575. }
  576. .files-info {
  577. border: 1px solid rgb(232, 232, 232);
  578. border-top: none;
  579. border-bottom: none;
  580. .top {
  581. padding: 0 22px 8px 22px;
  582. display: flex;
  583. align-items: center;
  584. justify-content: space-between;
  585. }
  586. .files-path-c {
  587. margin-bottom: 4px;
  588. height: 20px;
  589. .file-path {
  590. margin-right: 6px;
  591. float: left;
  592. .path-name {
  593. &.canback {
  594. color: #4183c4;
  595. }
  596. }
  597. }
  598. }
  599. .table-container {
  600. /deep/ .el-table__header {
  601. th {
  602. background: rgb(245, 245, 246);
  603. color: rgb(16, 16, 16);
  604. font-weight: 400;
  605. font-size: 14px;
  606. }
  607. }
  608. /deep/ .el-table__body {
  609. td {
  610. color: rgb(16, 16, 16);
  611. font-weight: 400;
  612. font-size: 14px;
  613. }
  614. }
  615. .tbl-file-name {
  616. height: 32px;
  617. display: flex;
  618. align-items: center;
  619. overflow: hidden;
  620. font-size: 16px;
  621. font-weight: 500;
  622. position: relative;
  623. a {
  624. max-width: 100%;
  625. .fitted {
  626. overflow: hidden;
  627. text-overflow: ellipsis;
  628. white-space: nowrap;
  629. max-width: 100%;
  630. }
  631. }
  632. .disabled-download {
  633. cursor: default;
  634. pointer-events: none;
  635. color: rgba(0, 0, 0, .6) !important;
  636. opacity: .45 !important;
  637. }
  638. }
  639. .btn-del {
  640. color: #0366d6;
  641. cursor: pointer;
  642. }
  643. }
  644. }
  645. }
  646. .el-select-dropdown__item.selected {
  647. color: rgba(0, 0, 0, .95);
  648. }
  649. /deep/ .el-select {
  650. .is-focus {
  651. .el-input__inner {
  652. border-color: #85b7d9;
  653. }
  654. }
  655. }
  656. .el-select {
  657. /deep/ .el-input__inner {
  658. font-weight: 600;
  659. }
  660. }
  661. /deep/ .el-input__inner {
  662. &:focus {
  663. border-color: #85b7d9;
  664. }
  665. }
  666. /deep/ .el-textarea__inner {
  667. &:focus {
  668. border-color: #85b7d9;
  669. }
  670. }
  671. </style>