previeInform.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <div class="prev" v-if="dataDetail">
  3. <div>
  4. <div class="prev-text" style="margin-top: 0">
  5. <span>所属社区: </span><span class="text-right">{{ dataDetail.communityName }}</span>
  6. </div>
  7. <div class="prev-text detail">
  8. <div class="prev-obj">
  9. 发布对象: <span>{{ houseDataNames }}</span>
  10. </div>
  11. <div v-if="showTree">
  12. <div class="detail-right" v-if="dataDetail.userType == 0">
  13. <el-tree
  14. class="filter-tree"
  15. ref="filterHouse"
  16. node-key="id"
  17. :data="houseData"
  18. :props="defaultProps"
  19. :default-expand-all="true"
  20. :filter-node-method="filterNode"
  21. @node-collapse="closeTree"
  22. >
  23. <span class="custom-tree-node" slot-scope="{ node, data }">
  24. <span v-if="data.children == null || data.children.length > 0">{{ data.name }}</span>
  25. </span>
  26. </el-tree>
  27. </div>
  28. <div class="detail-right" v-else>
  29. <el-tree
  30. class="filter-tree"
  31. ref="filterHouse"
  32. node-key="id"
  33. :data="peopleData"
  34. :props="defaultPropsPeople"
  35. :default-expand-all="true"
  36. :filter-node-method="filterNode"
  37. @node-collapse="closeTree"
  38. >
  39. <span class="custom-tree-node" slot-scope="{ node, data }">
  40. <span v-if="data.children == null || data.children.length > 0">{{ data.label }}</span>
  41. </span>
  42. </el-tree>
  43. </div>
  44. </div>
  45. <div @click="clickDetail()" class="click-prev">{{ showTree ? '关闭详情' : '查看详情' }}</div>
  46. </div>
  47. <div class="prev-text">
  48. <span>通知类型: </span
  49. ><span class="text-right">{{ dataDetail.type == 0 ? '物业通知' : dataDetail.type == 1 ? '社区活动' : '其他' }}</span>
  50. </div>
  51. <div class="prev-text">
  52. <span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 标题:</span><span class="text-right">{{ dataDetail.title }}</span>
  53. </div>
  54. <div class="prev-text">
  55. <span>是否紧急:</span><span class="text-right">{{ dataDetail.urgentFlag ? '是' : '否' }}</span>
  56. </div>
  57. <div class="prev-text image-content" v-if="dataDetail.type">
  58. <div class="image-text">主题图片:</div>
  59. <div class="right-image" v-if="successImageLists.length > 0">
  60. <el-image
  61. class="images"
  62. v-for="(item, index) of successImageLists"
  63. :key="index"
  64. :src="item.url"
  65. :preview-src-list="[item.url]"
  66. ></el-image>
  67. <!-- <img v-for="(item, index) of successImageLists" :key="index" :src="item.url" alt="" /> -->
  68. <!-- <img src="https://a.storyblok.com/f/88751/1734x1092/c3cde09986/storyblok-editor-1.jpg/m/900x0/" alt="" /> -->
  69. <!-- <img src="https://a.storyblok.com/f/88751/1734x1092/c3cde09986/storyblok-editor-1.jpg/m/900x0/" alt="" /> -->
  70. <!-- <img src="https://a.storyblok.com/f/88751/1734x1092/c3cde09986/storyblok-editor-1.jpg/m/900x0/" alt="" /> -->
  71. </div>
  72. <div class="prev-text-none" v-else>暂无图片</div>
  73. </div>
  74. <div class="prev-text files">
  75. <div>文件上传:</div>
  76. <div v-if="filePath.length > 0" class="files-content">
  77. <div v-for="(item, index) of filePath" :key="index" class="prev-text-file">
  78. <div class="prev-text-right"><i class="el-icon-paperclip"></i> {{ item.name }}</div>
  79. </div>
  80. </div>
  81. <div class="prev-text-none" v-else style="margin-left: 25px">暂无文件</div>
  82. </div>
  83. <div class="prev-text html-content">
  84. <div class="html-left">通知内容:</div>
  85. <GeminiScrollbar class="my-scroll-bar" :autoshow="true">
  86. <!-- <div class="html-right"> -->
  87. <div v-html="dataDetail.content"></div>
  88. <!-- </div> -->
  89. </GeminiScrollbar>
  90. </div>
  91. </div>
  92. </div>
  93. </template>
  94. <script>
  95. export default {
  96. name: 'previeInform',
  97. props: {
  98. houseDataNames: '',
  99. dataDetail: {
  100. type: Object,
  101. default: () => {}
  102. },
  103. houseData: {
  104. type: Array,
  105. default: () => []
  106. },
  107. peopleData: {
  108. type: Array,
  109. default: () => []
  110. },
  111. detailPeople: {
  112. type: Array,
  113. default: () => []
  114. },
  115. filePath: {
  116. type: Array,
  117. default: () => []
  118. },
  119. successImageLists: {
  120. type: Array,
  121. default: () => []
  122. }
  123. },
  124. watch: {
  125. dataDetail(val) {
  126. this.showTree = false;
  127. }
  128. },
  129. computed: {},
  130. data() {
  131. return {
  132. showTree: false,
  133. dialogVisibleHouse: false,
  134. dialogVisiblePeople: false,
  135. defaultProps: {
  136. children: 'children',
  137. label: 'name'
  138. },
  139. defaultPropsPeople: {
  140. children: 'children',
  141. label: 'value'
  142. }
  143. };
  144. },
  145. created() {},
  146. computed: {},
  147. methods: {
  148. filter(arr) {
  149. arr.map((item) => {});
  150. },
  151. // 关闭节点事件
  152. closeTree(e) {
  153. console.log('e', e);
  154. if (e.type == 'community') {
  155. this.showTree = false;
  156. }
  157. },
  158. // 点击显示发布对象详情
  159. clickDetail() {
  160. this.showTree = !this.showTree;
  161. },
  162. filterNode(value, data) {
  163. if (!value) return true;
  164. return data.label.indexOf(value) !== -1;
  165. }
  166. }
  167. };
  168. </script>
  169. <style lang="scss" scoped>
  170. .prev {
  171. width: 100%;
  172. .prev-text {
  173. width: 100%;
  174. font-size: 12px;
  175. color: #424656;
  176. margin: 34px 20px;
  177. .text-right {
  178. margin-left: 25px;
  179. }
  180. }
  181. .prev-obj {
  182. max-width: 60%;
  183. overflow: hidden;
  184. white-space: nowrap;
  185. text-overflow: ellipsis;
  186. span {
  187. margin-left: 25px;
  188. }
  189. }
  190. .detail {
  191. display: flex;
  192. position: relative;
  193. .detail-right {
  194. position: absolute;
  195. top: -5px;
  196. right: 4%;
  197. background: #eee;
  198. }
  199. .click-prev {
  200. color: #0eaeff;
  201. cursor: pointer;
  202. // margin-left: 5px;
  203. }
  204. }
  205. .files {
  206. display: flex;
  207. }
  208. .prev-text-none {
  209. font-size: 12px;
  210. }
  211. .image-content {
  212. width: 100%;
  213. display: flex;
  214. .image-text {
  215. width: 12%;
  216. display: flex;
  217. flex-direction: column;
  218. justify-content: center;
  219. }
  220. .right-image {
  221. max-height: 120px;
  222. display: flex;
  223. :last-child {
  224. margin-right: 0;
  225. }
  226. .images {
  227. display: block;
  228. float: left;
  229. width: 180px;
  230. height: 100px;
  231. border: 1px solid #ccc;
  232. border-radius: 4px;
  233. min-width: 100px;
  234. margin-right: 10px;
  235. }
  236. }
  237. }
  238. .files-content {
  239. min-width: 150px;
  240. display: flex;
  241. .prev-text-file {
  242. background: #f8fcff;
  243. border-radius: 4px;
  244. font-size: 14px;
  245. margin-left: 25px;
  246. padding: 2px 8px;
  247. .prev-text-right {
  248. overflow: hidden;
  249. white-space: nowrap;
  250. -o-text-overflow: ellipsis; //浏览器兼容
  251. text-overflow: ellipsis;
  252. }
  253. }
  254. }
  255. .html-content {
  256. display: flex;
  257. width: 100%;
  258. max-height: 200px;
  259. .html-left {
  260. margin-right: 5%;
  261. }
  262. }
  263. // 弹框自定义滚动条
  264. .my-scroll-bar {
  265. width: 86%;
  266. height: 200px;
  267. max-height: 218px;
  268. /deep/ .gm-scrollbar.-horizontal .thumb {
  269. height: 0;
  270. }
  271. }
  272. /deep/ .wscnph {
  273. max-width: 200px;
  274. max-height: 200px;
  275. }
  276. .el-tree {
  277. background: #fff;
  278. padding: 0 20px;
  279. height: 50vh;
  280. overflow: auto;
  281. }
  282. }
  283. </style>