index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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
  15. v-if="remoteComponentlist.length !== 0"
  16. class="list-wrap bs-scrollbar"
  17. :style="{
  18. display: remoteComponentsGridComputed ? 'grid' : 'flex',
  19. justifyContent: remoteComponentsGridComputed ? 'space-around' : 'flex-start',
  20. height: 'calc(100vh - 430px)'
  21. }"
  22. >
  23. <div
  24. v-for="component in remoteComponentlist"
  25. :key="component.title"
  26. class="big-screen-card-wrap"
  27. :style="{
  28. width: remoteComponentsGridComputed ? 'auto' : '290px'
  29. }"
  30. @click="chooseComponent(component)"
  31. >
  32. <div
  33. :class="component.title == focus.title ? 'focus' : ''"
  34. class="big-screen-card-inner"
  35. >
  36. <div class="big-screen-card-img">
  37. <el-image
  38. :src="component.img"
  39. fit="contain"
  40. style="width: 100%; height: 100%"
  41. >
  42. <div
  43. slot="placeholder"
  44. class="image-slot"
  45. >
  46. 加载中···
  47. </div>
  48. </el-image>
  49. </div>
  50. <div class="big-screen-bottom">
  51. <div
  52. class="left-bigscreen-title"
  53. :title="component.title"
  54. >
  55. {{ component.title }}
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <div
  62. v-else
  63. class="empty"
  64. >
  65. 暂无数据
  66. </div>
  67. </div>
  68. </div>
  69. <div
  70. slot="footer"
  71. class="dialog-footer"
  72. >
  73. <el-button
  74. class="bs-el-button-default"
  75. @click="dialogVisible = false"
  76. >
  77. 取消
  78. </el-button>
  79. <el-button
  80. type="primary"
  81. @click="confirm"
  82. >
  83. 确定
  84. </el-button>
  85. </div>
  86. </el-dialog>
  87. </template>
  88. <script>
  89. import { pageMixins } from 'data-room-ui/js/mixins/page'
  90. import isEmpty from 'lodash/isEmpty'
  91. import cloneDeep from 'lodash/cloneDeep'
  92. import borderComponents from 'data-room-ui/BorderComponents/bordersList'
  93. export default {
  94. name: 'ComponentDialog',
  95. mixins: [pageMixins],
  96. model: {
  97. prop: 'type',
  98. event: 'select'
  99. },
  100. props: {
  101. type: {
  102. type: String,
  103. default: ''
  104. },
  105. disable: {
  106. type: Boolean,
  107. default: false
  108. }
  109. },
  110. data () {
  111. return {
  112. dialogVisible: false,
  113. loading: false,
  114. code: '',
  115. focus: -1,
  116. searchKey: '',
  117. remoteComponentlist: []
  118. }
  119. },
  120. computed: {
  121. remoteComponentsGridComputed () {
  122. return this.remoteComponentlist.length > 3
  123. }
  124. },
  125. watch: {
  126. },
  127. mounted () {
  128. this.remoteComponentlist = [...borderComponents]
  129. },
  130. methods: {
  131. chooseComponent (component) {
  132. this.focus = cloneDeep(component)
  133. },
  134. close () { },
  135. init () {
  136. this.dialogVisible = true
  137. this.current = 1
  138. this.searchKey = ''
  139. this.code = ''
  140. this.focus = -1
  141. },
  142. // 点击确定
  143. confirm () {
  144. this.dialogVisible = false
  145. if (isEmpty(this.focus)) return
  146. this.$emit('select', this.focus.title)
  147. }
  148. }
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. @import '../assets/style/bsTheme.scss';
  153. .content{
  154. height: calc(100vh - 290px);
  155. }
  156. .big-screen-list-wrap {
  157. .el-select {
  158. display: inline-block !important;
  159. position: relative !important;
  160. width: auto !important;
  161. }
  162. position: relative;
  163. height: 100%;
  164. // margin:0 16px;
  165. // padding: 16px;
  166. margin-bottom: 56px;
  167. color: #9ea9b2;
  168. background-color: var(--bs-background-2) !important;
  169. .top-search-wrap {
  170. display: flex;
  171. align-items: center;
  172. justify-content: flex-end;
  173. margin-bottom: 12px;
  174. .el-input {
  175. width: 200px;
  176. margin-right: 20px;
  177. ::v-deep.el-input__inner {
  178. background-color: var(--bs-background-1) !important;
  179. }
  180. }
  181. .el-select {
  182. margin-right: 20px;
  183. ::v-deep.el-input__inner {
  184. background-color: var(--bs-background-1) !important;
  185. }
  186. }
  187. }
  188. .list-wrap {
  189. /* display: grid; */
  190. overflow: auto;
  191. // 间隙自适应
  192. justify-content: space-around;
  193. // max-height: calc(100vh - 270px);
  194. display: grid;
  195. grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  196. grid-gap: 15px;
  197. .big-screen-card-wrap {
  198. position: relative;
  199. height: 230px;
  200. cursor: pointer;
  201. &:hover {
  202. .screen-card__hover {
  203. height: 180px;
  204. }
  205. }
  206. .screen-card__hover {
  207. position: absolute;
  208. z-index: 999;
  209. top: 0;
  210. right: 0;
  211. left: 0;
  212. display: flex;
  213. overflow: hidden;
  214. align-items: center;
  215. justify-content: center;
  216. height: 0;
  217. transition: height 0.4s;
  218. background: #00000099;
  219. }
  220. .focus {
  221. color: var(--bs-el-text) !important;
  222. border: 1px solid var(--bs-el-color-primary) !important;
  223. }
  224. .big-screen-card-inner {
  225. overflow: hidden;
  226. width: 100%;
  227. height: 100%;
  228. cursor: pointer;
  229. background-color: var(--bs-background-2);
  230. box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  231. color: var(--bs-el-title);
  232. border: 1px solid var(--bs-background-1);
  233. &:hover {
  234. color: var(--bs-el-text);
  235. border: 1px solid var(--bs-el-color-primary);
  236. }
  237. .add-big-screen-card-text {
  238. color: var(--bs-el-color-primary);
  239. font-size: 24px;
  240. }
  241. .big-screen-card-img {
  242. width: 100%;
  243. height: 180px;
  244. img {
  245. width: 100%;
  246. height: 100%;
  247. object-fit: cover;
  248. }
  249. ::v-deep.image-slot {
  250. height: 100%;
  251. background-color: var(--bs-background-2);
  252. display: flex;
  253. align-items: center;
  254. justify-content: center;
  255. }
  256. ::v-deep.el-image__error {
  257. background-color: #1d1d1d;
  258. }
  259. }
  260. .big-screen-bottom {
  261. display: flex;
  262. align-items: center;
  263. flex-direction: row;
  264. justify-content: space-between;
  265. box-sizing: border-box;
  266. width: 100%;
  267. /*height: 26px;*/
  268. padding: 0 10px;
  269. height: calc(100% - 180px);
  270. color: var(--bs-el-title);
  271. background-color: var(--bs-background-2);
  272. .left-bigscreen-title {
  273. font-size: 14px;
  274. overflow: hidden;
  275. width: 120px;
  276. white-space: nowrap;
  277. text-overflow: ellipsis;
  278. }
  279. .right-bigscreen-time-title {
  280. font-size: 14px;
  281. overflow: hidden;
  282. width: 140px;
  283. white-space: nowrap;
  284. text-overflow: ellipsis;
  285. }
  286. }
  287. .big-screen-card-text {
  288. font-size: 14px;
  289. padding: 10px;
  290. text-align: center;
  291. color: #333;
  292. }
  293. }
  294. .big-screen-card-inner-add {
  295. display: flex;
  296. align-items: center;
  297. justify-content: center;
  298. }
  299. }
  300. }
  301. .el-loading-parent--relative {
  302. position: unset !important;
  303. }
  304. .footer-pagination-wrap {
  305. margin-top: 16px;
  306. position: absolute;
  307. width: 100%;
  308. }
  309. }
  310. .bs-pagination {
  311. ::v-deep .el-input__inner {
  312. width: 110px !important;
  313. border: none;
  314. background: var(--bs-el-background-1);
  315. }
  316. }
  317. .empty {
  318. width: 100%;
  319. height: 70%;
  320. min-height: 300px;
  321. display: flex;
  322. justify-content: center;
  323. align-items: center;
  324. }
  325. ::v-deep .el-tabs__item {
  326. color: var(--bs-el-text);
  327. }
  328. .error-img-text {
  329. overflow: hidden;
  330. padding: 0 10px;
  331. white-space: nowrap;
  332. text-overflow: ellipsis;
  333. -o-text-overflow: ellipsis;
  334. }
  335. ::v-deep .el-tabs__nav-wrap {
  336. &:after {
  337. display: none;
  338. }
  339. }
  340. .empty{
  341. height: calc(100vh - 430px);
  342. }
  343. </style>