inform.vue 43 KB

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