copyIndex.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  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="knowledgeTitle" label="标题">
  14. </el-table-column>
  15. <el-table-column label="发布工号">
  16. <template slot-scope="scope">
  17. <span class="">{{scope.row.opNo}}</span>
  18. </template>
  19. </el-table-column>
  20. <el-table-column label="发布姓名">
  21. <template slot-scope="scope">
  22. <span>{{$desensitization(scope.row.opName,1)}}</span>
  23. </template>
  24. </el-table-column>
  25. <el-table-column prop="pubDeptName" label="发布部门">
  26. </el-table-column>
  27. <el-table-column prop="pubTypeName" label="发布类型">
  28. </el-table-column>
  29. <el-table-column prop="pubTime" label="发布时间">
  30. </el-table-column>
  31. <el-table-column prop="stsDesc" label="状态">
  32. </el-table-column>
  33. <el-table-column label="操作" width="160px" align="center">
  34. <template slot-scope="scope">
  35. <el-button size="mini" type="primary" @click="dialogCheck(2,scope.row)">查看</el-button>
  36. <el-button size="mini" v-if="scope.row.sts != 1" type="primary"
  37. @click="dialogCheck(3,scope.row)">修改</el-button>
  38. <el-button size="mini" v-if="scope.row.sts != 1" type="danger" @click="delLine(scope.row)">
  39. 删除</el-button>
  40. </template>
  41. </el-table-column>
  42. </el-table>
  43. <el-pagination class="pageBox" @current-change="currchange" layout="prev, pager, next" background
  44. :total="total">
  45. </el-pagination>
  46. </div>
  47. <el-dialog :title="titname + '知识'" :visible.sync="dialogStatus" width="50%" :close-on-press-escape="false"
  48. :show-close="true" :before-close="closedia" :destroy-on-close="true" :modal-append-to-body="false"
  49. :close-on-click-modal="false">
  50. <div v-loading="loadinged">
  51. <el-form :model="infolist" style="height: 50vh;overflow-y: scroll;" ref="infolist" :rules="rules">
  52. <div class="info-line">
  53. <el-form-item prop="knowledgeTitle">
  54. <span>标题</span>
  55. <el-input v-model="infolist.knowledgeTitle" placeholder="标题" :disabled="disableStatus">
  56. </el-input>
  57. </el-form-item>
  58. <el-form-item prop="pubType">
  59. <span>发布类型</span>
  60. <el-select :popper-append-to-body="false" v-model="infolist.pubType" placeholder="发布类型"
  61. clearable :disabled="disableStatus" @change="verifcheck(1)">
  62. <el-option v-for="item in knowledge.type.options" :key="item.dataCode"
  63. :label="item.dataName" :value="item.dataCode">
  64. </el-option>
  65. </el-select>
  66. </el-form-item>
  67. </div>
  68. <div v-if="titname == '查看'">
  69. <div class="info-line">
  70. <el-form-item prop="opName">
  71. <span>发布姓名</span>
  72. <el-input v-model="infolist.opName" placeholder="发布姓名" disabled="disabled">
  73. </el-input>
  74. </el-form-item>
  75. <el-form-item prop="opNo">
  76. <span>发布工号</span>
  77. <el-input v-model="infolist.opNo" placeholder="发布工号" disabled="disabled"></el-input>
  78. </el-form-item>
  79. </div>
  80. <el-form-item class="info-line online">
  81. <span>发布部门</span>
  82. <el-input v-model="infolist.pubDeptName" placeholder="发布部门" disabled></el-input>
  83. </el-form-item>
  84. </div>
  85. <el-form-item prop="visiblec" class="info-line online">
  86. <span>可见部门</span>
  87. <deptTree class="tree" @treeCheck="treeCheck" :defaultList="defaultList" :type="depttype"></deptTree>
  88. </el-form-item>
  89. <el-form-item class="info-line online" v-if="titname != '新建'">
  90. <span>备注</span>
  91. <el-input disabled v-model="infolist.auditDesc" placeholder="备注" type="textarea" :rows="3">
  92. </el-input>
  93. </el-form-item>
  94. <div style="padding-left: 80px" v-if="!disableStatus">
  95. <myUpload @uploadBack="uploadBack" :fileInfo="fileInfo" :fileList="fileInfo.fileList">
  96. </myUpload>
  97. </div>
  98. <div style="padding:0 20px 10px 100px" v-if="disableStatus">
  99. <uploadDown :datalist="datalist" :dialogStatus="uploadstatus"></uploadDown>
  100. </div>
  101. </el-form>
  102. <div class="dialog-footer myfooter">
  103. <el-button @click="dialogCli(2)" v-if="disableStatus">确 定</el-button>
  104. <el-button type="primary" @click="dialogCli(1)" v-if="!disableStatus">保 存</el-button>
  105. <el-button type="primary" @click="dialogCli(3)" v-if="!disableStatus">发 布</el-button>
  106. <el-button @click="dialogCli(2)">取 消</el-button>
  107. </div>
  108. </div>
  109. </el-dialog>
  110. <myMessage :messTit='messTit' @closeMessage="closeMessage" :centerDialogVisible="centerDialogVisible"
  111. v-if="centerDialogVisible"></myMessage>
  112. </div>
  113. </fullscreen>
  114. </template>
  115. <script>
  116. import myUpload from '../../../components/upload'
  117. import uploadDown from '../../../components/uploadDown'
  118. import mySearch from '../../../components/search'
  119. import toolList from '../../../components/toolList'
  120. import myMessage from "../../../components/myMessage.vue"
  121. import deptTree from "../../../components/deptTree.vue"
  122. export default {
  123. components: {
  124. myUpload,
  125. uploadDown,
  126. mySearch,
  127. toolList,
  128. myMessage,
  129. deptTree
  130. },
  131. data() {
  132. const knowledgeTitle = (rule, value, callback) => {
  133. if (!this.infolist.knowledgeTitle) {
  134. callback(new Error('不能为空'))
  135. } else {
  136. callback()
  137. }
  138. }
  139. const opName = (rule, value, callback) => {
  140. if (!this.infolist.opName) {
  141. callback(new Error('不能为空'))
  142. } else {
  143. callback()
  144. }
  145. }
  146. const pubType = (rule, value, callback) => {
  147. if (!this.infolist.pubType) {
  148. callback(new Error('不能为空'))
  149. } else {
  150. callback()
  151. }
  152. }
  153. const opNo = (rule, value, callback) => {
  154. if (!this.infolist.opNo) {
  155. callback(new Error('不能为空'))
  156. } else {
  157. callback()
  158. }
  159. }
  160. return {
  161. rules: {
  162. opNo: [{
  163. required: true,
  164. trigger: 'blur',
  165. validator: opNo
  166. }],
  167. pubType: [{
  168. required: true,
  169. trigger: 'change',
  170. validator: pubType
  171. }],
  172. opName: [{
  173. required: true,
  174. trigger: 'blur',
  175. validator: opName
  176. }],
  177. knowledgeTitle: [{
  178. required: true,
  179. trigger: 'blur',
  180. validator: knowledgeTitle
  181. }],
  182. },
  183. tooltit: '知识库管理',
  184. fileInfo: {
  185. limit: 5,
  186. url: '/market/cknowledgeatt/upload',
  187. fileList: []
  188. },
  189. fullscreen: false,
  190. total: 0,
  191. pageSize: 1,
  192. knowledge: {
  193. type: {
  194. value: '',
  195. options: []
  196. },
  197. startime: null,
  198. endtime: null,
  199. },
  200. tableData: [],
  201. dialogStatus: false,
  202. infolist: {},
  203. typeOptions: [],
  204. titname: '',
  205. disableStatus: false,
  206. fileList: [],
  207. visiblec: [],
  208. visibleList: [],
  209. attList: [],
  210. datalist: {
  211. url: '/market/compatt/downfile',
  212. type: 1
  213. },
  214. uploadstatus: false,
  215. userInfo: {},
  216. searchList: [{
  217. type: 'sel',
  218. tit: '发布类型',
  219. value: '',
  220. width: '19%',
  221. options: []
  222. },
  223. {
  224. type: 'input',
  225. tit: '发布标题',
  226. value: '',
  227. width: '19%',
  228. },
  229. {
  230. type: 'date',
  231. tit: '开始时间',
  232. value: '',
  233. width: '19%',
  234. },
  235. {
  236. type: 'date',
  237. tit: '结束时间',
  238. value: '',
  239. width: '19%',
  240. },
  241. {
  242. type: 'input',
  243. tit: '关键字',
  244. value: '',
  245. width: '19%',
  246. },
  247. ],
  248. params: {},
  249. centerDialogVisible: false,
  250. messTit: '',
  251. delid: '',
  252. loading: false,
  253. loadinged: false,
  254. treeList: [],
  255. defaultList:[],
  256. depttype:0,
  257. }
  258. },
  259. methods: {
  260. treeCheck(v){
  261. this.treeList = v;
  262. },
  263. closedia() {
  264. this.infolist = {};
  265. this.dialogStatus = false;
  266. this.fileInfo.fileList = [];
  267. this.defaultList = [];
  268. this.depttype = 0;
  269. },
  270. uploadBack(v) {
  271. this.attList = v;
  272. },
  273. //搜索数据
  274. searchInfo(v) {
  275. this.params = {};
  276. v[0] ? this.params.pubType = v[0] : '';
  277. v[1] ? this.params.knowledgeTitle = v[1] : '';
  278. v[2] ? this.params.opTimeFrom = this.$formatDate(v[2], "YYYY-MM-DD") : '';
  279. v[3] ? this.params.opTimeTo = this.$formatDate(v[3], "YYYY-MM-DD") : '';
  280. if (v[4]) {
  281. this.params = {};
  282. this.params.keyWord = v[4]
  283. }
  284. this.getList(this.params, this.pageSize);
  285. },
  286. //获取列表
  287. getList(v, n) {
  288. this.pageSize = n;
  289. let _this = this;
  290. this.loading = true;
  291. this.tableData = [];
  292. this.$http({
  293. url: "/market/cknowledge/queryListByPubDept",
  294. method: "post",
  295. headers: {
  296. "Content-Type": "application/json",
  297. "page": '{"pageNo":"' + n + '","pageSize":"10"}'
  298. },
  299. data: v,
  300. }).then((res) => {
  301. this.tableData = res.data.data;
  302. this.total = res.data.totalRecord;
  303. this.loading = false;
  304. });
  305. },
  306. //获取部门
  307. getDepot() {
  308. this.$http({
  309. url: "/sysmgr/sysdept/queryList",
  310. method: "post",
  311. headers: {
  312. "Content-Type": "application/json",
  313. },
  314. data: {},
  315. }).then((res) => {
  316. this.typeOptions = res.data;
  317. });
  318. },
  319. //字典类型
  320. getListype(v) {
  321. this.$http({
  322. url: "/market/mkKnowledgePubMsgType/queryList",
  323. method: "post",
  324. headers: {
  325. "Content-Type": "application/json",
  326. },
  327. data: {
  328. dictCode: 'pubType'
  329. },
  330. }).then((res) => {
  331. let listopt = [];
  332. res.data.forEach(item => {
  333. listopt.push({
  334. dataCode: item.id,
  335. dataName: item.pubType,
  336. })
  337. })
  338. this.searchList[0].options = listopt;
  339. this.knowledge.type.options = listopt;
  340. });
  341. },
  342. //功能栏
  343. iconCli(v) {
  344. if (v === 1) {
  345. this.getList(this.params, this.pageSize);
  346. }
  347. if (v === 2) {
  348. this.fullscreen = !this.fullscreen
  349. }
  350. },
  351. // 分页
  352. currchange(v) {
  353. this.pageSize = v;
  354. this.getList(this.params, this.pageSize);
  355. },
  356. //查看 修改 新增
  357. dialogCheck(v, n) {
  358. this.dialogStatus = true;
  359. this.disableStatus = false;
  360. this.visiblec = [];
  361. this.defaultList = [];
  362. this.infolist = {};
  363. if (v === 1) {
  364. this.titname = '新建';
  365. this.infolist = {};
  366. this.defaultList = [];
  367. this.depttype = 0;
  368. this.getUser();
  369. return
  370. } else if (v === 2) {
  371. this.titname = '查看';
  372. this.disableStatus = true;
  373. } else if (v === 3) {
  374. this.titname = '修改';
  375. this.loadinged = true;
  376. }
  377. this.$http({
  378. url: "/market/cknowledge/queryInfo",
  379. method: "post",
  380. headers: {
  381. "Content-Type": "application/json",
  382. },
  383. data: {
  384. id: n.id
  385. },
  386. }).then((res) => {
  387. res.data.opName = this.$desensitization(res.data.opName,1);
  388. this.datalist.attList = res.data.attList;
  389. this.uploadstatus = true;
  390. this.infolist = res.data;
  391. this.fileInfo.fileList = [];
  392. this.attList = [];
  393. this.treeList = this.infolist.visibleList;
  394. res.data.attList.forEach(item => {
  395. this.fileInfo.fileList.push({
  396. name: item.fileName,
  397. url: '',
  398. id: item.id,
  399. fileName: item.fileName,
  400. fileCode: item.fileCode,
  401. opName: item.opName,
  402. opNo: item.opNo,
  403. opTime: item.opTime,
  404. });
  405. this.attList.push({
  406. name: item.fileName,
  407. url: '',
  408. id: item.id,
  409. fileName: item.fileName,
  410. fileCode: item.fileCode,
  411. opName: item.opName,
  412. opNo: item.opNo,
  413. opTime: item.opTime,
  414. });
  415. })
  416. res.data.visibleList.forEach(item => {
  417. this.defaultList.push(item.deptId);
  418. })
  419. this.depttype = 2;
  420. this.loadinged = false;
  421. });
  422. },
  423. //添加 修改
  424. dialogCli(v) {
  425. this.uploadstatus = false;
  426. this.datalist.attList = [];
  427. this.fileInfo.fileList = [];
  428. if (v === 2) {
  429. this.getUser();
  430. this.dialogStatus = false;
  431. this.defaultList = [];
  432. this.depttype = 0;
  433. return
  434. }
  435. this.infolist.pubTime = this.$formatDate(new Date(), "YYYY-MM-DD");
  436. if (this.titname === '新建') {
  437. this.submitInfo("/market/cknowledge/save", v);
  438. } else if (this.titname === '修改') {
  439. this.submitInfo("/market/cknowledge/update", v);
  440. }
  441. },
  442. submitInfo(u, v) {
  443. let _this = this;
  444. this.$refs.infolist.validate(valid => {
  445. if (valid) {
  446. this.infolist.sts = "0";
  447. this.infolist.stsDesc = "草稿";
  448. this.infolist.opNo = this.userInfo.loginNo;
  449. this.infolist.opName = this.userInfo.loginName;
  450. this.infolist.contactPhone = this.userInfo.phoneNo;
  451. if (v === 3) {
  452. this.infolist.sts = "2";
  453. this.infolist.stsDesc = "待审核";
  454. }
  455. let attList = [];
  456. for (let i = 0; i < this.attList.length; i++) {
  457. attList.push({
  458. id: this.attList[i].id,
  459. fileCode: this.attList[i].fileCode,
  460. fileName: this.attList[i].fileName,
  461. opName: this.attList[i].opName,
  462. opNo: this.attList[i].opNo,
  463. opTime: this.attList[i].opTime,
  464. });
  465. }
  466. this.loadinged = true;
  467. this.$http({
  468. url: u,
  469. method: "post",
  470. headers: {
  471. "Content-Type": "application/json",
  472. },
  473. data: {
  474. knowledge: this.infolist,
  475. attList: attList,
  476. visibleList: this.treeList
  477. },
  478. }).then((res) => {
  479. this.loadinged = false;
  480. if (res.data.result === 1) {
  481. _this.$message({
  482. message: res.data.desc,
  483. type: 'error'
  484. });
  485. } else {
  486. _this.$message({
  487. message: '成功',
  488. type: 'success'
  489. });
  490. _this.fileInfo.fileList = [];
  491. _this.infolist = {};
  492. _this.dialogStatus = false;
  493. _this.getList(_this.params, _this.pageSize);
  494. _this.defaultList = [];
  495. _this.depttype = 0;
  496. }
  497. })
  498. }
  499. })
  500. },
  501. //处理所需数据
  502. verifcheck(v) {
  503. if (v === 1) {
  504. for (let i = 0; i < this.knowledge.type.options.length; i++) {
  505. if (this.knowledge.type.options[i].dataCode == this.infolist.pubType) {
  506. this.infolist.pubTypeName = this.knowledge.type.options[i].dataName
  507. }
  508. }
  509. }
  510. },
  511. closeMessage(v) {
  512. this.centerDialogVisible = false;
  513. let _this = this;
  514. if (v === 1) {
  515. this.$http({
  516. url: "/market/cknowledge/queryInfo",
  517. method: "post",
  518. headers: {
  519. "Content-Type": "application/json",
  520. },
  521. data: {
  522. id: this.delid
  523. },
  524. }).then((res) => {
  525. let attList = [];
  526. for (let i = 0; i < res.data.attList.length; i++) {
  527. attList.push({
  528. id: res.data.attList[i].id
  529. })
  530. }
  531. _this.$http({
  532. url: "/market/cknowledge/delete",
  533. method: "post",
  534. headers: {
  535. "Content-Type": "application/json",
  536. },
  537. data: {
  538. knowledge: {
  539. id: this.delid
  540. },
  541. attList: attList,
  542. visibleList: res.data.visibleList
  543. }
  544. }).then((res) => {
  545. if (res.data.result === 1) {
  546. _this.$message({
  547. message: res.data.desc,
  548. type: 'error'
  549. });
  550. } else {
  551. _this.$message({
  552. message: '删除成功',
  553. type: 'success'
  554. });
  555. _this.getList(this.params, this.pageSize);
  556. }
  557. });
  558. });
  559. }
  560. },
  561. //删除
  562. delLine(v) {
  563. this.centerDialogVisible = true;
  564. this.messTit = '即将删除此条数据, 是否删除?';
  565. this.delid = v.id;
  566. },
  567. getUser() {
  568. this.userInfo = JSON.parse(window.sessionStorage.userInfo);
  569. this.infolist = {};
  570. this.infolist.opNo = this.userInfo.loginNo;
  571. // this.infolist.pubDeptId = this.userInfo.group;
  572. // this.infolist.pubDeptName = this.userInfo.groupName;
  573. this.infolist.opName = this.userInfo.loginName;
  574. this.infolist.contactPhone = this.userInfo.phoneNo;
  575. },
  576. },
  577. mounted() {
  578. this.getList(this.params, this.pageSize);
  579. this.getDepot();
  580. this.getListype();
  581. this.getUser();
  582. },
  583. created() {
  584. }
  585. }
  586. </script>
  587. <style scoped lang="scss">
  588. @import "../../../assets/style";
  589. .iconfont {
  590. font-size: 42px;
  591. }
  592. .icon-excel {
  593. color: #67DB63;
  594. }
  595. .icon-word {
  596. color: #FF654E;
  597. }
  598. .icon-ppt {
  599. color: #FF8943;
  600. }
  601. .icon-wenjian {
  602. color: #ccc;
  603. }
  604. .el-icon-picture {
  605. font-size: 36px;
  606. color: #ccc;
  607. background: #fff;
  608. padding: 4px 2px;
  609. margin-bottom: 2px;
  610. }
  611. .back-box {
  612. margin-top: 20px;
  613. background: #F2F2F2;
  614. padding: 20px;
  615. div {
  616. display: inline-block;
  617. text-align: center;
  618. margin-right: 20px;
  619. cursor: pointer;
  620. span {
  621. display: block;
  622. width: 80px;
  623. overflow: hidden;
  624. padding-top: 10px;
  625. margin: 0 10px;
  626. overflow: hidden;
  627. text-overflow: ellipsis;
  628. display: -webkit-box;
  629. /* 将对象作为弹性伸缩盒子模型显示 */
  630. -webkit-line-clamp: 1;
  631. /* 控制最多显示几行 */
  632. -webkit-box-orient: vertical;
  633. /* 设置或检索伸缩盒对象的子元素的排列方式 */
  634. }
  635. }
  636. }
  637. .titbox {
  638. div {
  639. float: right;
  640. i {
  641. font-size: 22px;
  642. margin-left: 20px;
  643. cursor: pointer;
  644. }
  645. }
  646. }
  647. .tabbox {
  648. margin-top: 15px;
  649. }
  650. .pageBox {
  651. text-align: right;
  652. margin-top: 10px;
  653. }
  654. .info-line {
  655. width: 100%;
  656. display: block;
  657. padding-left: 20px;
  658. div {
  659. width: 50%;
  660. display: inline-block;
  661. }
  662. span {
  663. width: 80px;
  664. display: inline-block;
  665. text-align: left;
  666. i {
  667. color: red;
  668. display: inline-block;
  669. padding-right: 5px;
  670. }
  671. }
  672. .el-select,
  673. .el-input {
  674. width: calc(100% - 100px);
  675. }
  676. .tree{
  677. width: calc(100% - 100px);
  678. }
  679. }
  680. .online {
  681. width: 100%;
  682. .el-select {
  683. width: calc(100% - 100px);
  684. }
  685. span {
  686. vertical-align: top;
  687. }
  688. .el-textarea {
  689. width: calc(100% - 100px);
  690. }
  691. }
  692. </style>