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

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <div>
  3. <div class="ui container" id="header">
  4. <el-row style="margin-top:15px;">
  5. <el-table
  6. :data="tableData1"
  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. <a class="text-over" style="cursor:default;color:#426290" :title="scope.row.name">{{ scope.row.name }}</a>
  22. </template>
  23. </el-table-column>
  24. <el-table-column
  25. prop="version"
  26. label="版本"
  27. align="center"
  28. min-width="6.5%"
  29. >
  30. <template slot-scope="scope">
  31. <span class="text-over" :title="scope.row.version">{{ scope.row.version}}</span>
  32. </template>
  33. </el-table-column>
  34. <el-table-column
  35. prop="version_count"
  36. label="版本数"
  37. align="center"
  38. min-width="7.5%"
  39. >
  40. <template slot-scope="scope">
  41. <span class="text-over" :title="scope.row.version_count">{{ scope.row.version_count}}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column
  45. prop="modelsize"
  46. label="模型大小"
  47. align="center"
  48. min-width="10.5%"
  49. >
  50. <template slot-scope="scope">
  51. <span class="text-over" :title="scope.row.modelsize">{{ scope.row.modelsize}}</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column
  55. prop="aiengine"
  56. label="AI引擎"
  57. align="center"
  58. min-width="8.5%"
  59. >
  60. <template slot-scope="scope">
  61. <span class="text-over" :title="scope.row.aiengine">{{ scope.row.aiengine}}</span>
  62. </template>
  63. </el-table-column>
  64. <el-table-column
  65. prop="computesource"
  66. label="计算资源"
  67. align="center"
  68. min-width="10.5%"
  69. >
  70. <template slot-scope="scope">
  71. <span class="text-over" :title="scope.row.computesource">{{ scope.row.computesource}}</span>
  72. </template>
  73. </el-table-column>
  74. <el-table-column
  75. prop="createtime"
  76. label="创建时间"
  77. align="center"
  78. min-width="13.75%"
  79. >
  80. <template slot-scope="scope">
  81. {{scope.row.createtime}}
  82. </template>
  83. </el-table-column>
  84. <el-table-column
  85. prop="creator"
  86. label="创建者"
  87. align="center"
  88. min-width="6.75%"
  89. >
  90. <template slot-scope="scope">
  91. {{scope.row.creator}}
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="操作" min-width="18%" align="center">
  95. <template slot-scope="scope">
  96. <a>创建新版本</a>
  97. <a>下载</a>
  98. <a>删除</a>
  99. </template>
  100. </el-table-column>
  101. </el-table>
  102. </el-row>
  103. <div class="ui container" style="margin-top:50px;text-align:center">
  104. <el-pagination
  105. background
  106. @size-change="handleSizeChange"
  107. @current-change="handleCurrentChange"
  108. :current-page="currentPage"
  109. :page-size="pageSize"
  110. layout="total, sizes, prev, pager, next, jumper"
  111. :total="totalNum">
  112. </el-pagination>
  113. </div>
  114. </div>
  115. </div>
  116. </template>
  117. <script>
  118. const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config;
  119. export default {
  120. components: {
  121. },
  122. data() {
  123. return {
  124. currentPage:1,
  125. pageSize:10,
  126. totalNum:0,
  127. params:{page:0,pageSize:10},
  128. tableData: [],
  129. loading:false,
  130. tableData1:[{id:27,name:"Model-abcd",version:"0.0.3",version_count:'20',modelsize:"20MB",aiengine:'Mindspore',computesource:'NPU',createtime:'2020-1-2 12:06:01',creator:'zhoupz',hasChildren: true},
  131. {id:28,name:"Model-abcd",version:"0.0.3",version_count:'20',modelsize:"20MB",aiengine:'Mindspore',computesource:'NPU',createtime:'2020-1-2 12:06:01',creator:'zhoupz'},
  132. {id:29,name:"Model-abcd",version:"0.0.3",version_count:'20',modelsize:"20MB",aiengine:'Mindspore',computesource:'NPU',createtime:'2020-1-2 12:06:01',creator:'zhoupz'},
  133. {id:30,name:"Model-abcd",version:"0.0.3",version_count:'20',modelsize:"20MB",aiengine:'Mindspore',computesource:'NPU',createtime:'2020-1-2 12:06:01',creator:'zhoupz'}],
  134. currentPage1:1,
  135. pageSize1:10,
  136. totalNum1:0,
  137. params1:{page:1,size:10,name:''},
  138. loading1:false
  139. };
  140. },
  141. methods: {
  142. load(tree, treeNode, resolve) {
  143. setTimeout(() => {
  144. resolve([
  145. {id:27-1,name:"",version:"0.0.3",version_count:'20',modelsize:"20MB",aiengine:'Mindspore',computesource:'NPU',createtime:'2020-1-2 12:06:01',creator:'zhoupz'},
  146. {id:27-2,name:"",version:"0.0.3",version_count:'20',modelsize:"20MB",aiengine:'Mindspore',computesource:'NPU',createtime:'2020-1-2 12:06:01',creator:'zhoupz'},
  147. ])
  148. }, 1000)
  149. },
  150. tableHeaderStyle({row,column,rowIndex,columnIndex}){
  151. if(rowIndex===0){
  152. return 'background:#f5f5f6;color:#606266'
  153. }
  154. },
  155. handleSizeChange(val){
  156. this.params.size = val
  157. this.getImageList()
  158. },
  159. handleCurrentChange(val){
  160. console.log(val)
  161. this.params.page = val
  162. this.getImageList()
  163. },
  164. getModelList(){
  165. this.loading = true
  166. this.$axios.get(location.href+'_api',{
  167. params:this.params
  168. }).then((res)=>{
  169. console.log("---res----",res)
  170. this.totalNum = res.data.count
  171. this.tableData = res.data.rows
  172. this.loading = false
  173. })
  174. },
  175. },
  176. filters:{
  177. clearP(value){
  178. console.log("sorce value",value)
  179. if(!value) return ''
  180. const reg = /\<\/?p\>/g;
  181. value = value.replace(reg,'')
  182. console.log("repalace:",value)
  183. return value
  184. },
  185. transformTimestamp(timestamp){
  186. console.log("timestamp",timestamp)
  187. let a = new Date(timestamp).getTime();
  188. const date = new Date(a);
  189. const Y = date.getFullYear() + '-';
  190. const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
  191. const D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
  192. const h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
  193. const m = (date.getMinutes() <10 ? '0'+date.getMinutes() : date.getMinutes()) + ':' ;
  194. const s = (date.getSeconds() <10 ? '0'+date.getSeconds() : date.getSeconds()) ; // 秒
  195. const dateString = Y + M + D + h + m + s;
  196. // console.log('dateString', dateString); // > dateString 2021-07-06 14:23
  197. return dateString;
  198. },
  199. },
  200. mounted() {
  201. this.getModelList()
  202. }
  203. };
  204. </script>
  205. <style scoped>
  206. .header-wrapper {
  207. background-color: #f5f5f6;
  208. padding-top: 15px;
  209. }
  210. .image_text{
  211. padding:25px 0 55px 0 ;
  212. }
  213. #header{
  214. position: relative;
  215. top:-40px;
  216. }
  217. .el-dropdown-menu__item--divided{
  218. border-top: 1px solid blue;
  219. }
  220. .el-table thead{
  221. background-color: #f5f5f6;
  222. }
  223. /deep/ .el-tabs__item:hover{
  224. color: #000;
  225. font-weight: 500;
  226. }
  227. /deep/ .el-tabs__item.is-active {
  228. color: #000;
  229. font-weight: 500;
  230. }
  231. /deep/ .el-tabs__active-bar{
  232. background-color:#000
  233. }
  234. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
  235. background-color: #5bb973;
  236. color: #FFF;
  237. }
  238. /deep/ .el-pagination.is-background .el-pager li.active {
  239. color: #fff;
  240. cursor: default;
  241. }
  242. /deep/ .el-pagination.is-background .el-pager li:hover {
  243. color: #5bb973;
  244. }
  245. /deep/ .el-pagination.is-background .el-pager li:not(.disabled):hover {
  246. color: #5bb973;
  247. }
  248. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active:hover {
  249. background-color: #5bb973;
  250. color: #FFF;
  251. }
  252. /deep/ .el-pager li.active {
  253. color: #08C0B9;
  254. cursor: default;
  255. }
  256. /deep/ .el-pagination .el-pager li:hover {
  257. color: #08C0B9;
  258. }
  259. /deep/ .el-pagination .el-pager li:not(.disabled):hover {
  260. color: #08C0B9;
  261. }
  262. /* /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active{
  263. background-color: #5bb973;
  264. color: #000;
  265. } */
  266. /* /deep/ .el-pager li:hover{
  267. color: #000;
  268. } */
  269. #success{
  270. background-color: #5bb973;
  271. color: white;
  272. }
  273. .text-over{
  274. overflow: hidden;
  275. text-overflow: ellipsis;
  276. vertical-align: middle;
  277. white-space: nowrap;
  278. }
  279. </style>