inform.vue 44 KB

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