previeInform.vue 8.5 KB

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