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 14 kB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <template>
  2. <div>
  3. <div class="ui container" id="header">
  4. <el-row style="margin-top:15px;" v-loading.fullscreen.lock="fullscreenLoading">
  5. <el-table
  6. :data="tableData"
  7. style="min-width: 100%"
  8. row-key="ID"
  9. lazy
  10. :load="load"
  11. :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
  12. :header-cell-style="tableHeaderStyle"
  13. >
  14. <el-table-column
  15. prop="Name"
  16. label="模型名称"
  17. align="left"
  18. min-width="18%"
  19. >
  20. <template slot-scope="scope">
  21. <div class="expand-icon" v-if="scope.row.hasChildren===false">
  22. <i class="el-icon-arrow-right"></i>
  23. </div>
  24. <!-- <i class="el-icon-time"></i> -->
  25. <a class="text-over" :href="showinfoHref+scope.row.Name" :title="scope.row.Name">{{ scope.row.Name }}</a>
  26. </template>
  27. </el-table-column>
  28. <el-table-column
  29. prop="Version"
  30. label="版本"
  31. align="center"
  32. min-width="6.5%"
  33. >
  34. <template slot-scope="scope">
  35. <span class="text-over" :title="scope.row.Version">{{ scope.row.Version}}</span>
  36. </template>
  37. </el-table-column>
  38. <el-table-column
  39. prop="VersionCount"
  40. label="版本数"
  41. align="center"
  42. min-width="7.5%"
  43. >
  44. <template slot-scope="scope">
  45. <span class="text-over" :title="scope.row.VersionCount">{{ scope.row.VersionCount}}</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column
  49. prop="Size"
  50. label="模型大小"
  51. align="center"
  52. min-width="10.5%"
  53. >
  54. <template slot-scope="scope">
  55. <span class="text-over">{{ renderSize(scope.row.Size)}}</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column
  59. prop="EngineName"
  60. label="AI引擎"
  61. align="center"
  62. min-width="8.5%"
  63. >
  64. <template slot-scope="scope">
  65. <span class="text-over">{{ scope.row.EngineName}}</span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column
  69. prop="ComputeResource"
  70. label="计算资源"
  71. align="center"
  72. min-width="10.5%"
  73. >
  74. <template slot-scope="scope">
  75. <span class="text-over">{{ scope.row.ComputeResource}}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column
  79. prop="CreatedUnix"
  80. label="创建时间"
  81. align="center"
  82. min-width="13.75%"
  83. >
  84. <template slot-scope="scope">
  85. {{transTime(scope.row.CreatedUnix)}}
  86. </template>
  87. </el-table-column>
  88. <el-table-column
  89. prop="UserName"
  90. label="创建者"
  91. align="center"
  92. min-width="6.75%"
  93. >
  94. <template slot-scope="scope">
  95. <a :href="'/'+scope.row.UserName" :title="scope.row.UserName">
  96. <img class="ui avatar image" :src="scope.row.UserRelAvatarLink">
  97. </a>
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="操作" min-width="18%" align="center">
  101. <template slot-scope="scope">
  102. <div class="space-around">
  103. <a :style="{visibility:!scope.row.Children ? 'visible':'hidden'}" :class="{'disabled':!scope.row.IsCanOper}" @click="showcreateVue(scope.row.Name,scope.row.Version)">创建新版本</a>
  104. <a :href="loadhref+scope.row.ID" :class="{'disabled':!scope.row.IsCanOper}">下载</a>
  105. <a :class="{'disabled':!scope.row.IsCanOper}" @click="deleteModel(scope.row.ID)">删除</a>
  106. </div>
  107. </template>
  108. </el-table-column>
  109. </el-table>
  110. </el-row>
  111. <div class="ui container" style="margin-top:50px;text-align:center">
  112. <el-pagination
  113. background
  114. @size-change="handleSizeChange"
  115. @current-change="handleCurrentChange"
  116. :current-page="currentPage"
  117. :page-sizes="[10]"
  118. :page-size="pageSize"
  119. layout="total, sizes, prev, pager, next, jumper"
  120. :total="totalNum">
  121. </el-pagination>
  122. </div>
  123. </div>
  124. </div>
  125. </template>
  126. <script>
  127. const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config;
  128. export default {
  129. components: {
  130. },
  131. data() {
  132. return {
  133. currentPage:1,
  134. pageSize:10,
  135. totalNum:0,
  136. params:{page:0,pageSize:10},
  137. tableData: [],
  138. fullscreenLoading: false,
  139. url:'',
  140. isLoading:true
  141. };
  142. },
  143. methods: {
  144. load(tree, treeNode, resolve) {
  145. console.log("tree",tree)
  146. this.$axios.get(this.url+'show_model_child_api',{params:{
  147. name:tree.Name
  148. }}).then((res)=>{
  149. console.log(res)
  150. let TrainTaskInfo
  151. let tableData
  152. tableData= res.data
  153. console.log("-----tableData---",tableData)
  154. for(let i=0;i<tableData.length;i++){
  155. TrainTaskInfo = JSON.parse(tableData[i].TrainTaskInfo)
  156. tableData[i].EngineName = TrainTaskInfo.EngineName.split('-')[0]
  157. tableData[i].ComputeResource = TrainTaskInfo.ComputeResource
  158. tableData[i].Name=''
  159. tableData[i].VersionCount = ''
  160. tableData[i].Children = true
  161. }
  162. console.log("=====-----tabledata---",tableData)
  163. resolve(tableData)
  164. })
  165. },
  166. tableHeaderStyle({row,column,rowIndex,columnIndex}){
  167. if(rowIndex===0){
  168. return 'background:#f5f5f6;color:#606266'
  169. }
  170. },
  171. handleSizeChange(val){
  172. this.params.size = val
  173. this.getModelList()
  174. },
  175. handleCurrentChange(val){
  176. this.params.page = val
  177. this.getModelList()
  178. },
  179. showcreateVue(name,version){
  180. $('.ui.modal.second')
  181. .modal({
  182. centered: false,
  183. onShow:function(){
  184. $('.ui.dimmer').css({"background-color":"rgb(136, 136, 136,0.7)"})
  185. $("#job-name").empty()
  186. $('#name').val(name)
  187. let version_string = versionAdd(version)
  188. $('#version').val(version_string)
  189. loadTrainList()
  190. },
  191. onHide:function(){
  192. document.getElementById("formId").reset();
  193. $('#choice_model').dropdown('clear')
  194. $('#choice_version').dropdown('clear')
  195. $('.ui.dimmer').css({"background-color":""})
  196. }
  197. })
  198. .modal('show')
  199. },
  200. deleteModel(id){
  201. this.$axios.delete(this.url+'delete_model',{
  202. params:{
  203. ID:id
  204. }}).then((res)=>{
  205. console.log(res)
  206. this.getModelList()
  207. })
  208. },
  209. getModelList(){
  210. this.fullscreenLoading = false
  211. this.$axios.get(location.href+'_api',{
  212. params:this.params
  213. }).then((res)=>{
  214. console.log("res",res)
  215. let TrainTaskInfo
  216. this.tableData = res.data.data
  217. console.log("this.tableData",this.tableData)
  218. for(let i=0;i<this.tableData.length;i++){
  219. TrainTaskInfo = JSON.parse(this.tableData[i].TrainTaskInfo)
  220. this.tableData[i].EngineName = TrainTaskInfo.EngineName.split('-')[0]
  221. this.tableData[i].ComputeResource = TrainTaskInfo.ComputeResource
  222. this.tableData[i].hasChildren = res.data.data[i].VersionCount===1 ? false : true
  223. }
  224. this.totalNum = res.data.count
  225. console.log("this.tableData.",this.tableData)
  226. this.fullscreenLoading = false
  227. })
  228. },
  229. },
  230. computed:{
  231. loadhref(){
  232. return this.url+'downloadall?ID='
  233. },
  234. showinfoHref(){
  235. return this.url + 'show_model_info?name='
  236. },
  237. transTime(){
  238. return function(time){
  239. let date = new Date(time * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  240. let Y = date.getFullYear() + '-';
  241. let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1):date.getMonth()+1) + '-';
  242. let D = (date.getDate()< 10 ? '0'+date.getDate():date.getDate())+ ' ';
  243. let h = (date.getHours() < 10 ? '0'+date.getHours():date.getHours())+ ':';
  244. let m = (date.getMinutes() < 10 ? '0'+date.getMinutes():date.getMinutes()) + ':';
  245. let s = date.getSeconds() < 10 ? '0'+date.getSeconds():date.getSeconds();
  246. return Y+M+D+h+m+s;
  247. }
  248. },
  249. renderSize(){
  250. return function(value){
  251. if(null==value||value==''){
  252. return "0 Bytes";
  253. }
  254. var unitArr = new Array("Bytes","KB","MB","GB","TB","PB","EB","ZB","YB");
  255. var index=0;
  256. var srcsize = parseFloat(value);
  257. index=Math.floor(Math.log(srcsize)/Math.log(1024));
  258. var size =srcsize/Math.pow(1024,index);
  259. size=size.toFixed(2);//保留的小数位数
  260. return size+unitArr[index];
  261. }
  262. }
  263. },
  264. mounted() {
  265. this.getModelList()
  266. this.url = location.href.split('show_model')[0]
  267. }
  268. };
  269. </script>
  270. <style scoped>
  271. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
  272. background-color: #5bb973;
  273. color: #FFF;
  274. }
  275. /deep/ .el-pagination.is-background .el-pager li.active {
  276. color: #fff;
  277. cursor: default;
  278. }
  279. /deep/ .el-pagination.is-background .el-pager li:hover {
  280. color: #5bb973;
  281. }
  282. /deep/ .el-pagination.is-background .el-pager li:not(.disabled):hover {
  283. color: #5bb973;
  284. }
  285. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active:hover {
  286. background-color: #5bb973;
  287. color: #FFF;
  288. }
  289. /deep/ .el-pager li.active {
  290. color: #08C0B9;
  291. cursor: default;
  292. }
  293. /deep/ .el-pagination .el-pager li:hover {
  294. color: #08C0B9;
  295. }
  296. /deep/ .el-pagination .el-pager li:not(.disabled):hover {
  297. color: #08C0B9;
  298. }
  299. .text-over{
  300. overflow: hidden;
  301. text-overflow: ellipsis;
  302. vertical-align: middle;
  303. white-space: nowrap;
  304. }
  305. .el-icon-arrow-right{
  306. font-family: element-icons!important;
  307. speak: none;
  308. font-style: normal;
  309. font-weight: 400;
  310. font-feature-settings: normal;
  311. font-variant: normal;
  312. text-transform: none;
  313. line-height: 1;
  314. vertical-align: middle;
  315. display: inline-block;
  316. -webkit-font-smoothing: antialiased;
  317. -moz-osx-font-smoothing: grayscale;
  318. border: 1px solid #D4D4D5;
  319. border-radius: 50%;
  320. color: #D4D4D5;
  321. margin-right: 4px;
  322. }
  323. .el-icon-arrow-right::before{
  324. content: "\e6e0";
  325. }
  326. .expand-icon{
  327. display: inline-block;
  328. width: 20px;
  329. line-height: 20px;
  330. height: 20px;
  331. text-align: center;
  332. margin-right: 3px;
  333. font-size: 12px;
  334. }
  335. /deep/ .el-table_1_column_1.is-left .cell {padding-right: 0px !important;}
  336. /deep/ .el-table__expand-icon .el-icon-arrow-right{
  337. font-family: element-icons!important;
  338. speak: none;
  339. font-style: normal;
  340. font-weight: 400;
  341. font-feature-settings: normal;
  342. font-variant: normal;
  343. text-transform: none;
  344. line-height: 1;
  345. vertical-align: middle;
  346. display: inline-block;
  347. -webkit-font-smoothing: antialiased;
  348. -moz-osx-font-smoothing: grayscale;
  349. border: 1px solid #3291F8;
  350. border-radius: 50%;
  351. color: #3291F8;
  352. margin-right: 4px;
  353. }
  354. .space-around{
  355. display: flex;
  356. justify-content: space-around;
  357. }
  358. .disabled {
  359. cursor: default;
  360. pointer-events: none;
  361. color: rgba(0,0,0,.6) !important;
  362. opacity: .45 !important;
  363. }
  364. </style>