MessagesView.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. <template>
  2. <div class="containe">
  3. <div class="mains">
  4. <h3>消息管理</h3>
  5. <div class="main-main">
  6. <div class="app-container">
  7. <el-form
  8. :model="queryParams"
  9. ref="queryForm"
  10. size="small"
  11. :inline="true"
  12. v-show="showSearch"
  13. label-width="68px"
  14. class="main-main-top"
  15. >
  16. <el-form-item label="消息" prop="msgTitle">
  17. <el-input
  18. v-model="queryParams.msgTitle"
  19. placeholder="请输入消息标题"
  20. clearable
  21. @keyup.enter.native="handleQuery"
  22. />
  23. </el-form-item>
  24. <el-form-item>
  25. <el-button
  26. type="primary"
  27. icon="el-icon-search"
  28. size="mini"
  29. @click="handleQuery"
  30. >搜索</el-button
  31. >
  32. <el-button
  33. icon="el-icon-refresh"
  34. size="mini"
  35. @click="resetQuery"
  36. class="reset1"
  37. >重置</el-button
  38. >
  39. </el-form-item>
  40. </el-form>
  41. <el-row :gutter="10" class="mb8">
  42. <el-col :span="1.5">
  43. <el-button
  44. type="primary"
  45. plain
  46. icon="el-icon-plus"
  47. size="mini"
  48. @click="handleAdd"
  49. v-hasPermi="['doc:msg:add']"
  50. >新增</el-button
  51. >
  52. </el-col>
  53. <el-col :span="1.5">
  54. <el-button
  55. type="success"
  56. plain
  57. icon="el-icon-edit"
  58. size="mini"
  59. :disabled="single"
  60. @click="handleUpdate"
  61. v-hasPermi="['doc:msg:edit']"
  62. >修改</el-button
  63. >
  64. </el-col>
  65. <el-col :span="1.5">
  66. <el-button
  67. type="danger"
  68. plain
  69. icon="el-icon-delete"
  70. size="mini"
  71. :disabled="multiple"
  72. @click="handleDelete"
  73. v-hasPermi="['doc:msg:remove']"
  74. >删除</el-button
  75. >
  76. </el-col>
  77. <right-toolbar
  78. :showSearch.sync="showSearch"
  79. @queryTable="getList"
  80. ></right-toolbar>
  81. </el-row>
  82. <el-table
  83. v-loading="loading"
  84. :data="msgList"
  85. @selection-change="handleSelectionChange"
  86. >
  87. <el-table-column type="selection" width="55" align="center" />
  88. <el-table-column label="消息标题" align="center" prop="msgTitle" />
  89. <el-table-column label="消息内容" align="center">
  90. <template slot-scope="scope">
  91. <el-button size="small" @click="looks(scope.row)">查看</el-button>
  92. </template>
  93. </el-table-column>
  94. <el-table-column
  95. label="发布时间"
  96. align="center"
  97. prop="createTime"
  98. />
  99. <el-table-column
  100. label="操作"
  101. align="center"
  102. class-name="small-padding fixed-width"
  103. >
  104. <template slot-scope="scope">
  105. <el-button
  106. size="mini"
  107. type="text"
  108. icon="el-icon-edit"
  109. @click="handleUpdate(scope.row)"
  110. v-hasPermi="['doc:msg:edit']"
  111. >修改</el-button
  112. >
  113. <el-button
  114. size="mini"
  115. type="text"
  116. icon="el-icon-delete"
  117. @click="handleDelete(scope.row)"
  118. v-hasPermi="['doc:msg:remove']"
  119. >删除</el-button
  120. >
  121. <el-button size="mini" type="text" icon="el-icon-user" @click="handleMsgUser(scope.row)">选择消息接收人员</el-button>
  122. </template>
  123. </el-table-column>
  124. </el-table>
  125. <pagination
  126. v-show="total > 0"
  127. :total="total"
  128. :page.sync="queryParams.pageNum"
  129. :limit.sync="queryParams.pageSize"
  130. @pagination="getList"
  131. />
  132. <!-- 添加或修改系统通知对话框 -->
  133. <el-dialog
  134. :title="title"
  135. :visible.sync="open"
  136. width="500px"
  137. append-to-body
  138. custom-class="el-dialog5"
  139. >
  140. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  141. <el-form-item label="消息标题" prop="msgTitle">
  142. <el-input v-model="form.msgTitle" placeholder="请输入消息标题" />
  143. </el-form-item>
  144. <el-form-item label="消息内容">
  145. <textarea v-model="form.msgContent" cols="50px" rows="17px" style="background: transparent; color: #7ea4c8ff;border: 1px solid #006c9aff;">
  146. </textarea>
  147. </el-form-item>
  148. </el-form>
  149. <div slot="footer" class="dialog-footer">
  150. <el-button type="primary" @click="submitForm">确 定</el-button>
  151. <el-button @click="cancel">取 消</el-button>
  152. </div>
  153. </el-dialog>
  154. <!-- 通知内容 -->
  155. <el-dialog
  156. title="通知内容"
  157. :visible.sync="look1"
  158. width="30%"
  159. custom-class="el-dialog6"
  160. >
  161. <div class="main" v-html="details">
  162. </div>
  163. <span slot="footer" class="dialog-footer1">
  164. <el-button type="primary" @click="look1 = false">确 定</el-button>
  165. <el-button @click="look1 = false">取 消</el-button>
  166. </span>
  167. </el-dialog>
  168. </div>
  169. </div>
  170. </div>
  171. </div>
  172. </template>
  173. <script>
  174. import "@/styles1/element-ui1.scss";
  175. import {
  176. listMsg,
  177. getMsg,
  178. delMsg,
  179. addMsg,
  180. updateMsg
  181. } from "@/api/doc/msg";
  182. export default {
  183. name: "Msg",
  184. data() {
  185. return {
  186. //通知内容弹窗
  187. look1: false,
  188. //通知内容
  189. details:"",
  190. // 部门树选项
  191. deptOptions: undefined,
  192. // 遮罩层
  193. loading: true,
  194. // 选中数组
  195. ids: [],
  196. // 非单个禁用
  197. single: true,
  198. // 非多个禁用
  199. multiple: true,
  200. // 显示搜索条件
  201. showSearch: true,
  202. // 总条数
  203. total: 0,
  204. // 系统消息表格数据
  205. msgList: [],
  206. // 弹出层标题
  207. title: "",
  208. // 是否显示弹出层
  209. open: false,
  210. // 查询参数
  211. queryParams: {
  212. pageNum: 1,
  213. pageSize: 10,
  214. msgTitle: null,
  215. msgType: 2, //消息类型为消息
  216. msgContent: null,
  217. msgAcceptType: null,
  218. msgAcceptSelect: null,
  219. msgAcceptList: null,
  220. createBy: null,
  221. createTime: null,
  222. updateBy: null,
  223. updateTime: null,
  224. remark: null,
  225. },
  226. // 表单参数
  227. form: {},
  228. // 表单校验
  229. rules: {
  230. msgTitle: [{
  231. required: true,
  232. message: "消息标题不能为空",
  233. trigger: "blur"
  234. }],
  235. msgContent: [{
  236. required: true,
  237. message: "消息内容不能为空",
  238. trigger: "blur"
  239. }]
  240. },
  241. };
  242. },
  243. created() {
  244. this.getList();
  245. },
  246. methods: {
  247. //通知内容
  248. looks(row) {
  249. this.look1 = true;
  250. this.details=row.msgContent;
  251. },
  252. /** 选择消息接收人员 */
  253. handleMsgUser(row) {
  254. this.$router.push("/home/personal/messages/receiver/" + row.msgId);
  255. },
  256. /** 查询系统消息列表 */
  257. getList() {
  258. this.loading = true;
  259. listMsg(this.queryParams).then(response => {
  260. this.msgList = response.rows;
  261. this.total = response.total;
  262. this.loading = false;
  263. });
  264. },
  265. // 取消按钮
  266. cancel() {
  267. this.open = false;
  268. this.reset();
  269. },
  270. // 表单重置
  271. reset() {
  272. this.form = {
  273. msgId: null,
  274. msgTitle: null,
  275. msgType: 2, //消息类型为消息
  276. msgContent: null,
  277. msgAcceptType: null,
  278. msgAcceptSelect: null,
  279. msgAcceptList: null,
  280. createBy: null,
  281. createTime: null,
  282. updateBy: null,
  283. updateTime: null,
  284. remark: null,
  285. isDel: null
  286. };
  287. this.resetForm("form");
  288. },
  289. /** 搜索按钮操作 */
  290. handleQuery() {
  291. this.queryParams.pageNum = 1;
  292. this.getList();
  293. },
  294. /** 重置按钮操作 */
  295. resetQuery() {
  296. this.resetForm("queryForm");
  297. this.handleQuery();
  298. },
  299. // 多选框选中数据
  300. handleSelectionChange(selection) {
  301. this.ids = selection.map(item => item.msgId)
  302. this.single = selection.length !== 1
  303. this.multiple = !selection.length
  304. },
  305. /** 新增按钮操作 */
  306. handleAdd() {
  307. this.reset();
  308. this.open = true;
  309. this.title = "添加系统消息";
  310. },
  311. /** 修改按钮操作 */
  312. handleUpdate(row) {
  313. this.reset();
  314. const msgId = row.msgId || this.ids
  315. getMsg(msgId).then(response => {
  316. this.form = response.data;
  317. this.open = true;
  318. this.title = "修改系统消息";
  319. });
  320. },
  321. /** 提交按钮 */
  322. submitForm() {
  323. this.$refs["form"].validate(valid => {
  324. if (valid) {
  325. if (this.form.msgId != null) {
  326. updateMsg(this.form).then(response => {
  327. this.$modal.msgSuccess("修改成功");
  328. this.open = false;
  329. this.getList();
  330. });
  331. } else {
  332. addMsg(this.form).then(response => {
  333. this.$modal.msgSuccess("新增成功");
  334. this.open = false;
  335. this.getList();
  336. });
  337. }
  338. }
  339. });
  340. },
  341. /** 删除按钮操作 */
  342. handleDelete(row) {
  343. const msgIds = row.msgId || this.ids;
  344. this.$modal.confirm('是否确认删除系统消息编号为"' + msgIds + '"的数据项?').then(function() {
  345. return delMsg(msgIds);
  346. }).then(() => {
  347. this.getList();
  348. this.$modal.msgSuccess("删除成功");
  349. }).catch(() => {});
  350. },
  351. /** 导出按钮操作 */
  352. handleExport() {
  353. this.download('doc/msg/export', {
  354. ...this.queryParams
  355. }, `msg_${new Date().getTime()}.xlsx`)
  356. }
  357. },
  358. };
  359. </script>
  360. <style scoped lang='scss'>
  361. .containe {
  362. color: #7ea4c8;
  363. font-size: 0.14rem;
  364. font-family: PingFang SC-Medium, PingFang SC;
  365. font-weight: 500;
  366. padding-left: calc(100vw * (20 / 1920));
  367. //顶部信息
  368. .mains {
  369. width: calc(100vw * (1876 / 1920));
  370. height: calc(100vh * (950 / 1080));
  371. margin-top: calc(100vh * (30 / 1080));
  372. // background: salmon;
  373. background: url(../../../assets/img/Group-610.png);
  374. background-size: calc(100vw * (1876 / 1920)) calc(100vh * (950 / 1080));
  375. h3 {
  376. font-size: 0.2rem;
  377. color: #ffffffff;
  378. padding-top: calc(100vh * (27 / 1080));
  379. padding-left: calc(100vw * (30 / 1920));
  380. }
  381. .main-main {
  382. width: calc(100vw * (1845 / 1920));
  383. height: calc(100vh * (880 / 1080));
  384. margin-left: calc(100vw * (16 / 1920));
  385. margin-top: calc(100vh * (20 / 1080));
  386. // background: seagreen;
  387. .app-container {
  388. width: calc(100vw * (1845 / 1920));
  389. height: calc(100vh * (880 / 1080));
  390. padding: 0;
  391. }
  392. .main-main-top {
  393. margin-top: calc(100vh * (30 / 1080));
  394. height: calc(100vh * (50 / 1080));
  395. ::v-deep .el-form-item__label {
  396. color: #2e8aecff;
  397. }
  398. .reset1 {
  399. color: #2e8aecff;
  400. background: transparent;
  401. border: 1px solid #2e8aecff;
  402. }
  403. }
  404. //顶部搜索框样式
  405. ::v-deep .el-input__inner {
  406. background-color: transparent;
  407. border: 1px solid #01d1ffff;
  408. color: #ffffffcc;
  409. }
  410. //搜索刷新按钮颜色
  411. ::v-deep .el-button.is-circle {
  412. background: #006c9aff;
  413. color: white;
  414. }
  415. .mb8 {
  416. margin-top: calc(100vh * (30 / 1080));
  417. //按钮的样式
  418. ::v-deep .el-button--primary.is-plain,
  419. .el-button--success.is-plain.is-disabled,
  420. .el-button--danger.is-plain.is-disabled,
  421. .el-button--warning.is-plain,
  422. .el-button--success.is-plain,
  423. .el-button--danger.is-plain {
  424. background-color: #002a5cff;
  425. border: none;
  426. color: #2e8aec;
  427. }
  428. }
  429. .el-table {
  430. // width: calc(100vw * (1830 / 1920));
  431. height: calc(100vh * (660 / 1080));
  432. // margin-left: calc(100vw * (8 / 1920));
  433. border: 1px solid #006c9aff;
  434. overflow: auto;
  435. background: transparent;
  436. color: #7ea4c8;
  437. }
  438. //表格线条隐藏
  439. ::v-deep .el-table::before {
  440. height: 0;
  441. }
  442. ::v-deep .el-table th {
  443. background: #016c9aa6;
  444. color: #2e8aec;
  445. }
  446. ::v-deep .el-table tr {
  447. background: transparent;
  448. }
  449. ::v-deep .el-table tbody tr:hover > td {
  450. background-color: #016c9a78 !important;
  451. }
  452. ::v-deep .el-table td.el-table__cell {
  453. border-bottom: 1px solid #006c9aff;
  454. }
  455. ::v-deep .el-table th.el-table__cell.is-leaf {
  456. border-bottom: 1px solid #006c9aff;
  457. }
  458. }
  459. //滚动条样式
  460. ::-webkit-scrollbar {
  461. width: 3.5px;
  462. }
  463. ::-webkit-scrollbar-track {
  464. background-color: rgba(0, 0, 0, 0);
  465. }
  466. ::-webkit-scrollbar-thumb {
  467. background: #2e8aec;
  468. border-radius: 3px;
  469. }
  470. ::-webkit-scrollbar-thumb:hover {
  471. background: #2e8aec;
  472. }
  473. //表格底部
  474. .pagination-container {
  475. // width: calc(100vw * (1540 / 1920));
  476. height: calc(100vh * (50 / 1080));
  477. background: transparent;
  478. padding: 0 !important;
  479. margin: 0;
  480. margin-left: calc(100vw * (20 / 1920));
  481. margin-right: calc(100vw * (20 / 1920));
  482. margin-top: calc(100vh * (10 / 1080));
  483. }
  484. }
  485. }
  486. //新增/修改弹窗样式
  487. ::v-deep .el-dialog__title {
  488. color: white;
  489. }
  490. ::v-deep .el-dialog .el-form-item {
  491. margin-top: calc(100vw * (30 / 1920));
  492. }
  493. ::v-deep .el-upload-list__item:hover {
  494. background: #002659ff;
  495. }
  496. //弹窗底部按钮的位置
  497. ::v-deep .el-dialog__footer {
  498. padding: 0;
  499. }
  500. //弹窗关闭按钮
  501. ::v-deep .el-dialog__headerbtn {
  502. top: calc(100vh * (45 / 1080));
  503. right: calc(100vw * (20 / 1920));
  504. font-size: 20px;
  505. }
  506. ::v-deep .el-dialog5 {
  507. width: calc(100vw * (800 / 1920)) !important;
  508. height: calc(100vh * (950 / 1080)) !important;
  509. background: url(../../../assets/img/Group-585.png);
  510. background-size: calc(100vw * (800 / 1920)) calc(100vh * (950 / 1080));
  511. //上传弹窗位置高度
  512. ::v-deep .el-dialog:not(.is-fullscreen) {
  513. margin-top: 2vh !important;
  514. }
  515. //弹窗中间内容
  516. .el-dialog__body {
  517. // width: calc(100vw * (620 / 1920)) ;
  518. height: calc(100vh * (680 / 1080));
  519. margin-top: calc(100vh * (50 / 1080));
  520. margin-bottom: calc(100vh * (20 / 1080));
  521. padding-right: 50px;
  522. overflow: auto;
  523. }
  524. .el-dialog__header {
  525. padding-bottom: 0;
  526. }
  527. .el-form-item__label {
  528. color: #2e8aecff;
  529. }
  530. .el-upload__tip {
  531. font-size: 12px;
  532. color: #006c9aff;
  533. margin-top: 0px;
  534. }
  535. .el-upload-list__item {
  536. margin: 0;
  537. }
  538. .el-tag + .el-tag {
  539. margin-left: 10px;
  540. }
  541. .button-new-tag {
  542. margin-left: 10px;
  543. height: 32px;
  544. line-height: 30px;
  545. padding-top: 0;
  546. padding-bottom: 0;
  547. }
  548. .input-new-tag {
  549. width: 90px;
  550. margin-left: 10px;
  551. vertical-align: bottom;
  552. }
  553. }
  554. //新增弹窗通知内容样式
  555. ::v-deep .ql-snow .ql-stroke {
  556. stroke: #7ea4c8ff;
  557. }
  558. ::v-deep .ql-snow .ql-fill,
  559. .ql-snow .ql-stroke.ql-fill {
  560. fill: #7ea4c8ff;
  561. }
  562. ::v-deep .ql-snow .ql-picker {
  563. color: #7ea4c8ff;
  564. }
  565. ::v-deep .ql-editor {
  566. color: #7ea4c8ff;
  567. }
  568. ::v-deep .ql-editor.ql-blank::before {
  569. color: #7ea4c8ff;
  570. }
  571. ::v-deep .el-dialog .el-input .el-input__inner {
  572. background: transparent;
  573. border: 1px solid #006c9aff;
  574. }
  575. //弹窗下拉菜单样式
  576. ::v-deep .vue-treeselect__menu {
  577. background: #002a5cff !important;
  578. width: calc(100vw * (370 / 1920));
  579. color: #7ea4c8ff;
  580. }
  581. ::v-deep .vue-treeselect__option:hover {
  582. background: #01d1ff3b;
  583. }
  584. ::v-deep .vue-treeselect__option.vue-treeselect__option--highlight {
  585. background: #01d1ff3b;
  586. }
  587. //消息内容弹窗
  588. ::v-deep .el-dialog6 {
  589. width: calc(100vw * (800 / 1920)) !important;
  590. height: calc(100vh * (950 / 1080)) !important;
  591. background: url(../../../assets/img/Group-585.png);
  592. background-size: calc(100vw * (800 / 1920)) calc(100vh * (950 / 1080));
  593. .main {
  594. margin-top: calc(100vh * (40 / 1080));
  595. width: calc(100vw * (640 / 1920));
  596. height: calc(100vh * (690 / 1080));
  597. // background: salmon;
  598. color: #7ea4c8ff;
  599. overflow: auto;
  600. }
  601. }
  602. </style>