index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. <template>
  2. <el-dialog
  3. title="资源库"
  4. :visible.sync="dialogVisible"
  5. width="80%"
  6. :modal="true"
  7. :modal-append-to-body="false"
  8. :appen-to-body="true"
  9. class="bs-dialog-wrap bs-el-dialog"
  10. @closed="close"
  11. >
  12. <div class="content">
  13. <div class="big-screen-list-wrap">
  14. <div class="top-search-wrap">
  15. <el-input
  16. v-model="searchKey"
  17. class="bs-el-input"
  18. placeholder="请输入图片名称"
  19. prefix-icon="el-icon-search"
  20. clearable
  21. @clear="reSearch"
  22. @keyup.enter.native="reSearch"
  23. />
  24. <el-select
  25. v-model="code"
  26. class="bs-el-select"
  27. popper-class="bs-el-select"
  28. placeholder="请选择类型"
  29. clearable
  30. @change="reSearch"
  31. >
  32. <el-option
  33. v-for="item in options"
  34. :key="item.id"
  35. :label="item.name"
  36. :value="item.code"
  37. />
  38. </el-select>
  39. <el-button
  40. size="small"
  41. type="primary"
  42. @click="reSearch"
  43. >
  44. 搜索
  45. </el-button>
  46. </div>
  47. <div
  48. v-if="list.length !== 0"
  49. v-loading="loading"
  50. class="list-wrap bs-scrollbar"
  51. element-loading-text="加载中"
  52. :style="{
  53. display: gridComputed ? 'grid' : 'flex',
  54. justifyContent: gridComputed ? 'space-around' : 'flex-start',
  55. height: 'calc(100vh - 400px)',
  56. marginBottom: '38px'
  57. }"
  58. >
  59. <!-- <div v-if="list.length !== 0"> -->
  60. <div
  61. v-for="screen in list"
  62. :key="screen.id"
  63. class="big-screen-card-wrap"
  64. :style="{
  65. width: gridComputed ? 'auto' : '290px'
  66. }"
  67. @click="chooseImg(screen)"
  68. >
  69. <div
  70. :class="focus.id == screen.id ? 'focus' : ''"
  71. class="big-screen-card-inner"
  72. >
  73. <div class="big-screen-card-img">
  74. <el-image
  75. :src="screen.url"
  76. fit="contain"
  77. style="width: 100%; height: 100%"
  78. >
  79. <div
  80. slot="placeholder"
  81. class="image-slot"
  82. >
  83. 加载中···
  84. </div>
  85. </el-image>
  86. </div>
  87. <div class="big-screen-bottom">
  88. <div
  89. class="left-bigscreen-title"
  90. :title="screen.originalName"
  91. >
  92. {{ screen.originalName }}
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. <div
  99. v-else
  100. class="empty"
  101. >
  102. 暂无数据
  103. </div>
  104. </div>
  105. <div class="footer-pagination-wrap">
  106. <div class="bs-pagination">
  107. <el-pagination
  108. class="bs-el-pagination"
  109. popper-class="bs-el-pagination"
  110. background
  111. layout="total, prev, pager, next, sizes"
  112. :page-size="size"
  113. prev-text="上一页"
  114. next-text="下一页"
  115. :total="totalCount"
  116. :page-sizes="[10, 20, 50, 100]"
  117. :current-page="current"
  118. @current-change="currentChangeHandle"
  119. @size-change="sizeChangeHandle"
  120. />
  121. </div>
  122. </div>
  123. </div>
  124. <div
  125. slot="footer"
  126. class="dialog-footer"
  127. >
  128. <el-button
  129. class="bs-el-button-default"
  130. @click="dialogVisible = false"
  131. >
  132. 取消
  133. </el-button>
  134. <el-button
  135. type="primary"
  136. @click="confirm"
  137. >
  138. 确定
  139. </el-button>
  140. <el-button
  141. type="primary"
  142. @click="jumpto"
  143. >
  144. 资源管理
  145. </el-button>
  146. </div>
  147. </el-dialog>
  148. </template>
  149. <script>
  150. import { pageMixins } from 'data-room-ui/js/mixins/page'
  151. import _ from 'lodash'
  152. export default {
  153. name: 'SourceDialog',
  154. mixins: [pageMixins],
  155. props: {},
  156. data () {
  157. return {
  158. dialogVisible: false,
  159. loading: false,
  160. options: [],
  161. code: '',
  162. focus: -1,
  163. list: [],
  164. searchKey: ''
  165. }
  166. },
  167. computed: {
  168. gridComputed () {
  169. return this.list.length > 3
  170. }
  171. },
  172. mounted () { },
  173. methods: {
  174. jumpto () {
  175. const { href } = this.$router.resolve('/dataRoom-redirect?edit=source')
  176. window.open(href, '_blank')
  177. },
  178. chooseImg (img) {
  179. this.focus = _.cloneDeep(img)
  180. },
  181. close () { },
  182. init () {
  183. this.dialogVisible = true
  184. this.current = 1
  185. this.searchKey = ''
  186. this.code = ''
  187. this.focus = -1
  188. this.getDataList()
  189. this.getCatalogList()
  190. },
  191. confirm () {
  192. this.dialogVisible = false
  193. if (this.focus !== -1) {
  194. this.$emit('getImg', this.focus)
  195. }
  196. },
  197. getDataList () {
  198. this.loading = true
  199. this.$dataRoomAxios.get('/bigScreen/file', {
  200. module: this.code,
  201. current: this.current,
  202. size: this.size,
  203. extension: '',
  204. searchKey: this.searchKey
  205. })
  206. .then((data) => {
  207. this.list = data.list
  208. this.totalCount = data.totalCount
  209. })
  210. .finally(() => {
  211. this.loading = false
  212. })
  213. },
  214. // 获取目录的列表
  215. getCatalogList () {
  216. this.$dataRoomAxios.get('/bigScreen/type/list/resourceCatalog')
  217. .then((data) => {
  218. this.options = data
  219. })
  220. .catch(() => { })
  221. }
  222. }
  223. }
  224. </script>
  225. <style lang="scss" scoped>
  226. @import '../../assets/style/bsTheme.scss';
  227. ::v-deep .el-dialog__body{
  228. position: relative;
  229. min-height: 500px;
  230. padding: 0 16px 16px 16px !important;
  231. }
  232. .big-screen-list-wrap {
  233. .el-select {
  234. display: inline-block !important;
  235. position: relative !important;
  236. width: auto !important;
  237. }
  238. position: relative;
  239. height: 100%;
  240. // margin:0 16px;
  241. // padding: 16px;
  242. color: #9ea9b2;
  243. background-color: var(--bs-background-2) !important;
  244. .top-search-wrap {
  245. display: flex;
  246. align-items: center;
  247. justify-content: flex-end;
  248. position: sticky;
  249. top: 0px;
  250. z-index: 999;
  251. padding: 16px 0;
  252. background-color: var(--bs-background-2);
  253. .el-input {
  254. width: 200px;
  255. margin-right: 20px;
  256. ::v-deep.el-input__inner {
  257. background-color: var(--bs-background-1) !important;
  258. }
  259. }
  260. .el-select {
  261. margin-right: 20px;
  262. ::v-deep.el-input__inner {
  263. background: var(--bs-background-1) !important;
  264. background-color: var(--bs-background-1) !important;
  265. }
  266. }
  267. }
  268. .list-wrap {
  269. /* display: grid; */
  270. overflow: auto;
  271. // 间隙自适应
  272. justify-content: space-around;
  273. // max-height: calc(100vh - 270px);
  274. display: grid;
  275. grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  276. grid-gap: 15px;
  277. .big-screen-card-wrap {
  278. position: relative;
  279. height: 230px;
  280. cursor: pointer;
  281. &:hover {
  282. .screen-card__hover {
  283. height: 180px;
  284. }
  285. }
  286. .screen-card__hover {
  287. position: absolute;
  288. z-index: 999;
  289. top: 0;
  290. right: 0;
  291. left: 0;
  292. display: flex;
  293. overflow: hidden;
  294. align-items: center;
  295. justify-content: center;
  296. height: 0;
  297. transition: height 0.4s;
  298. background: #00000099;
  299. }
  300. .focus {
  301. color: var(--bs-el-text) !important;
  302. border: 1px solid var(--bs-el-color-primary) !important;
  303. }
  304. .big-screen-card-inner {
  305. overflow: hidden;
  306. width: 100%;
  307. height: 100%;
  308. cursor: pointer;
  309. background-color: var(--bs-background-2);
  310. box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  311. color: var(--bs-el-title);
  312. border: 1px solid var(--bs-background-2);
  313. &:hover {
  314. color: var(--bs-el-text);
  315. border: 1px solid var(--bs-el-color-primary);
  316. }
  317. .add-big-screen-card-text {
  318. color: var(--bs-el-color-primary);
  319. font-size: 24px;
  320. }
  321. .big-screen-card-img {
  322. width: 100%;
  323. height: 180px;
  324. img {
  325. width: 100%;
  326. height: 100%;
  327. object-fit: cover;
  328. }
  329. ::v-deep.image-slot {
  330. height: 100%;
  331. background-color: var(--bs-background-2);
  332. display: flex;
  333. align-items: center;
  334. justify-content: center;
  335. }
  336. ::v-deep.el-image__error {
  337. background-color: #1d1d1d;
  338. }
  339. }
  340. .big-screen-bottom {
  341. display: flex;
  342. align-items: center;
  343. flex-direction: row;
  344. justify-content: space-between;
  345. box-sizing: border-box;
  346. width: 100%;
  347. /*height: 26px;*/
  348. padding: 0 10px;
  349. height: calc(100% - 180px);
  350. color: var(--bs-el-title);
  351. background-color: var(--bs-background-2);
  352. .left-bigscreen-title {
  353. font-size: 14px;
  354. overflow: hidden;
  355. width: 100%;
  356. white-space: nowrap;
  357. text-overflow: ellipsis;
  358. }
  359. .right-bigscreen-time-title {
  360. font-size: 14px;
  361. overflow: hidden;
  362. width: 140px;
  363. white-space: nowrap;
  364. text-overflow: ellipsis;
  365. }
  366. }
  367. .big-screen-card-text {
  368. font-size: 14px;
  369. padding: 10px;
  370. text-align: center;
  371. color: #333;
  372. }
  373. }
  374. .big-screen-card-inner-add {
  375. display: flex;
  376. align-items: center;
  377. justify-content: center;
  378. }
  379. }
  380. }
  381. .el-loading-parent--relative {
  382. position: unset !important;
  383. }
  384. }
  385. .footer-pagination-wrap {
  386. bottom: 5px;
  387. right: 16px;
  388. width: 100%;
  389. margin-top: 16px;
  390. position: absolute;
  391. }
  392. .bs-pagination {
  393. ::v-deep .el-input__inner {
  394. width: 110px !important;
  395. border: none;
  396. background: var(--bs-el-background-1);
  397. }
  398. }
  399. .empty {
  400. width: 100%;
  401. height: 70%;
  402. min-height: 300px;
  403. display: flex;
  404. justify-content: center;
  405. align-items: center;
  406. }
  407. </style>