index.vue 8.1 KB

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