index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  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. console.log(this.remoteComponentlist)
  130. },
  131. methods: {
  132. chooseComponent (component) {
  133. this.focus = cloneDeep(component)
  134. },
  135. close () { },
  136. init () {
  137. this.dialogVisible = true
  138. this.current = 1
  139. this.searchKey = ''
  140. this.code = ''
  141. this.focus = -1
  142. },
  143. // 点击确定
  144. confirm () {
  145. this.dialogVisible = false
  146. if (isEmpty(this.focus)) return
  147. console.log(this.focus.title)
  148. this.$emit('select', this.focus.title)
  149. },
  150. }
  151. }
  152. </script>
  153. <style lang="scss" scoped>
  154. @import '../assets/style/bsTheme.scss';
  155. .content{
  156. height: calc(100vh - 290px);
  157. }
  158. .big-screen-list-wrap {
  159. .el-select {
  160. display: inline-block !important;
  161. position: relative !important;
  162. width: auto !important;
  163. }
  164. position: relative;
  165. height: 100%;
  166. // margin:0 16px;
  167. // padding: 16px;
  168. margin-bottom: 56px;
  169. color: #9ea9b2;
  170. background-color: var(--bs-background-2) !important;
  171. .top-search-wrap {
  172. display: flex;
  173. align-items: center;
  174. justify-content: flex-end;
  175. margin-bottom: 12px;
  176. .el-input {
  177. width: 200px;
  178. margin-right: 20px;
  179. ::v-deep.el-input__inner {
  180. background-color: var(--bs-background-1) !important;
  181. }
  182. }
  183. .el-select {
  184. margin-right: 20px;
  185. ::v-deep.el-input__inner {
  186. background-color: var(--bs-background-1) !important;
  187. }
  188. }
  189. }
  190. .list-wrap {
  191. /* display: grid; */
  192. overflow: auto;
  193. // 间隙自适应
  194. justify-content: space-around;
  195. // max-height: calc(100vh - 270px);
  196. display: grid;
  197. grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  198. grid-gap: 15px;
  199. .big-screen-card-wrap {
  200. position: relative;
  201. height: 230px;
  202. cursor: pointer;
  203. &:hover {
  204. .screen-card__hover {
  205. height: 180px;
  206. }
  207. }
  208. .screen-card__hover {
  209. position: absolute;
  210. z-index: 999;
  211. top: 0;
  212. right: 0;
  213. left: 0;
  214. display: flex;
  215. overflow: hidden;
  216. align-items: center;
  217. justify-content: center;
  218. height: 0;
  219. transition: height 0.4s;
  220. background: #00000099;
  221. }
  222. .focus {
  223. color: var(--bs-el-text) !important;
  224. border: 1px solid var(--bs-el-color-primary) !important;
  225. }
  226. .big-screen-card-inner {
  227. overflow: hidden;
  228. width: 100%;
  229. height: 100%;
  230. cursor: pointer;
  231. background-color: var(--bs-background-2);
  232. box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  233. color: var(--bs-el-title);
  234. border: 1px solid var(--bs-background-1);
  235. &:hover {
  236. color: var(--bs-el-text);
  237. border: 1px solid var(--bs-el-color-primary);
  238. }
  239. .add-big-screen-card-text {
  240. color: var(--bs-el-color-primary);
  241. font-size: 24px;
  242. }
  243. .big-screen-card-img {
  244. width: 100%;
  245. height: 180px;
  246. img {
  247. width: 100%;
  248. height: 100%;
  249. object-fit: cover;
  250. }
  251. ::v-deep.image-slot {
  252. height: 100%;
  253. background-color: var(--bs-background-2);
  254. display: flex;
  255. align-items: center;
  256. justify-content: center;
  257. }
  258. ::v-deep.el-image__error {
  259. background-color: #1d1d1d;
  260. }
  261. }
  262. .big-screen-bottom {
  263. display: flex;
  264. align-items: center;
  265. flex-direction: row;
  266. justify-content: space-between;
  267. box-sizing: border-box;
  268. width: 100%;
  269. /*height: 26px;*/
  270. padding: 0 10px;
  271. height: calc(100% - 180px);
  272. color: var(--bs-el-title);
  273. background-color: var(--bs-background-2);
  274. .left-bigscreen-title {
  275. font-size: 14px;
  276. overflow: hidden;
  277. width: 120px;
  278. white-space: nowrap;
  279. text-overflow: ellipsis;
  280. }
  281. .right-bigscreen-time-title {
  282. font-size: 14px;
  283. overflow: hidden;
  284. width: 140px;
  285. white-space: nowrap;
  286. text-overflow: ellipsis;
  287. }
  288. }
  289. .big-screen-card-text {
  290. font-size: 14px;
  291. padding: 10px;
  292. text-align: center;
  293. color: #333;
  294. }
  295. }
  296. .big-screen-card-inner-add {
  297. display: flex;
  298. align-items: center;
  299. justify-content: center;
  300. }
  301. }
  302. }
  303. .el-loading-parent--relative {
  304. position: unset !important;
  305. }
  306. .footer-pagination-wrap {
  307. margin-top: 16px;
  308. position: absolute;
  309. width: 100%;
  310. }
  311. }
  312. .bs-pagination {
  313. ::v-deep .el-input__inner {
  314. width: 110px !important;
  315. border: none;
  316. background: var(--bs-el-background-1);
  317. }
  318. }
  319. .empty {
  320. width: 100%;
  321. height: 70%;
  322. min-height: 300px;
  323. display: flex;
  324. justify-content: center;
  325. align-items: center;
  326. }
  327. ::v-deep .el-tabs__item {
  328. color: var(--bs-el-text);
  329. }
  330. .error-img-text {
  331. overflow: hidden;
  332. padding: 0 10px;
  333. white-space: nowrap;
  334. text-overflow: ellipsis;
  335. -o-text-overflow: ellipsis;
  336. }
  337. ::v-deep .el-tabs__nav-wrap {
  338. &:after {
  339. display: none;
  340. }
  341. }
  342. .empty{
  343. height: calc(100vh - 430px);
  344. }
  345. </style>