NoticeView.vue 17 KB

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