index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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. import cloneDeep from 'lodash/cloneDeep'
  153. export default {
  154. name: 'SourceDialog',
  155. mixins: [pageMixins],
  156. props: {},
  157. data () {
  158. return {
  159. dialogVisible: false,
  160. loading: false,
  161. options: [],
  162. code: '',
  163. focus: -1,
  164. list: [],
  165. searchKey: ''
  166. }
  167. },
  168. computed: {
  169. gridComputed () {
  170. return this.list.length > 3
  171. }
  172. },
  173. mounted () { },
  174. methods: {
  175. jumpto () {
  176. const { href } = this.$router.resolve('/dataRoom-redirect?edit=source')
  177. window.open(href, '_blank')
  178. },
  179. chooseImg (img) {
  180. this.focus = cloneDeep(img)
  181. },
  182. close () { },
  183. init () {
  184. this.dialogVisible = true
  185. this.current = 1
  186. this.searchKey = ''
  187. this.code = ''
  188. this.focus = -1
  189. this.getDataList()
  190. this.getCatalogList()
  191. },
  192. confirm () {
  193. this.dialogVisible = false
  194. if (this.focus !== -1) {
  195. this.$emit('getImg', this.focus)
  196. }
  197. },
  198. getDataList () {
  199. this.loading = true
  200. this.$dataRoomAxios.get('/bigScreen/file', {
  201. module: this.code,
  202. current: this.current,
  203. size: this.size,
  204. extension: '',
  205. searchKey: this.searchKey
  206. })
  207. .then((data) => {
  208. this.list = data.list
  209. this.totalCount = data.totalCount
  210. })
  211. .finally(() => {
  212. this.loading = false
  213. })
  214. },
  215. // 获取目录的列表
  216. getCatalogList () {
  217. this.$dataRoomAxios.get('/bigScreen/type/list/resourceCatalog')
  218. .then((data) => {
  219. this.options = data
  220. })
  221. .catch(() => { })
  222. }
  223. }
  224. }
  225. </script>
  226. <style lang="scss" scoped>
  227. @import '../../assets/style/bsTheme.scss';
  228. ::v-deep .el-dialog__body{
  229. position: relative;
  230. min-height: 500px;
  231. padding: 0 16px 16px 16px !important;
  232. }
  233. .big-screen-list-wrap {
  234. .el-select {
  235. display: inline-block !important;
  236. position: relative !important;
  237. width: auto !important;
  238. }
  239. position: relative;
  240. height: 100%;
  241. // margin:0 16px;
  242. // padding: 16px;
  243. color: #9ea9b2;
  244. background-color: var(--bs-background-2) !important;
  245. .top-search-wrap {
  246. display: flex;
  247. align-items: center;
  248. justify-content: flex-end;
  249. position: sticky;
  250. top: 0px;
  251. z-index: 999;
  252. padding: 16px 0;
  253. background-color: var(--bs-background-2);
  254. .el-input {
  255. width: 200px;
  256. margin-right: 20px;
  257. ::v-deep.el-input__inner {
  258. background-color: var(--bs-background-1) !important;
  259. }
  260. }
  261. .el-select {
  262. margin-right: 20px;
  263. ::v-deep.el-input__inner {
  264. background: var(--bs-background-1) !important;
  265. background-color: var(--bs-background-1) !important;
  266. }
  267. }
  268. }
  269. .list-wrap {
  270. /* display: grid; */
  271. overflow: auto;
  272. // 间隙自适应
  273. justify-content: space-around;
  274. // max-height: calc(100vh - 270px);
  275. display: grid;
  276. grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  277. grid-gap: 15px;
  278. .big-screen-card-wrap {
  279. position: relative;
  280. height: 230px;
  281. cursor: pointer;
  282. &:hover {
  283. .screen-card__hover {
  284. height: 180px;
  285. }
  286. }
  287. .screen-card__hover {
  288. position: absolute;
  289. z-index: 999;
  290. top: 0;
  291. right: 0;
  292. left: 0;
  293. display: flex;
  294. overflow: hidden;
  295. align-items: center;
  296. justify-content: center;
  297. height: 0;
  298. transition: height 0.4s;
  299. background: #00000099;
  300. }
  301. .focus {
  302. color: var(--bs-el-text) !important;
  303. border: 1px solid var(--bs-el-color-primary) !important;
  304. }
  305. .big-screen-card-inner {
  306. overflow: hidden;
  307. width: 100%;
  308. height: 100%;
  309. cursor: pointer;
  310. background-color: var(--bs-background-2);
  311. box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  312. color: var(--bs-el-title);
  313. border: 1px solid var(--bs-background-2);
  314. &:hover {
  315. color: var(--bs-el-text);
  316. border: 1px solid var(--bs-el-color-primary);
  317. }
  318. .add-big-screen-card-text {
  319. color: var(--bs-el-color-primary);
  320. font-size: 24px;
  321. }
  322. .big-screen-card-img {
  323. width: 100%;
  324. height: 180px;
  325. img {
  326. width: 100%;
  327. height: 100%;
  328. object-fit: cover;
  329. }
  330. ::v-deep.image-slot {
  331. height: 100%;
  332. background-color: var(--bs-background-2);
  333. display: flex;
  334. align-items: center;
  335. justify-content: center;
  336. }
  337. ::v-deep.el-image__error {
  338. background-color: #1d1d1d;
  339. }
  340. }
  341. .big-screen-bottom {
  342. display: flex;
  343. align-items: center;
  344. flex-direction: row;
  345. justify-content: space-between;
  346. box-sizing: border-box;
  347. width: 100%;
  348. /*height: 26px;*/
  349. padding: 0 10px;
  350. height: calc(100% - 180px);
  351. color: var(--bs-el-title);
  352. background-color: var(--bs-background-2);
  353. .left-bigscreen-title {
  354. font-size: 14px;
  355. overflow: hidden;
  356. width: 100%;
  357. white-space: nowrap;
  358. text-overflow: ellipsis;
  359. }
  360. .right-bigscreen-time-title {
  361. font-size: 14px;
  362. overflow: hidden;
  363. width: 140px;
  364. white-space: nowrap;
  365. text-overflow: ellipsis;
  366. }
  367. }
  368. .big-screen-card-text {
  369. font-size: 14px;
  370. padding: 10px;
  371. text-align: center;
  372. color: #333;
  373. }
  374. }
  375. .big-screen-card-inner-add {
  376. display: flex;
  377. align-items: center;
  378. justify-content: center;
  379. }
  380. }
  381. }
  382. .el-loading-parent--relative {
  383. position: unset !important;
  384. }
  385. }
  386. .footer-pagination-wrap {
  387. bottom: 5px;
  388. right: 16px;
  389. width: 100%;
  390. margin-top: 16px;
  391. position: absolute;
  392. }
  393. .bs-pagination {
  394. ::v-deep .el-input__inner {
  395. width: 110px !important;
  396. border: none;
  397. background: var(--bs-el-background-1);
  398. }
  399. }
  400. .empty {
  401. width: 100%;
  402. height: 70%;
  403. min-height: 300px;
  404. display: flex;
  405. justify-content: center;
  406. align-items: center;
  407. }
  408. </style>