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.

Images.vue 16 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <div>
  3. <div class="header-wrapper">
  4. <div class="ui container">
  5. <el-row class="image_text">
  6. <h1>云脑镜像</h1>
  7. </el-row>
  8. </div>
  9. </div>
  10. <div class="ui container" id="header">
  11. <el-tabs v-model="activeName" @tab-click="handleClick">
  12. <el-tab-pane label="公共镜像(云脑1)" name="first" v-loading="loading">
  13. <div class="ui sixteen wide column">
  14. <div class="ui two column stackable grid">
  15. <div class="column">
  16. <el-input placeholder="请输入内容" v-model="search" class="input-with-select">
  17. <el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
  18. </el-input>
  19. </div>
  20. <!-- <div class="column right aligned">
  21. <el-dropdown>
  22. <span class="el-dropdown-link">
  23. 排序<i class="el-icon-caret-bottom"></i>
  24. </span>
  25. <el-dropdown-menu slot="dropdown">
  26. <el-dropdown-item>最早创建</el-dropdown-item>
  27. <el-dropdown-item>最新创建</el-dropdown-item>
  28. <el-dropdown-item divided>按镜像字母顺序排序</el-dropdown-item>
  29. <el-dropdown-item>按镜像字母逆序排序</el-dropdown-item>
  30. </el-dropdown-menu>
  31. </el-dropdown>
  32. </div> -->
  33. </div>
  34. </div>
  35. <el-row style="margin-top:15px;">
  36. <el-table
  37. :data="tableData"
  38. style="width: 100%"
  39. :header-cell-style="tableHeaderStyle"
  40. :default-sort="{prop:'createtime',order:'descending'}">
  41. <el-table-column
  42. label="镜像名称"
  43. width="350"
  44. align="center"
  45. prop="name"
  46. sortable
  47. >
  48. <template slot-scope="scope">
  49. <a class="text-over" style="cursor:default;color:#426290" :title="scope.row.name">{{ scope.row.name }}</a>
  50. </template>
  51. </el-table-column>
  52. <el-table-column
  53. label="文件路径/镜像描述"
  54. width="450"
  55. align="center"
  56. >
  57. <template slot-scope="scope">
  58. <el-tooltip class="item" effect="dark" content="点击复制文件路径" placement="top">
  59. <a class="text-over" style="display:block;" @click="copyUrl(scope.row.place)">{{ scope.row.place }}</a>
  60. </el-tooltip>
  61. <span class="text-over" :title="scope.row.description">{{ scope.row.description }}</span>
  62. </template>
  63. </el-table-column>
  64. <el-table-column
  65. prop="provider"
  66. label="提供者"
  67. width="120"
  68. align="center"
  69. sortable>
  70. </el-table-column>
  71. <el-table-column
  72. prop="createtime"
  73. label="创建时间"
  74. align="center"
  75. sortable>
  76. </el-table-column>
  77. </el-table>
  78. </el-row>
  79. <div class="ui container" style="margin-top:50px;text-align:center">
  80. <el-pagination
  81. background
  82. @size-change="handleSizeChange"
  83. @current-change="handleCurrentChange"
  84. :current-page="currentPage"
  85. :page-size="pageSize"
  86. :page-sizes="[5,10,20]"
  87. layout="total, sizes, prev, pager, next, jumper"
  88. :total="totalNum">
  89. </el-pagination>
  90. </div>
  91. </el-tab-pane>
  92. <el-tab-pane label="自定义镜像(云脑1)" name="second" v-loading="loading1">
  93. <div class="ui sixteen wide column">
  94. <div class="ui two column stackable grid">
  95. <div class="column">
  96. <el-input placeholder="请输入内容" v-model="search" class="input-with-select">
  97. <el-button slot="append" id="success" icon="el-icon-search" @click="searchName()">搜索</el-button>
  98. </el-input>
  99. </div>
  100. <!-- <div class="column right aligned">
  101. <el-dropdown>
  102. <span class="el-dropdown-link">
  103. 排序<i class="el-icon-caret-bottom"></i>
  104. </span>
  105. <el-dropdown-menu slot="dropdown">
  106. <el-dropdown-item>最早创建</el-dropdown-item>
  107. <el-dropdown-item>最新创建</el-dropdown-item>
  108. <el-dropdown-item divided>按镜像字母顺序排序</el-dropdown-item>
  109. <el-dropdown-item>按镜像字母逆序排序</el-dropdown-item>
  110. </el-dropdown-menu>
  111. </el-dropdown>
  112. </div> -->
  113. </div>
  114. </div>
  115. <el-row style="margin-top:15px;">
  116. <el-table
  117. :data="tableData1"
  118. style="width: 100%"
  119. :header-cell-style="tableHeaderStyle"
  120. :default-sort="{prop:'createtime',order:'descending'}">
  121. <el-table-column
  122. label="镜像名称"
  123. width="350"
  124. align="center"
  125. prop="name"
  126. sortable
  127. >
  128. <template slot-scope="scope">
  129. <a class="text-over" :title="scope.row.name" style="cursor:default;color:#426290">{{ scope.row.name }}</a>
  130. </template>
  131. </el-table-column>
  132. <el-table-column
  133. label="文件路径/镜像描述"
  134. width="450"
  135. align="center"
  136. >
  137. <template slot-scope="scope">
  138. <el-tooltip class="item" effect="dark" content="点击复制文件路径" placement="top">
  139. <a class="text-over" style="display:block;" @click="copyUrl(scope.row.place)">{{ scope.row.place }}</a>
  140. </el-tooltip>
  141. <span class="text-over" :title="scope.row.description">{{ scope.row.description }}</span>
  142. </template>
  143. </el-table-column>
  144. <el-table-column
  145. prop="provider"
  146. label="提供者"
  147. width="120"
  148. align="center"
  149. sortable>
  150. </el-table-column>
  151. <el-table-column
  152. prop="createtime"
  153. label="创建时间"
  154. align="center"
  155. sortable>
  156. </el-table-column>
  157. </el-table>
  158. </el-row>
  159. <div class="ui container" style="margin-top:50px;text-align:center">
  160. <el-pagination
  161. background
  162. @size-change="handleSizeChange1"
  163. @current-change="handleCurrentChange1"
  164. :current-page="currentPage1"
  165. :page-size="pageSize1"
  166. :page-sizes="[5,10,20]"
  167. layout="total, sizes, prev, pager, next, jumper"
  168. :total="totalNum1">
  169. </el-pagination>
  170. </div>
  171. </el-tab-pane>
  172. <el-tab-pane label="公共镜像(云脑2)" name="third">
  173. <div class="ui sixteen wide column">
  174. <div class="ui two column stackable grid">
  175. <div class="column">
  176. <el-input placeholder="请输入内容" v-model="search" class="input-with-select">
  177. <el-button slot="append" id="success" icon="el-icon-search">搜索</el-button>
  178. </el-input>
  179. </div>
  180. <!-- <div class="column right aligned">
  181. <el-dropdown>
  182. <span class="el-dropdown-link">
  183. 排序<i class="el-icon-caret-bottom"></i>
  184. </span>
  185. <el-dropdown-menu slot="dropdown">
  186. <el-dropdown-item>最早创建</el-dropdown-item>
  187. <el-dropdown-item>最新创建</el-dropdown-item>
  188. <el-dropdown-item divided>按镜像字母顺序排序</el-dropdown-item>
  189. <el-dropdown-item>按镜像字母逆序排序</el-dropdown-item>
  190. </el-dropdown-menu>
  191. </el-dropdown>
  192. </div> -->
  193. </div>
  194. </div>
  195. <el-empty :image-size="200"></el-empty>
  196. </el-tab-pane>
  197. <el-tab-pane label="自定义镜像(云脑2)" name="fourth">
  198. <div class="ui sixteen wide column">
  199. <div class="ui two column stackable grid">
  200. <div class="column">
  201. <el-input placeholder="请输入内容" v-model="search" class="input-with-select">
  202. <el-button slot="append" id="success" icon="el-icon-search">搜索</el-button>
  203. </el-input>
  204. </div>
  205. <!-- <div class="column right aligned">
  206. <el-dropdown>
  207. <span class="el-dropdown-link">
  208. 排序<i class="el-icon-caret-bottom"></i>
  209. </span>
  210. <el-dropdown-menu slot="dropdown">
  211. <el-dropdown-item>最早创建</el-dropdown-item>
  212. <el-dropdown-item>最新创建</el-dropdown-item>
  213. <el-dropdown-item divided>按镜像字母顺序排序</el-dropdown-item>
  214. <el-dropdown-item>按镜像字母逆序排序</el-dropdown-item>
  215. </el-dropdown-menu>
  216. </el-dropdown>
  217. </div> -->
  218. </div>
  219. </div>
  220. <el-empty :image-size="200"></el-empty>
  221. </el-tab-pane>
  222. </el-tabs>
  223. </div>
  224. </div>
  225. </template>
  226. <script>
  227. const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config;
  228. export default {
  229. components: {
  230. },
  231. data() {
  232. return {
  233. activeName: 'first',
  234. search:'',
  235. currentPage:1,
  236. pageSize:10,
  237. totalNum:0,
  238. params:{page:1,size:10,name:''},
  239. tableData: [],
  240. loading:false,
  241. currentPage1:1,
  242. pageSize1:10,
  243. totalNum1:0,
  244. params1:{page:1,size:10,name:''},
  245. tableData1: [],
  246. loading1:false
  247. };
  248. },
  249. methods: {
  250. handleClick(tab, event) {
  251. if(tab.name=="first"){
  252. this.getImageList()
  253. }
  254. if(tab.name=="second"){
  255. this.getImageList1()
  256. }
  257. },
  258. tableHeaderStyle({row,column,rowIndex,columnIndex}){
  259. if(rowIndex===0){
  260. return 'background:#f5f5f6;color:#606266'
  261. }
  262. },
  263. handleSizeChange(val){
  264. this.params.size = val
  265. this.getImageList()
  266. },
  267. handleCurrentChange(val){
  268. console.log(val)
  269. this.params.page = val
  270. this.getImageList()
  271. },
  272. handleSizeChange1(val){
  273. this.params1.size = val
  274. this.getImageList1()
  275. },
  276. handleCurrentChange1(){
  277. this.params1.page = val
  278. this.getImageList1()
  279. },
  280. getImageList(){
  281. this.loading = true
  282. this.$axios.get('/explore/images/public',{
  283. params:this.params
  284. }).then((res)=>{
  285. this.totalNum = res.data.count
  286. this.tableData = res.data.rows
  287. this.loading = false
  288. })
  289. },
  290. getImageList1(){
  291. this.loading1 = true
  292. this.$axios.get('/explore/images/custom',{
  293. params:this.params1
  294. }).then((res)=>{
  295. this.totalNum1 = res.data.count
  296. this.tableData1 = res.data.rows
  297. this.loading1 = false
  298. })
  299. },
  300. copyUrl(url){
  301. console.log(url)
  302. const cInput = document.createElement('input')
  303. cInput.value = url
  304. document.body.appendChild(cInput)
  305. cInput.select()
  306. document.execCommand('Copy')
  307. cInput.remove()
  308. },
  309. searchName(){
  310. if(this.activeName=='first'){
  311. this.params.name = this.search
  312. this.getImageList()
  313. }
  314. if(this.activeName=='second'){
  315. this.params1.name = this.search
  316. this.getImageList1()
  317. }
  318. }
  319. },
  320. watch:{
  321. search(val){
  322. if(!val && this.activeName=='first'){
  323. this.params.name = val
  324. this.getImageList()
  325. }
  326. if(!val && this.activeName=='second'){
  327. this.params1.name = val
  328. this.getImageList1()
  329. }
  330. }
  331. },
  332. mounted() {
  333. this.getImageList()
  334. },
  335. created() {
  336. }
  337. };
  338. </script>
  339. <style scoped>
  340. .header-wrapper {
  341. background-color: #f5f5f6;
  342. padding-top: 15px;
  343. }
  344. .image_text{
  345. padding:25px 0 55px 0 ;
  346. }
  347. #header{
  348. position: relative;
  349. top:-40px;
  350. }
  351. .el-dropdown-menu__item--divided{
  352. border-top: 1px solid blue;
  353. }
  354. .el-table thead{
  355. background-color: #f5f5f6;
  356. }
  357. #success{
  358. background-color: #4093ff;
  359. color: white;
  360. }
  361. .text-over{
  362. overflow: hidden;
  363. text-overflow: ellipsis;
  364. vertical-align: middle;
  365. white-space: nowrap;
  366. }
  367. </style>