inform.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <div class="inform">
  3. <div class="search">
  4. <el-input placeholder="请输入标题" class="search-input" clearable v-model.trim="mixins_query.title"></el-input>
  5. <el-select placeholder="请选择所属社区" v-model="mixins_query.communityId" clearable>
  6. <el-option v-for="(item, index) in communityList" :key="index" :label="item.label" :value="item.id"></el-option>
  7. </el-select>
  8. <el-date-picker
  9. v-model="searchTime"
  10. value-format="yyyy-MM-dd"
  11. type="daterange"
  12. range-separator="至"
  13. start-placeholder="开始日期"
  14. end-placeholder="结束日期"
  15. :picker-options="pickerOptions"
  16. :editable="false"
  17. ></el-date-picker>
  18. <el-button type="primary" placeholder="状态" class="search-btn" @click="searchInfo" icon="el-icon-search">查询 </el-button>
  19. <div class="search-icon">
  20. <el-tooltip class="item" effect="light" placement="bottom" content="物业通知发布">
  21. <i class="zoniot_font zoniot-icon-tianjia2" @click="add"></i>
  22. </el-tooltip>
  23. </div>
  24. </div>
  25. <div class="content">
  26. <div class="roles-wrap">
  27. <zz-table
  28. :cols="cols"
  29. :settings="{ showNumber: true, stripe: true, showNumberWidth: '100' }"
  30. :data="mixins_list"
  31. :pageset="mixins_pageset"
  32. @page-change="pageChange"
  33. :loading="mixins_onQuery"
  34. >
  35. <template slot="pubPeople" slot-scope="scope">
  36. {{ scope.row.pubPeople }}
  37. </template>
  38. <template slot-scope="scope" slot="releaseTime">
  39. <div>
  40. {{ scope.row.pubDate }}
  41. </div>
  42. </template>
  43. <template slot-scope="scope" slot="opt">
  44. <div class="opt" @click="clickDatail(scope.row)">
  45. <img src="../../assets/img/icon_biaodan@2x.png" alt="" />
  46. </div>
  47. </template>
  48. </zz-table>
  49. </div>
  50. <!-- 添加弹框 -->
  51. <div class="dialog-info">
  52. <el-dialog
  53. :visible.sync="centerDialogVisible"
  54. @close="handleDialogClose"
  55. width="1086px"
  56. :close-on-press-escape="false"
  57. :close-on-click-modal="false"
  58. >
  59. <div class="dialog">
  60. <div class="dialog-header">
  61. <i class="el-dialog__close el-icon el-icon-close" @click="centerDialogVisible = false"></i>
  62. <div class="dialogTitle">{{ rowDetail.type == 0 ? '物业通知' : '社区活动' }}详情</div>
  63. </div>
  64. <div class="dialog-contents">
  65. <previe-inform
  66. :dataDetail="rowDetail"
  67. :filePath="filePath"
  68. :successImageLists="successImageLists"
  69. :houseData="houseData"
  70. :peopleData="peopleData"
  71. :houseDataNames="houseDataNames"
  72. :houseDataNamesPeople="houseDataNamesPeople"
  73. :userType="userType"
  74. :showrightPhone="true"
  75. ref="previeInform"
  76. ></previe-inform>
  77. </div>
  78. </div>
  79. </el-dialog>
  80. </div>
  81. </div>
  82. </div>
  83. </template>
  84. <script>
  85. import list from '@utils/list.js';
  86. import previeInform from './common/previeInform';
  87. const content = '';
  88. export default {
  89. mixins: [list],
  90. components: { previeInform },
  91. data() {
  92. let _this = this;
  93. return {
  94. // 显示详情
  95. showDetail: true,
  96. rowDetail: '',
  97. contentHtml: '',
  98. // 查询的时间
  99. searchTime: [],
  100. // 输入地址
  101. location: '',
  102. // 通知类型
  103. informTypes: [
  104. {
  105. status: 0,
  106. label: '物业通知'
  107. },
  108. {
  109. status: 1,
  110. label: '社区活动'
  111. }
  112. ],
  113. cols: [
  114. {
  115. label: '标题',
  116. prop: 'title',
  117. width: 300
  118. },
  119. {
  120. label: '所属社区',
  121. prop: 'communityName'
  122. },
  123. {
  124. label: '通知类型',
  125. prop: 'type',
  126. format(val) {
  127. if (val == 0) {
  128. return '物业通知';
  129. } else if (val == 1) {
  130. return '社区活动';
  131. } else {
  132. return '其他';
  133. }
  134. }
  135. },
  136. {
  137. label: '是否紧急',
  138. prop: 'urgentFlag',
  139. format(val) {
  140. if (val == 0) {
  141. return '不紧急';
  142. } else if (val == 1) {
  143. return '紧急';
  144. } else {
  145. return '---';
  146. }
  147. }
  148. },
  149. {
  150. label: '发布时间',
  151. prop: 'pubDate',
  152. slot: 'releaseTime'
  153. },
  154. {
  155. label: '状态',
  156. prop: 'status',
  157. format(val) {
  158. return val ? val : '已发布';
  159. }
  160. },
  161. {
  162. label: '发布人',
  163. prop: 'pubPeople',
  164. slot: 'pubPeople'
  165. },
  166. {
  167. label: '操作',
  168. prop: 'id',
  169. slot: 'opt'
  170. }
  171. ],
  172. mixins_post: 'post',
  173. // 显隐弹框
  174. centerDialogVisible: false,
  175. // 获取的房间信息
  176. houseData: [],
  177. houseDataNames: '',
  178. houseDataNamesPeople: '',
  179. peopleData: [],
  180. userType: '',
  181. // 选中的房间
  182. selectDataHouseTreeData: {
  183. checkData: [],
  184. userID: [],
  185. userList: []
  186. },
  187. houseNames: [],
  188. PeopleNames: []
  189. };
  190. },
  191. created() {
  192. // if (!!this.$route.params.showPop) {
  193. // this.add();
  194. // }
  195. this.getCommunityList();
  196. this.mixins_dataUrl = '/sc-community/notice/page';
  197. this.mixins_query = {};
  198. this.mixins_search();
  199. this.getOrgTreeList();
  200. },
  201. mounted() {},
  202. methods: {
  203. /**添加按钮 */
  204. add() {
  205. new Promise((resolve) => {
  206. this.$store.dispatch('addPopup', {
  207. url: '/propertyManagement/stepPage/informAdd.vue',
  208. width: '1100px',
  209. height: '600px',
  210. props: {
  211. callback: resolve,
  212. house: this.selectRow
  213. },
  214. title: '物业通知发布'
  215. });
  216. }).then(() => {
  217. this.mixins_search();
  218. });
  219. },
  220. /**查询按钮*/
  221. searchInfo() {
  222. let detaH = this.$moment(new Date()).format('HH');
  223. let detaM = this.$moment(new Date()).format('mm');
  224. let detaS = this.$moment(new Date()).format('ss');
  225. // let d = detaH + ':' + detaM + ':' + detaS;
  226. let d = '00:00:00';
  227. let dEnd = '23:59:59';
  228. if (this.searchTime && this.searchTime.length) {
  229. this.mixins_query.startTime = `${this.searchTime[0]}T${d}`;
  230. this.mixins_query.endTime = `${this.searchTime[1]}T${dEnd}`;
  231. } else {
  232. this.mixins_query.startTime = this.$moment(new Date()).subtract(1, 'months').format('YYYY-MM-DDTHH:mm:ss');
  233. this.mixins_query.endTime = this.$moment(new Date()).format('YYYY-MM-DDTHH:mm:ss');
  234. }
  235. this.mixins_search();
  236. },
  237. /** 获取社区列表*/
  238. getCommunityList() {
  239. this.communityList = [];
  240. var onOption = '';
  241. this.$http.get('/sc-community/assets/community/list', {}).then((res) => {
  242. res.data.map((res) => {
  243. onOption = {
  244. label: res.communityName,
  245. id: res.id
  246. };
  247. this.communityList.push(onOption);
  248. });
  249. });
  250. },
  251. filterPeople(arr) {
  252. arr.map((item, index) => {
  253. if (item.children && item.children.length > 0) {
  254. this.filterPeople(item.children);
  255. } else if (item.children == null) {
  256. this.filterArrPeople(arr, item, index);
  257. }
  258. });
  259. },
  260. filterArrPeople(arr, item, index) {
  261. if (!this.rowDetail.treeDataPeople.includes(Number(item.id))) {
  262. arr.splice(index, 1);
  263. arr.map((item) => {
  264. this.filterArrPeople(arr, item, index);
  265. });
  266. }
  267. },
  268. filterPeopleName(array) {
  269. var that = this;
  270. array.map((item) => {
  271. if (item.children) {
  272. that.filterPeopleName(item.children);
  273. } else if (item.children == null) {
  274. that.PeopleNames.push(item.value);
  275. }
  276. });
  277. },
  278. // 获取人员
  279. getPeopleList() {
  280. this.PeopleNames = [];
  281. this.$http.get('/sc-user-center/user/findUserList').then(({ status, data, msg }) => {
  282. if (status === 0) {
  283. this.filterPeople(data);
  284. this.filterPeopleName(data);
  285. this.clearTreeChildrenPeople(data);
  286. this.peopleData = data;
  287. this.houseDataNamesPeople = this.PeopleNames.toString();
  288. } else {
  289. this.$message(error, res.msg);
  290. }
  291. });
  292. },
  293. dimension(arr) {
  294. arr.map((item, index) => {
  295. if (item.children) {
  296. if (item.children.length > 0) {
  297. this.dimension(item.children);
  298. }
  299. } else if (item.type == 'room') {
  300. this.filterArr(arr, item, index);
  301. }
  302. });
  303. },
  304. clearTreeChildren(arr) {
  305. arr.map((item, index) => {
  306. if (!!item.children && item.children.length > 0) {
  307. this.clearTreeChildren(item.children);
  308. } else {
  309. if (!!item.children) {
  310. arr.splice(index, 1);
  311. }
  312. }
  313. });
  314. },
  315. clearTreeChildrenPeople(arr) {
  316. arr.map((item, index) => {
  317. if (!!item.children && item.children.length > 0) {
  318. this.clearTreeChildrenPeople(item.children);
  319. } else {
  320. if (!!item.children && item.children.length == 0) {
  321. this.clearTreeChildrenPeopleArr(arr, index);
  322. }
  323. }
  324. });
  325. },
  326. clearTreeChildrenPeopleArr(arr, index) {
  327. arr.splice(index, 1);
  328. arr.map((item, indexs) => {
  329. if (!!item.children && item.children.length == 0) {
  330. this.clearTreeChildrenPeopleArr(arr, indexs);
  331. }
  332. });
  333. },
  334. filterArr(arr, item, index) {
  335. if (!this.rowDetail.treeData.includes(Number(item.value))) {
  336. arr.splice(index, 1);
  337. arr.map((item) => {
  338. this.filterArr(arr, item, index);
  339. });
  340. }
  341. },
  342. filterName(array) {
  343. var that = this;
  344. array.map((item) => {
  345. if (item.children && item.children.length > 0) {
  346. that.houseNames.push(item.name);
  347. that.filterName(item.children);
  348. } else if (item.type == 'room') {
  349. that.houseNames.push(item.name);
  350. }
  351. });
  352. },
  353. // 获取房间
  354. getOrgTreeList() {
  355. this.houseNames = [];
  356. this.$http
  357. .get('/sc-community/assets/tree/community/find', { buildingType: this.buildingType })
  358. .then(({ status, data, msg }) => {
  359. if (status === 0 && data) {
  360. var arr = data.filter((item) => {
  361. return item.id == this.rowDetail.communityId;
  362. });
  363. if (arr.length > 0) {
  364. this.dimension(arr);
  365. this.clearTreeChildren(arr);
  366. this.houseData = arr;
  367. this.filterName(this.houseData);
  368. this.houseDataNames = this.houseNames.toString();
  369. }
  370. }
  371. });
  372. },
  373. /** 查看详情*/
  374. clickDatail(row) {
  375. this.showDetail = false;
  376. // 弹框关闭事件
  377. // this.rowDetail = [];
  378. this.$http.get('/sc-community/notice/find/' + row.id).then((res) => {
  379. if (res.status === 0) {
  380. // console.log('查看详情res.data.treeData', res.data.treeData);
  381. this.rowDetail = res.data;
  382. let treeData = JSON.parse(res.data.treeData);
  383. this.rowDetail.treeData = JSON.parse(treeData[0]);
  384. this.rowDetail.treeDataPeople = JSON.parse(treeData[1]);
  385. let userType = '';
  386. let arr1 = this.rowDetail.treeData;
  387. let arr2 = this.rowDetail.treeDataPeople;
  388. if (arr1.length > 0 && arr2.length > 0) {
  389. userType = 2;
  390. } else if (arr1.length > 0) {
  391. userType = 0;
  392. } else {
  393. userType = 1;
  394. }
  395. this.userType = userType;
  396. // console.log('查看详情this.userType', this.rowDetail.treeData);
  397. // console.log('查看详情this.rowDetail.treeData', this.rowDetail.treeData);
  398. // console.log('查看详情this.rowDetail.treeDataPeople', this.rowDetail.treeDataPeople);
  399. // this.rowDetail.newName = this.houseNames.toString();
  400. if (userType == 0) {
  401. this.getOrgTreeList();
  402. } else if (userType == 1) {
  403. this.getPeopleList();
  404. } else {
  405. this.getOrgTreeList();
  406. this.getPeopleList();
  407. }
  408. // let fileArr = row.filePath.split(',');
  409. // this.filePath = fileArr.slice(0, fileArr.length - 1);
  410. this.filePath = JSON.parse(res.data.filePath);
  411. this.successImageLists = JSON.parse(res.data.themePictrue);
  412. this.contentHtml = res.data.content;
  413. this.centerDialogVisible = true;
  414. // this.showDetail = false;
  415. if (!!this.$refs.previeInform) {
  416. this.$refs.previeInform.closeDialog();
  417. }
  418. } else {
  419. return this.$message.error('获取详情失败!请稍后重试');
  420. }
  421. });
  422. }
  423. }
  424. };
  425. </script>
  426. <style lang="scss" scoped>
  427. @import './style.scss';
  428. /deep/ .html-left {
  429. width: 16%;
  430. }
  431. </style>