previeInform.vue 8.0 KB

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