index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. <template>
  2. <fullscreen :fullscreen.sync="fullscreen" class="container">
  3. <div class="container-box">
  4. <toolList @iconCli='iconCli' :tooltit='tooltit'></toolList>
  5. <div class="search">
  6. <mySearch :searchList="searchList" @searchInfo="searchInfo"></mySearch>
  7. <el-button class="btn-check" size="medium" type="primary" @click="dialogCheck(1)">添加
  8. </el-button>
  9. </div>
  10. <div class="tabbox">
  11. <el-table height="calc(100% - 40px)" class="com-table" ref="multipleTable" :data="tableData"
  12. tooltip-effect="dark" size="small" border style="width: 100%" v-loading="loading">
  13. <el-table-column prop="noticeTitle" label="公告标题" width="120">
  14. </el-table-column>
  15. <el-table-column label="公告内容">
  16. <template slot-scope="scope">
  17. <el-tooltip class="item" effect="light" :content="scope.row.noticeContent" placement="bottom">
  18. <span class="tab-long">{{scope.row.noticeContent}}</span>
  19. </el-tooltip>
  20. </template>
  21. </el-table-column>
  22. <el-table-column prop="opName" label="发布姓名" width="100">
  23. <template slot-scope="scope">
  24. <span>{{$desensitization(scope.row.opName,1)}}</span>
  25. </template>
  26. </el-table-column>
  27. <el-table-column prop="deptName" label="发布部门">
  28. </el-table-column>
  29. <el-table-column prop="opTime" label="发布时间" width="140">
  30. </el-table-column>
  31. <el-table-column prop="stsDesc" label="状态">
  32. </el-table-column>
  33. <el-table-column prop="auditNo" label="审核工号">
  34. </el-table-column>
  35. <el-table-column prop="auditName" label="审核姓名">
  36. <template slot-scope="scope">
  37. <span>{{$desensitization(scope.row.auditName,1)}}</span>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="审核备注">
  41. <template slot-scope="scope">
  42. <el-tooltip class="item" effect="light" :content="scope.row.auditRemark" placement="bottom">
  43. <span class="tab-long">{{scope.row.auditRemark}}</span>
  44. </el-tooltip>
  45. </template>
  46. </el-table-column>
  47. <el-table-column prop="auditResultDesc" label="审核结果">
  48. </el-table-column>
  49. <el-table-column prop="auditTime" label="审核时间" width="140">
  50. </el-table-column>
  51. <el-table-column label="操作" width="160px" align="center" fixed="right">
  52. <template slot-scope="scope">
  53. <el-button size="mini" type="primary" @click="dialogCheck(2,scope.row)">查看</el-button>
  54. <el-button size="mini" v-if="scope.row.sts != 2" type="primary" @click="dialogCheck(3,scope.row)">修改</el-button>
  55. <el-button size="mini" v-if="scope.row.sts != 2" type="danger" @click="delLine(scope.row)">删除</el-button>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. <el-pagination class="pageBox" @current-change="currchange" layout="prev, pager, next" background
  60. :total="total">
  61. </el-pagination>
  62. </div>
  63. <el-dialog :title="titname + '公告'" :visible.sync="dialogStatus" width="50%" :close-on-press-escape="false"
  64. :show-close="true" :before-close="closedia" :destroy-on-close="true" :modal-append-to-body="false"
  65. :close-on-click-modal="false">
  66. <div v-loading="loading">
  67. <el-form :model="infolist" ref="infolist" :rules="rules" style="height: 50vh;overflow-y: scroll;">
  68. <div class="info-line">
  69. <el-form-item prop="noticeTitle">
  70. <span>公告标题</span>
  71. <el-input v-model="infolist.noticeTitle" placeholder="标题" :disabled="disableStatus"></el-input>
  72. </el-form-item>
  73. <el-form-item prop="opName">
  74. <span>发布姓名</span>
  75. <el-input v-model="infolist.opName" placeholder="姓名" disabled="disabled"></el-input>
  76. </el-form-item>
  77. </div>
  78. <div class="info-line" v-if="titname == '查看'">
  79. <el-form-item>
  80. <span>电话</span>
  81. <el-input v-model="infolist.phoneNo" placeholder="电话" disabled></el-input>
  82. </el-form-item>
  83. <el-form-item>
  84. <span>发布部门</span>
  85. <el-input v-model="infolist.deptName" placeholder="发布部门" disabled></el-input>
  86. </el-form-item>
  87. </div>
  88. <el-form-item prop="visiblec" class="info-line online">
  89. <span>可见部门</span>
  90. <deptTree class="tree" @treeCheck="treeCheck" :defaultList="defaultList" :type="depttype"></deptTree>
  91. </el-form-item>
  92. <el-form-item class="info-line online">
  93. <span>发布内容</span>
  94. <el-input :disabled="disableStatus" v-model="infolist.noticeContent" placeholder="发布内容" type="textarea" :rows="3"></el-input>
  95. </el-form-item>
  96. <div style="padding-left: 80px" v-if="!disableStatus">
  97. <myUpload @uploadBack="uploadBack" :fileInfo="fileInfo" :fileList="fileInfo.fileList"></myUpload>
  98. </div>
  99. <div style="padding:0 20px 0 100px" v-if="disableStatus">
  100. <uploadDown :datalist="datalist" :dialogStatus="uploadstatus"></uploadDown>
  101. </div>
  102. </el-form>
  103. <div slot="footer" class="dialog-footer myfooter">
  104. <el-button @click="dialogCli(2)" v-if="disableStatus">确 定</el-button>
  105. <el-button type="primary" @click="dialogCli(1)" v-if="!disableStatus">保 存</el-button>
  106. <el-button type="primary" @click="dialogCli(3)" v-if="!disableStatus">发 布</el-button>
  107. <el-button @click="dialogCli(2)">取 消</el-button>
  108. </div>
  109. </div>
  110. </el-dialog>
  111. <el-dialog title="公告查看" :visible.sync="dialogInfo" width="70%" :close-on-press-escape="false"
  112. :show-close="true" :before-close="closedia" :destroy-on-close="true" :modal-append-to-body="false"
  113. :close-on-click-modal="false" :fullscreen="true">
  114. <div style="height: calc(100vh - 180px);overflow-y: scroll;">
  115. <notiCheck :infolist="infolist" :datalist="datalist" :dialogInfo="dialogInfo"></notiCheck>
  116. </div>
  117. <div class="dialog-footer myfooter">
  118. <el-button @click="dialogInfo = false">确 定</el-button>
  119. <el-button @click="dialogInfo = false">取 消</el-button>
  120. </div>
  121. </el-dialog>
  122. </div>
  123. <myMessage :messTit='messTit' @closeMessage="closeMessage" :centerDialogVisible="centerDialogVisible" v-if="centerDialogVisible"></myMessage>
  124. </fullscreen>
  125. </template>
  126. <script>
  127. import myUpload from '../../../components/upload'
  128. import uploadDown from '../../../components/uploadDown'
  129. import mySearch from '../../../components/search'
  130. import toolList from '../../../components/toolList'
  131. import myMessage from "../../../components/myMessage.vue"
  132. import deptTree from "../../../components/deptTree.vue"
  133. import notiCheck from "../../../components/notiCheck.vue"
  134. export default {
  135. components: {
  136. myUpload,
  137. uploadDown,
  138. mySearch,
  139. toolList,
  140. myMessage,
  141. deptTree,
  142. notiCheck
  143. },
  144. data() {
  145. const noticeTitle = (rule, value, callback) => {
  146. if (!this.infolist.noticeTitle) {
  147. callback(new Error('不能为空'))
  148. } else {
  149. callback()
  150. }
  151. }
  152. const opName = (rule, value, callback) => {
  153. if (!this.infolist.opName) {
  154. callback(new Error('不能为空'))
  155. } else {
  156. callback()
  157. }
  158. }
  159. return {
  160. rules: {
  161. noticeTitle: [{
  162. required: true,
  163. trigger: 'blur',
  164. validator: noticeTitle
  165. }],
  166. opName: [{
  167. required: true,
  168. trigger: 'blur',
  169. validator: opName
  170. }],
  171. },
  172. tooltit: '公告管理',
  173. fullscreen: false,
  174. total: 0,
  175. pageSize: 1,
  176. tableData: [{}],
  177. dialogStatus: false,
  178. infolist: {},
  179. typeOptions: [],
  180. titname: '',
  181. disableStatus: false,
  182. fileList: [],
  183. visiblec: [],
  184. visibleList: [],
  185. attList: [],
  186. fileInfo: {
  187. limit: 10,
  188. url: '/sysmgr/noticeatt/upload',
  189. fileList: []
  190. },
  191. datalist: {
  192. url: '/sysmgr/noticeatt/downfile',
  193. type: 2,
  194. attList:[]
  195. },
  196. uploadstatus: false,
  197. userInfo: {},
  198. searchList: [{
  199. type: 'input',
  200. tit: '请输入标题',
  201. value: '',
  202. width: '32%'
  203. },
  204. {
  205. type: 'date',
  206. tit: '开始时间',
  207. value: '',
  208. width: '32%',
  209. },
  210. {
  211. type: 'date',
  212. tit: '结束时间',
  213. value: '',
  214. width: '32%',
  215. },
  216. ],
  217. params: {},
  218. centerDialogVisible: false,
  219. messTit: '',
  220. delid: '',
  221. loading:false,
  222. treeList: [],
  223. defaultList:[],
  224. depttype:0,
  225. dialogInfo:false
  226. }
  227. },
  228. methods: {
  229. treeCheck(v){
  230. this.treeList = v;
  231. },
  232. closedia() {
  233. this.infolist = {};
  234. this.dialogCli(2);
  235. this.dialogStatus = false;
  236. this.defaultList = [];
  237. this.dialogInfo = false;
  238. this.depttype = 0;
  239. },
  240. //搜索数据
  241. searchInfo(v) {
  242. this.params = {};
  243. v[0] ? this.params.noticeTitle = v[0] : '';
  244. v[1] ? this.params.opTimeFrom = this.$formatDate(v[1], "YYYY-MM-DD") : '';
  245. v[2] ? this.params.opTimeTo = this.$formatDate(v[2], "YYYY-MM-DD") : '';
  246. this.getList(this.params, this.pageSize);
  247. },
  248. //获取列表
  249. getList(v, n) {
  250. this.pageSize = n;
  251. let _this = this;
  252. this.tableData = [];
  253. this.loading = true;
  254. this.$http({
  255. url: "/sysmgr/cnotice/queryListByDept",
  256. method: "post",
  257. headers: {
  258. "Content-Type": "application/json",
  259. "page": '{"pageNo":"' + n + '","pageSize":"10"}'
  260. },
  261. data: v,
  262. }).then((res) => {
  263. this.tableData = res.data.data;
  264. this.total = res.data.totalRecord;
  265. this.loading = false;
  266. });
  267. },
  268. // 分页
  269. currchange(v) {
  270. this.pageSize = v;
  271. this.getList(this.params, this.pageSize);
  272. },
  273. //查看 修改 新增
  274. dialogCheck(v, n) {
  275. this.visiblec = [];
  276. this.infolist = {};
  277. this.defaultList = [];
  278. if (v === 1) {
  279. this.titname = '新建';
  280. this.getUser();
  281. this.depttype = 1;
  282. this.dialogStatus = true;
  283. this.disableStatus = false;
  284. return
  285. } else if (v === 2) {
  286. this.titname = '查看';
  287. } else if (v === 3) {
  288. this.dialogStatus = true;
  289. this.disableStatus = false;
  290. this.titname = '修改';
  291. this.loading = true;
  292. }
  293. this.infolist = Object.assign({}, n); //拷贝
  294. this.infolist.opName = this.$desensitization(this.infolist.opName,1);
  295. this.infolist.phoneNo = this.$desensitization(this.infolist.phoneNo,2);
  296. this.$http({
  297. url: "/sysmgr/cnotice/queryInfo",
  298. method: "post",
  299. headers: {
  300. "Content-Type": "application/json",
  301. },
  302. data: {
  303. noticeId: n.noticeId
  304. },
  305. }).then((res) => {
  306. this.datalist.attList = res.data.attList;
  307. this.uploadstatus = true;
  308. this.infolist.attList = res.data.attList;
  309. this.fileInfo.fileList = [];
  310. this.attList = [];
  311. this.treeList = res.data.deptList;
  312. if (v === 2) {
  313. this.dialogInfo = true;
  314. }
  315. if (res.data.attList) {
  316. res.data.attList.forEach(item => {
  317. this.fileInfo.fileList.push({
  318. name: item.fileName,
  319. url: '',
  320. id: item.id,
  321. fileName: item.fileName
  322. });
  323. this.attList.push({
  324. name: item.fileName,
  325. url: '',
  326. id: item.id,
  327. fileName: item.fileName
  328. });
  329. })
  330. }
  331. if (res.data.deptList) {
  332. res.data.deptList.forEach(item => {
  333. this.defaultList.push(item.deptCode);
  334. })
  335. }
  336. this.depttype = 1;
  337. this.loading = false;
  338. });
  339. },
  340. dialogCli(v) {
  341. this.datalist.attList = [];
  342. this.uploadstatus = false;
  343. if (v === 2) {
  344. this.fileInfo.fileList = [];
  345. this.infolist = {};
  346. this.dialogStatus = false;
  347. this.defaultList = [];
  348. this.depttype = 0;
  349. return
  350. }
  351. this.infolist.pubTime = this.$formatDate(new Date(), "YYYY-MM-DD");
  352. this.infolist.opTime = this.infolist.pubTime;
  353. if (this.titname === '新建') {
  354. this.submitInfo("/sysmgr/cnotice/save", v);
  355. } else if (this.titname === '修改') {
  356. this.submitInfo("/sysmgr/cnotice/update", v);
  357. }
  358. },
  359. submitInfo(u, v) {
  360. let _this = this;
  361. this.$refs.infolist.validate(valid => {
  362. if (valid) {
  363. this.infolist.sts = "0";
  364. this.infolist.stsDesc = "草稿";
  365. this.infolist.opNo = this.userInfo.loginNo;
  366. this.infolist.opName = this.userInfo.loginName;
  367. this.infolist.phoneNo = this.userInfo.phoneNo;
  368. if (v === 3) {
  369. this.infolist.sts = "1";
  370. this.infolist.stsDesc = "待审核";
  371. }
  372. let attList = [];
  373. for (let i = 0; i < this.attList.length; i++) {
  374. attList.push({
  375. id: this.attList[i].id,
  376. fileCode: this.attList[i].fileCode,
  377. fileName: this.attList[i].fileName,
  378. opName: this.attList[i].opName,
  379. opNo: this.attList[i].opNo,
  380. opTime: this.attList[i].opTime,
  381. noticeId: this.infolist.noticeId
  382. });
  383. }
  384. let list = [];
  385. this.$http({
  386. url: u,
  387. method: "post",
  388. headers: {
  389. "Content-Type": "application/json",
  390. },
  391. data: {
  392. noticeInfo: this.infolist,
  393. attList: attList,
  394. deptList: this.treeList
  395. },
  396. }).then((res) => {
  397. if (res.data.result === 1) {
  398. _this.$message({
  399. message: res.data.desc,
  400. type: 'error'
  401. });
  402. } else {
  403. _this.$message({
  404. message: '成功',
  405. type: 'success'
  406. });
  407. _this.fileInfo.fileList = [];
  408. _this.infolist = {};
  409. _this.dialogStatus = false;
  410. _this.getList(this.params, this.pageSize);
  411. _this.defaultList = [];
  412. _this.depttype = 0;
  413. }
  414. });
  415. }
  416. })
  417. },
  418. closeMessage(v) {
  419. this.centerDialogVisible = false;
  420. let _this = this;
  421. if (v === 1) {
  422. _this.$http({
  423. url: "/sysmgr/cnotice/del",
  424. method: "post",
  425. headers: {
  426. "Content-Type": "application/json",
  427. },
  428. data: {
  429. noticeInfo: {
  430. noticeId: this.delid
  431. }
  432. }
  433. }).then((res) => {
  434. if (res.data.result === 1) {
  435. _this.$message({
  436. message: res.data.desc,
  437. type: 'error'
  438. });
  439. } else {
  440. _this.$message({
  441. message: '删除成功',
  442. type: 'success'
  443. });
  444. _this.getList(this.params, this.pageSize);
  445. }
  446. });
  447. }
  448. },
  449. //删除
  450. delLine(v) {
  451. this.centerDialogVisible = true;
  452. this.messTit = '即将删除此条数据, 是否删除?';
  453. this.delid = v.noticeId;
  454. },
  455. //文件返回值
  456. uploadBack(v) {
  457. this.attList = v;
  458. },
  459. //功能栏
  460. iconCli(v) {
  461. if (v === 1) {
  462. this.getList(this.params, this.pageSize);
  463. }
  464. if (v === 2) {
  465. this.fullscreen = !this.fullscreen
  466. }
  467. },
  468. //获取部门
  469. getDepot() {
  470. this.$http({
  471. url: "/sysmgr/sysdept/queryList",
  472. method: "post",
  473. headers: {
  474. "Content-Type": "application/json",
  475. },
  476. data: {},
  477. }).then((res) => {
  478. this.typeOptions = res.data;
  479. });
  480. },
  481. getUser() {
  482. this.userInfo = JSON.parse(window.sessionStorage.userInfo);
  483. this.infolist = {};
  484. this.infolist.opNo = this.userInfo.loginNo;
  485. this.infolist.opName = this.userInfo.loginName;
  486. }
  487. },
  488. mounted() {
  489. this.getList(this.params, this.pageSize);
  490. this.getDepot();
  491. this.getUser();
  492. },
  493. created() {
  494. }
  495. }
  496. </script>
  497. <style scoped lang="scss">
  498. @import "../../../assets/style";
  499. .tab-long {
  500. height: 22px;
  501. float: left;
  502. overflow: hidden;
  503. text-overflow: ellipsis;
  504. display: -webkit-box;
  505. /* 将对象作为弹性伸缩盒子模型显示 */
  506. -webkit-line-clamp: 1;
  507. /* 控制最多显示几行 */
  508. -webkit-box-orient: vertical;
  509. /* 设置或检索伸缩盒对象的子元素的排列方式 */
  510. }
  511. .titbox {
  512. div {
  513. float: right;
  514. i {
  515. font-size: 22px;
  516. margin-left: 20px;
  517. cursor: pointer;
  518. }
  519. }
  520. }
  521. .tabbox {
  522. margin-top: 16px;
  523. font-size: 14px !important;
  524. }
  525. .pageBox {
  526. text-align: right;
  527. margin-top: 10px;
  528. }
  529. .info-line {
  530. width: 100%;
  531. display: block;
  532. padding-left: 20px;
  533. div {
  534. width: 50%;
  535. display: inline-block;
  536. }
  537. span {
  538. width: 80px;
  539. display: inline-block;
  540. text-align: left;
  541. i {
  542. color: red;
  543. display: inline-block;
  544. padding-right: 5px;
  545. }
  546. }
  547. .el-select,
  548. .el-input {
  549. width: calc(100% - 100px);
  550. }
  551. .tree{
  552. width: calc(100% - 100px);
  553. }
  554. }
  555. .online {
  556. width: 100%;
  557. .el-select {
  558. width: calc(100% - 100px);
  559. }
  560. span {
  561. vertical-align: top;
  562. }
  563. .el-textarea {
  564. width: calc(100% - 100px);
  565. }
  566. }
  567. ::v-deep .el-table--mini, .el-table--small, .el-table__expand-icon{
  568. font-size: 14px;
  569. }
  570. </style>