inform.vue 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918
  1. <template>
  2. <div class="inform">
  3. <div class="search">
  4. <el-input placeholder="请输入标题" class="search-input" clearable v-model="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="add">
  20. <img src="../../assets/img/btn_tianjia@2x.png" alt="" @click="add" />
  21. </div>
  22. </div>
  23. <div class="content">
  24. <div class="roles-wrap">
  25. <zz-table
  26. :cols="cols"
  27. :settings="{ showNumber: true, stripe: true, showNumberWidth: '100' }"
  28. :data="mixins_list"
  29. :pageset="mixins_pageset"
  30. @page-change="pageChange"
  31. :loading="mixins_onQuery"
  32. >
  33. <template slot="pubPeople" slot-scope="scope">
  34. {{ scope.row.pubPeople }}
  35. </template>
  36. <template slot-scope="scope" slot="releaseTime">
  37. <div>
  38. {{ scope.row.pubDate }}
  39. </div>
  40. </template>
  41. <template slot-scope="scope" slot="opt">
  42. <div class="opt" @click="clickDatail(scope.row)">
  43. <img src="../../assets/img/icon_biaodan@2x.png" alt="" />
  44. </div>
  45. </template>
  46. </zz-table>
  47. </div>
  48. <!-- 添加弹框 -->
  49. <div class="dialog-info">
  50. <el-dialog :visible.sync="centerDialogVisible" width="1086px" :close-on-press-escape="false" :close-on-click-modal="false">
  51. <div class="dialog">
  52. <div class="dialog-header">
  53. <i class="el-dialog__close el-icon el-icon-close" @click="dialogButton('clear')"></i>
  54. <div class="dialogTitle" v-if="showDetail">
  55. 物业通知发布(
  56. <span style="color: #ff7f7f"> *</span>
  57. 为必填项)
  58. </div>
  59. <div class="dialogTitle" v-else>物业通知发布</div>
  60. </div>
  61. <div class="dialog-contents">
  62. <div class="dialog-left">
  63. <div v-if="showDetail">
  64. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="101px" class="demo-ruleForm">
  65. <el-form-item label="所属社区" prop="popCommunityId">
  66. <el-select
  67. placeholder="请选择所属社区"
  68. v-model="ruleForm.popCommunityId"
  69. clearable
  70. class="dialog-select"
  71. @change="changeCommunity"
  72. >
  73. <el-option
  74. v-for="(item, index) in communityList"
  75. :key="index"
  76. :label="item.label"
  77. :value="item.id"
  78. ></el-option>
  79. </el-select>
  80. </el-form-item>
  81. <el-form-item label="发布对象" prop="issueRoom">
  82. <div class="issueRoom">
  83. <div class="radio-room">
  84. <el-checkbox
  85. label="社区住户"
  86. name="type"
  87. v-model="ruleForm.issueRoom.checkAll"
  88. @change="changeCheckboxRoom"
  89. ></el-checkbox>
  90. <el-radio-group
  91. v-model="ruleForm.issueRoom.radioRoom"
  92. :disabled="!ruleForm.issueRoom.checkAll"
  93. @change="changeRadioRoom"
  94. >
  95. <el-radio label="全部房间"></el-radio>
  96. <el-radio label="指定房间"></el-radio>
  97. </el-radio-group>
  98. </div>
  99. <div class="selet-room" v-show="ruleForm.issueRoom.checkAll">
  100. <tree-house
  101. :buildingType="1"
  102. :showCheckboxTree="true"
  103. :defaultExpandAllTree="false"
  104. :accordion="true"
  105. :selectAll="true"
  106. @selectData="selectDataHouseTree"
  107. :disabledHouse="disabledHouse"
  108. ref="selectTreeHouse"
  109. ></tree-house>
  110. </div>
  111. </div>
  112. <div class="issueRoom">
  113. <div class="radio-room">
  114. <el-checkbox
  115. label="物业员工"
  116. name="type"
  117. v-model="ruleForm.issueRoom.staff"
  118. @change="changeCheckboxStaffRoom"
  119. ></el-checkbox>
  120. <el-radio-group
  121. v-model="ruleForm.issueRoom.radioStaff"
  122. :disabled="!ruleForm.issueRoom.staff"
  123. @change="changeRadioStaffRoom"
  124. >
  125. <el-radio label="全部员工"></el-radio>
  126. <el-radio label="指定员工"></el-radio>
  127. </el-radio-group>
  128. </div>
  129. <div class="selet-room" v-show="ruleForm.issueRoom.staff">
  130. <tree-house
  131. ref="selectTreePeoples"
  132. :buildingType="1"
  133. :showCheckboxTree="true"
  134. :defaultExpandAllTree="false"
  135. :showHouseTree="false"
  136. :accordionPeople="true"
  137. :selectAll="true"
  138. @dataPeople="dataPeople"
  139. @selectPeople="selectPeople"
  140. :disabled="disabledPeople"
  141. ></tree-house>
  142. </div>
  143. </div>
  144. </el-form-item>
  145. <el-form-item label="通知类型" prop="informType">
  146. <el-select
  147. v-model="ruleForm.informType"
  148. @change="changeInformType"
  149. clearable
  150. class="dialog-select"
  151. placeholder="请选择通知类型"
  152. >
  153. <el-option
  154. v-for="(item, index) in informTypes"
  155. :key="index"
  156. :label="item.label"
  157. :value="item.status"
  158. >{{ item.label }}</el-option
  159. >
  160. </el-select>
  161. </el-form-item>
  162. <el-form-item label="标题" prop="title">
  163. <el-input v-model="ruleForm.title" placeholder="不能超过20字" maxlength="20"></el-input>
  164. </el-form-item>
  165. <el-form-item label="是否紧急" prop="exigencyOr">
  166. <el-radio-group v-model="ruleForm.exigencyOr" @change="changeRadioExigencyOr">
  167. <el-radio label="是"></el-radio>
  168. <el-radio label="否"></el-radio>
  169. </el-radio-group>
  170. </el-form-item>
  171. <el-form-item label="选择时间" prop="activeTime" v-if="showUploadImage">
  172. <el-date-picker
  173. v-model="ruleForm.activeTime"
  174. type="datetimerange"
  175. range-separator="至"
  176. start-placeholder="开始日期"
  177. end-placeholder="结束日期"
  178. :picker-options="pickerOptions"
  179. :editable="false"
  180. ></el-date-picker>
  181. </el-form-item>
  182. <el-form-item label="主题图片" prop="image" v-if="showUploadImage">
  183. <div class="up-image">
  184. <up-image
  185. color="#1890ff"
  186. class="editor-upload-btn"
  187. @successCBK="imageSuccessCBK"
  188. @deleteImage="deleteImage"
  189. @successImageList="successImageList"
  190. @clearImageList="clearImageList"
  191. ref="upImages"
  192. ></up-image>
  193. </div>
  194. </el-form-item>
  195. <el-form-item label="通知内容" prop="editorContents">
  196. <!-- tinymce-editor 富文本编辑器 -->
  197. <div class="editor-container">
  198. <tinymce v-model="ruleForm.editorContents" ref="endit" :height="150" />
  199. </div>
  200. </el-form-item>
  201. <el-form-item label="文件上传" prop="fill">
  202. <div>
  203. <el-upload
  204. class="upload-fill"
  205. action="/sc-community-web/upload/uploadFile"
  206. :on-preview="handlePreview"
  207. :on-remove="handleRemove"
  208. :before-remove="beforeRemove"
  209. multiple
  210. :limit="3"
  211. :on-exceed="handleExceed"
  212. :file-list="fileList"
  213. :on-success="successFile"
  214. >
  215. <el-button size="small" icon="el-icon-paperclip">选择附件</el-button>
  216. <div slot="tip" class="el-upload-text">
  217. 支持格式:.rar .zip .doc .docx .pdf ,单个文件不能超过20MB
  218. </div>
  219. </el-upload>
  220. </div>
  221. </el-form-item>
  222. <el-form-item class="dialog-footer">
  223. <span>
  224. <el-button type="primary" @click="dialogButton('clear')" plain>取消</el-button>
  225. <el-button type="primary" @click="dialogButton('prev')">发布</el-button>
  226. </span>
  227. </el-form-item>
  228. </el-form>
  229. </div>
  230. <div v-if="!showDetail">
  231. <!-- 详情显示 -->
  232. <previe-inform
  233. :dataDetail="rowDetail"
  234. :filePath="filePath"
  235. :successImageLists="successImageLists"
  236. :houseData="houseData"
  237. ref="filterHouse"
  238. ></previe-inform>
  239. </div>
  240. </div>
  241. <div class="dialog-right">
  242. <div class="dialog-right-top">
  243. <img src="../../assets/img/phoneHeader.png" alt="" />
  244. </div>
  245. <div class="dialog-right-header">
  246. <i class="el-icon-arrow-left"></i>
  247. <div v-if="showDetail">{{ this.showUploadImage ? '社区活动' : '物业通知' }}</div>
  248. <div v-else>{{ rowDetail.type == 0 ? '物业通知' : '社区活动' }}</div>
  249. </div>
  250. <div class="center-padding"></div>
  251. <GeminiScrollbar class="my-scroll-bar" :autoshow="true">
  252. <div class="dialog-right-content">
  253. <div class="dialog-title">
  254. <div class="dialog-titles" v-if="showDetail">
  255. {{ ruleForm.title ? ruleForm.title : '标题' }}
  256. </div>
  257. <div class="dialog-titles" v-else>
  258. {{ rowDetail.title ? rowDetail.title : '标题' }}
  259. </div>
  260. <div v-if="showDetail">
  261. <div class="dialog-urgency" v-if="ruleForm.exigencyOr == '是'">紧急</div>
  262. </div>
  263. <div v-else>
  264. <div class="dialog-urgency" v-if="rowDetail.urgentFlag">紧急</div>
  265. </div>
  266. <!-- ruleForm.exigencyOr -->
  267. </div>
  268. <div class="dialog-right-time" v-if="!showDetail">{{ rowDetail.pubDate }}</div>
  269. <div class="dialog-right-time" v-else>{{ new Date() | filterTime }}</div>
  270. <div></div>
  271. <div class="content">
  272. <div class="content-text" v-if="showDetail">
  273. <div v-html="ruleForm.editorContents" id="content" />
  274. </div>
  275. <div class="content-text" v-else>
  276. <div v-html="contentHtml" id="content" />
  277. </div>
  278. <div class="content-inform">
  279. <!-- <div>{{ !showDetail ? rowDetail.communityName : popCommunityName }}</div>
  280. <div v-if="rowDetail">{{ rowDetail.pubDate }}</div>
  281. <div v-else>{{ new Date() | filterTime }}</div>
  282. <div>物业电话:{{ $store.state.cruUserInfo.phone }}</div> -->
  283. </div>
  284. <div v-if="showDetail">
  285. <div class="file-name" v-for="(item, index) of uploadFileUrl" :key="index">
  286. <span class="file-name-left"><i class="el-icon-paperclip"></i> </span>
  287. <span class="file-name-right">
  288. {{ item.name }}
  289. </span>
  290. </div>
  291. </div>
  292. <div v-else>
  293. <div class="file-name" v-for="(item, index) of filePath" :key="index">
  294. <span class="file-name-left"><i class="el-icon-paperclip"></i> </span>
  295. <span class="file-name-right">
  296. {{ item.name }}
  297. </span>
  298. </div>
  299. </div>
  300. </div>
  301. <div></div>
  302. </div>
  303. </GeminiScrollbar>
  304. </div>
  305. </div>
  306. </div>
  307. </el-dialog>
  308. </div>
  309. </div>
  310. </div>
  311. </template>
  312. <script>
  313. import list from '@utils/list.js';
  314. import previeInform from './common/previeInform';
  315. import upImage from './common/upImage';
  316. // Tinymce 富文本编辑器
  317. import Tinymce from '@/components/Tinymce';
  318. const content = '';
  319. export default {
  320. mixins: [list],
  321. components: { previeInform, Tinymce, upImage },
  322. data() {
  323. let _this = this;
  324. return {
  325. disabledHouse: true,
  326. disabledPeople: true,
  327. organList: [],
  328. popCommunityName: '',
  329. fileList: [],
  330. // 显示图片上传
  331. showUploadImage: false,
  332. dialogImageUrl: '',
  333. // 显示详情
  334. showDetail: true,
  335. rowDetail: '',
  336. contentHtml: '',
  337. // 查询的时间
  338. searchTime: [],
  339. // 添加弹框信息
  340. ruleForm: {
  341. popCommunityId: '', //所属社区
  342. //发布对象
  343. issueRoom: {
  344. checkAll: false,
  345. radioRoom: '',
  346. staff: false,
  347. radioStaff: ''
  348. },
  349. disabledRoom: false, //单选框是否禁用
  350. disabledStaffRoom: false,
  351. informType: '', //通知类型
  352. title: '', //标题
  353. exigencyOr: '是', //是否紧急
  354. exigencyText: true,
  355. activeTime: [],
  356. editorContents: '',
  357. // informContent: content, //通知内容
  358. informContent: '', //通知内容
  359. upload: '' // 文件上传
  360. },
  361. rules: {
  362. popCommunityId: [{ required: true, message: '请选择社区', trigger: 'change' }],
  363. radioRoom: [{ required: true, message: '请选择房间', trigger: 'change' }],
  364. informType: [{ required: true, message: '请选择通知类型', trigger: 'change' }],
  365. title: [{ required: true, message: '请输入标题', trigger: 'blur' }],
  366. exigencyOr: [{ required: true, message: '请选择是否紧急', trigger: 'change' }],
  367. activeTime: [{ required: true, message: '请选择时间', trigger: 'change' }],
  368. issueRoom: [{ required: true, message: '请选择发布对象', trigger: 'change' }],
  369. editorContents: [{ required: true, message: '请发布内容', trigger: 'blur' }] //通知内容
  370. },
  371. // 输入地址
  372. location: '',
  373. // 通知类型
  374. informTypes: [
  375. {
  376. status: 0,
  377. label: '物业通知'
  378. },
  379. {
  380. status: 1,
  381. label: '社区活动'
  382. }
  383. ],
  384. cols: [
  385. {
  386. label: '标题',
  387. prop: 'title'
  388. },
  389. {
  390. label: '所属社区',
  391. prop: 'communityName'
  392. },
  393. {
  394. label: '通知类型',
  395. prop: 'type',
  396. format(val) {
  397. if (val == 0) {
  398. return '物业通知';
  399. } else if (val == 1) {
  400. return '社区活动';
  401. } else {
  402. return '其他';
  403. }
  404. }
  405. },
  406. {
  407. label: '是否紧急',
  408. prop: 'urgentFlag',
  409. format(val) {
  410. if (val == 0) {
  411. return '不紧急';
  412. } else if (val == 1) {
  413. return '紧急';
  414. } else {
  415. return '---';
  416. }
  417. }
  418. },
  419. {
  420. label: '发布时间',
  421. prop: 'pubDate',
  422. slot: 'releaseTime'
  423. },
  424. {
  425. label: '状态',
  426. prop: 'status',
  427. format(val) {
  428. return val ? val : '已发布';
  429. }
  430. },
  431. {
  432. label: '发布人',
  433. prop: 'pubPeople',
  434. slot: 'pubPeople'
  435. },
  436. {
  437. label: '操作',
  438. prop: 'id',
  439. slot: 'opt'
  440. }
  441. ],
  442. mixins_post: 'post',
  443. // 显隐弹框
  444. centerDialogVisible: false,
  445. // 获取的房间信息
  446. houseData: [],
  447. peopleData: [],
  448. // 选中的房间
  449. selectDataHouseTreeData: {
  450. checkData: [],
  451. userID: [],
  452. userList: []
  453. },
  454. // 选中的人员
  455. selectDataPeopleTreeData: {
  456. checkData: [],
  457. userList: []
  458. },
  459. // 文件上传地址
  460. uploadFileUrl: []
  461. };
  462. },
  463. created() {
  464. this.getCommunityList();
  465. this.mixins_post;
  466. this.mixins_dataUrl = '/sc-community-web/notice/page';
  467. this.mixins_query = {};
  468. this.mixins_search();
  469. this.getOrgTreeList();
  470. // 显示弹框
  471. // this.getPeople();
  472. if (this.$route.query.showDialog && this.$route.query.id && !this.$route.query.closeDialog) {
  473. let row = {
  474. id: this.$route.query.id
  475. };
  476. this.clickDatail(row);
  477. }
  478. },
  479. mounted() {},
  480. watch: {},
  481. methods: {
  482. // 人员树
  483. dataPeople(data) {
  484. this.peopleData = data;
  485. },
  486. // 上传文件
  487. handleRemove(file, fileList) {
  488. console.log('上传文件', file, fileList);
  489. },
  490. handlePreview(file) {
  491. console.log('点击文件', file);
  492. },
  493. successFile(file, fileLists) {
  494. console.log('上传文件successFile', fileLists);
  495. let obj = {};
  496. // this.fileList.push(fileLists.name);
  497. let resName = fileLists.response.data;
  498. obj.oldName = resName;
  499. obj.name = fileLists.name;
  500. // this.uploadFileUrl= this.uploadFileUrl.concat(newName + ',');
  501. this.uploadFileUrl.push(obj);
  502. },
  503. handleExceed(files, fileList) {
  504. this.$message.warning(
  505. `当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`
  506. );
  507. },
  508. beforeRemove(file, fileList) {
  509. let removeName = this.fileList.filter((item) => {
  510. return item.name != file.name;
  511. });
  512. this.fileList = removeName;
  513. this.uploadFileUrl = removeName;
  514. console.log('点击移除', this.fileList);
  515. },
  516. /**上传图片*/
  517. successImageList(arr) {
  518. this.successImageLists = arr;
  519. console.log('====================================');
  520. console.log('上传图片', arr);
  521. console.log('====================================');
  522. },
  523. imageSuccessCBK(arr) {
  524. this.$refs.endit.imageSuccessCBK(arr);
  525. },
  526. deleteImage(val) {
  527. this.$refs.endit.deleteImage(val);
  528. },
  529. handleRemove(file) {
  530. console.log(file);
  531. },
  532. handleDownload(file) {
  533. console.log(file);
  534. },
  535. // 添加弹框下拉框变化
  536. changeCommunity(val) {
  537. console.log('添加弹框下拉框变化', val);
  538. this.$http
  539. .get('/sc-community/assets/tree/community/find', { buildingType: this.buildingType })
  540. .then(({ status, data, msg }) => {
  541. if (status === 0 && data) {
  542. this.$refs.selectTreeHouse.filterhouse(val, data);
  543. this.ruleForm.issueRoom.checkAll = true;
  544. this.ruleForm.issueRoom.radioRoom = '全部房间';
  545. this.ruleForm.issueRoom.radioStaff = '';
  546. this.ruleForm.issueRoom.staff = false;
  547. } else {
  548. this.$message.warning('获取房间失败');
  549. }
  550. });
  551. },
  552. // 选中的房间
  553. selectDataHouseTree(val) {
  554. this.selectDataHouseTreeData.userID = [];
  555. this.selectDataHouseTreeData.userID = val.userList;
  556. this.selectDataPeopleTreeData.userList = [];
  557. // this.selectDataHouseTreeData = val;
  558. // 获取房间下的usid
  559. this.$http.post('/sc-community-web/notice/queryHouseUser', val.userList).then((res) => {
  560. if (res.status === 0) {
  561. this.selectDataHouseTreeData.userList = res.data;
  562. } else {
  563. // this.$message('获取房间失败');
  564. }
  565. });
  566. console.log('选中的房间val', val);
  567. },
  568. // 选择的人员
  569. selectPeople(val) {
  570. this.selectDataPeopleTreeData = val;
  571. console.log('选择的人员inform', val);
  572. },
  573. /**监听指定房间单选框变化*/
  574. changeRadioRoom(val) {
  575. if (!this.ruleForm.popCommunityId) {
  576. return this.$message.warning('请先选择所属社区');
  577. }
  578. if (val == '指定房间') {
  579. this.ruleForm.disabledRoom = true;
  580. this.$refs.selectTreeHouse.selectHouseOr();
  581. } else {
  582. this.ruleForm.disabledRoom = false;
  583. this.$refs.selectTreeHouse.selectAllHouse();
  584. }
  585. console.log('监听房间单选框变化', val);
  586. },
  587. //选择员工复选框变化
  588. changeCheckboxStaffRoom(val) {
  589. console.log('员工复选框变化', val);
  590. if (!this.ruleForm.popCommunityId) {
  591. this.ruleForm.issueRoom.staff = false;
  592. return this.$message.warning('请先选择社区');
  593. }
  594. if (val) {
  595. this.ruleForm.issueRoom.radioStaff = '全部员工';
  596. this.ruleForm.issueRoom.checkAll = false;
  597. this.ruleForm.issueRoom.radioRoom = '';
  598. this.$refs.selectTreePeoples.selectAllPeople();
  599. this.$refs.selectTreeHouse.selectHouseOr();
  600. } else {
  601. this.ruleForm.issueRoom.radioStaff = '';
  602. this.ruleForm.issueRoom.checkAll = true;
  603. this.ruleForm.issueRoom.radioRoom = '全部房间';
  604. this.$refs.selectTreePeoples.selectPeopleOr();
  605. this.$refs.selectTreeHouse.selectAllHouse();
  606. }
  607. },
  608. // 选择房间复选框变化
  609. changeCheckboxRoom(val) {
  610. console.log('选择房间复选框变化', val);
  611. if (!this.ruleForm.popCommunityId) {
  612. this.ruleForm.issueRoom.checkAll = false;
  613. return this.$message.warning('请先选择社区');
  614. }
  615. if (val) {
  616. this.ruleForm.issueRoom.staff = false;
  617. this.ruleForm.issueRoom.checkAll = true;
  618. this.ruleForm.issueRoom.radioRoom = '全部房间';
  619. this.ruleForm.issueRoom.radioStaff = '';
  620. this.$refs.selectTreeHouse.selectAllHouse();
  621. } else {
  622. this.ruleForm.issueRoom.radioRoom = '';
  623. this.$refs.selectTreeHouse.selectHouseOr();
  624. }
  625. },
  626. // 指定员工
  627. changeRadioStaffRoom(val) {
  628. if (val == '指定员工') {
  629. this.ruleForm.disabledStaffRoom = true;
  630. this.$refs.selectTreePeoples.selectPeopleOr();
  631. } else {
  632. this.ruleForm.disabledStaffRoom = false;
  633. this.$refs.selectTreePeoples.selectAllPeople();
  634. }
  635. console.log('监听员工单选框变化', val, this.ruleForm.issueRoom.staff);
  636. },
  637. // 是否紧急
  638. changeRadioExigencyOr(val) {
  639. if (val == '否') {
  640. this.ruleForm.exigencyText = false;
  641. } else {
  642. this.ruleForm.exigencyText = true;
  643. }
  644. },
  645. // 发布活动类型
  646. changeInformType(val) {
  647. this.successImageLists = '';
  648. if (val) {
  649. this.showUploadImage = true;
  650. } else {
  651. this.showUploadImage = false;
  652. }
  653. // this.rowDetail = '';
  654. // this.showDetail = true;
  655. // this.centerDialogVisible = true;
  656. // this.$refs.upImages.clearImageList('');
  657. // this.$refs.endit.setContent('');
  658. console.log('发布活动类型', val);
  659. },
  660. // 清空
  661. clear() {
  662. this.rowDetail = '';
  663. this.showUploadImage = false;
  664. this.ruleForm.issueRoom.staff = false;
  665. this.ruleForm.issueRoom.checkAll = false;
  666. // this.showDetail = false;
  667. this.filePath = '';
  668. this.uploadFileUrl = [];
  669. this.fileList = [];
  670. this.ruleForm.exigencyText = true;
  671. this.contentHtml = '';
  672. this.setContent = '';
  673. this.$refs.endit.setContent('');
  674. this.$refs['ruleForm'].resetFields();
  675. },
  676. /**添加按钮 */
  677. add() {
  678. this.centerDialogVisible = true;
  679. this.showDetail = true;
  680. this.rowDetail = '';
  681. this.showUploadImage = false;
  682. this.ruleForm.issueRoom.checkAll = false;
  683. this.ruleForm.issueRoom.radioRoom = '';
  684. this.ruleForm.issueRoom.staff = false;
  685. this.ruleForm.issueRoom.radioStaff = '';
  686. this.filePath = '';
  687. this.uploadFileUrl = [];
  688. this.fileList = [];
  689. this.$refs.endit.setContent('');
  690. this.$refs['ruleForm'].resetFields();
  691. if (this.showUploadImage) {
  692. this.$refs.upImages.clearImageList('');
  693. }
  694. },
  695. /**查询按钮*/
  696. searchInfo() {
  697. let detaH = this.$moment(new Date()).format('HH');
  698. let detaM = this.$moment(new Date()).format('mm');
  699. let detaS = this.$moment(new Date()).format('ss');
  700. // let d = detaH + ':' + detaM + ':' + detaS;
  701. let d = '00:00:00';
  702. let dEnd = '23:59:59';
  703. if (this.searchTime && this.searchTime.length) {
  704. this.mixins_query.startTime = `${this.searchTime[0]}T${d}`;
  705. this.mixins_query.endTime = `${this.searchTime[1]}T${dEnd}`;
  706. } else {
  707. this.mixins_query.startTime = this.$moment(new Date()).subtract(1, 'months').format('YYYY-MM-DDTHH:mm:ss');
  708. this.mixins_query.endTime = this.$moment(new Date()).format('YYYY-MM-DDTHH:mm:ss');
  709. }
  710. console.log('点击查询', this.searchTime);
  711. this.mixins_search();
  712. },
  713. /**
  714. * 弹框按钮
  715. * @param type 类型
  716. * @return {void}
  717. * */
  718. dialogButton(type) {
  719. if (type === 'prev') {
  720. this.$refs['ruleForm'].validate((valid) => {
  721. if (valid) {
  722. console.log('this.selectDataPeopleTreeData.userList', this.selectDataPeopleTreeData.userList);
  723. console.log('this.selectDataHouseTreeData.userList', this.selectDataHouseTreeData.userList);
  724. if (
  725. this.selectDataHouseTreeData.userList.length === 0 &&
  726. this.selectDataPeopleTreeData &&
  727. this.selectDataPeopleTreeData.userList.length === 0
  728. ) {
  729. return this.$message.warning('所选房间暂无住户,不可发布');
  730. }
  731. // this.showDetail = false;
  732. let startTime = this.$moment(this.ruleForm.activeTime[0]).format(`YYYY-MM-DDTHH:mm:ss`);
  733. let endTime = this.$moment(this.ruleForm.activeTime[1]).format(`YYYY-MM-DDTHH:mm:ss`);
  734. let query = {
  735. communityId: this.ruleForm.popCommunityId,
  736. content: this.ruleForm.editorContents,
  737. startTime: this.showUploadImage ? startTime : '',
  738. endTime: this.showUploadImage ? endTime : '',
  739. filePath: JSON.stringify(this.uploadFileUrl),
  740. id: 1,
  741. pubDate: this.$moment(new Date()).format(`YYYY-MM-DDTHH:mm:ss`),
  742. // pubPeople:ruleForm.informType,
  743. // pubStatus: "",
  744. themePictrue: JSON.stringify(this.successImageLists),
  745. userId: this.ruleForm.issueRoom.checkAll
  746. ? this.selectDataHouseTreeData.userList
  747. : this.selectDataPeopleTreeData.userList,
  748. treeData: JSON.stringify(this.selectDataHouseTreeData.userID),
  749. title: this.ruleForm.title,
  750. type: this.ruleForm.informType,
  751. urgentFlag: this.ruleForm.exigencyOr == '是' ? 1 : 0,
  752. userType:
  753. this.ruleForm.issueRoom.radioStaff == '全部员工' || this.ruleForm.issueRoom.radioStaff == '指定员工' ? 1 : 0
  754. };
  755. this.$http.post('/sc-community-web/notice/add', query).then((res) => {
  756. if (res.status === 0) {
  757. this.$message.success('发布成功');
  758. this.$refs.endit.setContent('');
  759. this.$refs['ruleForm'].resetFields();
  760. this.successImageList = [];
  761. this.clear();
  762. this.$refs['ruleForm'].resetFields();
  763. if (this.showUploadImage) {
  764. this.$refs.upImages.clearImageList('');
  765. }
  766. this.mixins_search();
  767. } else {
  768. this.$message('发布失败,请稍后重试');
  769. this.successImageList = [];
  770. this.contentHtml = '';
  771. this.clear();
  772. }
  773. this.centerDialogVisible = false;
  774. console.log('点击发布', res);
  775. });
  776. } else {
  777. return false;
  778. }
  779. });
  780. } else if (type == 'clear') {
  781. if (this.$route.query.showDialog) {
  782. this.$router.replace('/workbench/index');
  783. }
  784. this.centerDialogVisible = false;
  785. this.clear();
  786. this.$refs['ruleForm'].resetFields();
  787. if (this.showUploadImage) {
  788. this.$refs.upImages.clearImageList('');
  789. }
  790. } else {
  791. this.centerDialogVisible = false;
  792. this.clear();
  793. this.$refs['ruleForm'].resetFields();
  794. if (this.showUploadImage) {
  795. this.$refs.upImages.clearImageList('');
  796. }
  797. }
  798. },
  799. /** 获取社区列表*/
  800. getCommunityList() {
  801. this.communityList = [];
  802. var onOption = '';
  803. this.$http.get('/sc-community/assets/community/list', {}).then((res) => {
  804. // this.$store.commit('setAreaSelect', res.data);
  805. console.log('获取社区列表', res);
  806. res.data.map((res) => {
  807. onOption = {
  808. label: res.communityName,
  809. id: res.id
  810. };
  811. this.communityList.push(onOption);
  812. });
  813. });
  814. },
  815. // 获取人员
  816. getPeopleList() {
  817. this.$http.get('/sc-user-center/user/findUserList').then(({ status, data, msg }) => {
  818. if (status === 0) {
  819. this.dataPeopleList = data;
  820. // this.dimension(this.dataPeopleList, this.dataDetail.noticeUserVoList);
  821. } else {
  822. this.$message(warning, '获取人员失败,请稍后重试');
  823. }
  824. console.log('dataPeopleList', this.dataPeopleList);
  825. });
  826. },
  827. dimension(arr) {
  828. console.log('dimensiondimensiondimensiondimension', arr);
  829. arr.map((item, index) => {
  830. if (item.children) {
  831. this.dimension(item.children);
  832. } else if (item.type == 'room') {
  833. this.filterArr(arr, item, index);
  834. }
  835. });
  836. },
  837. filterArr(arr, item, index) {
  838. if (!this.rowDetail.treeData.includes(Number(item.value))) {
  839. arr.splice(index, 1);
  840. arr.map((item) => {
  841. this.filterArr(arr, item, index);
  842. });
  843. }
  844. },
  845. filterName(arr) {
  846. var name = '';
  847. arr.map((item) => {
  848. if (item.children) {
  849. this.filterName(item.children);
  850. } else {
  851. name.concat(+',' + item.name);
  852. }
  853. });
  854. return name;
  855. },
  856. // 获取房间
  857. getOrgTreeList() {
  858. this.$http
  859. .get('/sc-community/assets/tree/community/find', { buildingType: this.buildingType })
  860. .then(({ status, data, msg }) => {
  861. if (status === 0 && data) {
  862. console.log('houseData=1', this.houseData);
  863. this.houseData = data;
  864. this.dimension(this.houseData);
  865. this.rowDetail.houseDataName = this.filterName(this.houseData);
  866. console.log('====================================');
  867. console.log('houseData=2', this.houseData);
  868. console.log('====================================');
  869. }
  870. console.log('获取房间', this.rowDetail.treeData);
  871. });
  872. },
  873. /** 查看详情*/
  874. clickDatail(row) {
  875. // this.rowDetail = [];
  876. this.$http.get('/sc-community-web/notice/find/' + row.id).then((res) => {
  877. if (res.status === 0) {
  878. this.getOrgTreeList();
  879. // this.filterHouse(this.organList, res.data.noticeUserVoList);
  880. this.rowDetail = res.data;
  881. this.rowDetail.treeData = JSON.parse(res.data.treeData);
  882. // let fileArr = row.filePath.split(',');
  883. // this.filePath = fileArr.slice(0, fileArr.length - 1);
  884. this.filePath = JSON.parse(res.data.filePath);
  885. this.successImageLists = JSON.parse(res.data.themePictrue);
  886. this.contentHtml = res.data.content;
  887. this.centerDialogVisible = true;
  888. this.showDetail = false;
  889. console.log('查看详情', res);
  890. } else {
  891. return this.$message('获取详情失败!请稍后重试');
  892. }
  893. });
  894. // this.ruleForm.title = row.managementName;
  895. // this.ruleForm.newPhone = row.phone;
  896. }
  897. }
  898. };
  899. </script>
  900. <style lang="scss" scoped>
  901. @import './style.scss';
  902. </style>