iam-audit-home-view.vue 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435
  1. <template>
  2. <a-layout :class="$style.layout">
  3. <sd-header>
  4. <template>
  5. <span :class="[$style.handleBtn, $style.printNone]">
  6. <span @click="close"><a-icon type="close-circle"></a-icon> 退出 </span>
  7. </span>
  8. </template>
  9. </sd-header>
  10. <a-layout-content :class="$style.layoutContent">
  11. <a-card :class="$style.bgcolor">
  12. <div :class="$style.newsMain">
  13. <div :class="$style.knowLedage">
  14. <div :class="$style.klArticle">
  15. <a-row type="flex">
  16. <a-col flex="1 1 200px">
  17. <div :class="$style.leftContent">
  18. <a-skeleton v-if="!isAlertShow" active />
  19. <div v-else :class="$style.articeText">
  20. <h3>{{ news.title }}</h3>
  21. <div :class="$style.infos">
  22. <span>日期:{{ news.creationTime | sdDateFormat('YYYY-MM-DD') }}</span>
  23. <span>来源:{{ news.creatorName }}</span>
  24. <span
  25. >阅读次数:<a @click="gotoReaderList">{{ docReadNumber }}</a></span
  26. >
  27. </div>
  28. <div v-if="news.type === 1" :class="$style.content">
  29. <!-- eslint-disable-next-line vue/no-v-html -->
  30. <div v-html="news.content"></div>
  31. </div>
  32. <div v-else-if="news.onlinePreview === '0'" :class="$style.content">
  33. <p v-html="news.abstractMessage"></p>
  34. </div>
  35. <div v-else :class="$style.files">
  36. <sd-wps-reader
  37. v-if="attachments.length > 0"
  38. :key="clickChange ? changeCode : attachments[0].code"
  39. :class="$style.wpsread"
  40. :code="clickChange ? changeCode : attachments[0].code"
  41. />
  42. </div>
  43. <div v-if="news.onlinePreview === '0'">
  44. <div
  45. v-for="(item, index) in attachments"
  46. :key="index"
  47. :class="$style.files"
  48. >
  49. <div :class="$style.filesName">附件:{{ item.name }}</div>
  50. <div :class="$style.filesBtn">
  51. <a
  52. :download="item.name"
  53. :href="
  54. `api/flow-mobile/v1/task-form-process/download-attachments/${item.code}`
  55. | sdResource
  56. "
  57. @click="attachmentRecord(item.name, item.code)"
  58. >下载</a
  59. >
  60. &nbsp;&nbsp;&nbsp;
  61. <a :download="item.name" @click.prevent="previewAttachment(item)"
  62. >查看</a
  63. >
  64. </div>
  65. </div>
  66. </div>
  67. <a-divider />
  68. <!-- <div :class="$style.klOperation">
  69. <span
  70. :class="isClick === 'dz' ? $style.isActive : ''"
  71. @click="handleLike('dz')"
  72. >
  73. <a-badge :class="$style.drage" :count="badgeCount">
  74. <a-icon type="like" :theme="flag ? 'filled' : 'outlined'" /> </a-badge
  75. >点赞
  76. </span>
  77. </div> -->
  78. </div>
  79. <!-- <div id="divId" :class="$style.comment">
  80. <a-skeleton v-if="!isAlertShow" active />
  81. <a-tabs v-else default-active-key="1" @change="callback">
  82. <a-tab-pane key="1" tab="点评">
  83. <div :class="$style.plContent">
  84. <a-comment>
  85. <a-avatar
  86. slot="avatar"
  87. icon="user"
  88. :src="
  89. `api/mobile/v1/user-manager/userAvatar/${currentUser}`
  90. | sdResource
  91. "
  92. />
  93. <div slot="content">
  94. <a-form>
  95. <a-form-item :class="$style.commentText">
  96. <a-textarea
  97. ref="textarea"
  98. v-model="commentValue"
  99. placeholder="发表您的评价或意见建议!"
  100. :max-length="1000"
  101. :rows="4"
  102. @input="handleChange"
  103. />
  104. </a-form-item>
  105. <a-form-item :class="$style.commentScore">
  106. <div :class="$style.publish">
  107. <span :class="$style.textNum"
  108. >还可以输入<em>{{ still }}</em
  109. >字</span
  110. >
  111. <a-button
  112. html-type="submit"
  113. :loading="submitting"
  114. type="primary"
  115. @click="handleSubmit"
  116. >
  117. 发表
  118. </a-button>
  119. </div>
  120. </a-form-item>
  121. </a-form>
  122. </div>
  123. </a-comment>
  124. <div v-if="comments.length === 0" :class="$style.noComment"
  125. >暂无评论</div
  126. >
  127. <a-list
  128. v-if="comments.length"
  129. :class="$style.commentList"
  130. :data-source="comments"
  131. item-layout="horizontal"
  132. >
  133. <div v-if="showLoadingMore" slot="loadMore" :class="$style.moredata">
  134. <a-spin v-if="loadingMore" />
  135. <div @click="clickMore">
  136. 查看更多
  137. <a-icon type="right" />
  138. </div>
  139. </div>
  140. <div v-else :class="$style.moredata">到底了,没有更多数据了</div>
  141. <a-list-item slot="renderItem" slot-scope="item">
  142. <a-comment>
  143. <a slot="author">{{ item.creatorName }}</a>
  144. <a-avatar
  145. slot="avatar"
  146. icon="user"
  147. :src="
  148. `api/mobile/v1/user-manager/userAvatar/${item.creatorAccount}`
  149. | sdResource
  150. "
  151. />
  152. <p slot="content">
  153. {{ item.commentContent }}
  154. </p>
  155. <span slot="datetime">{{
  156. moment(item.creationTime).format('YYYY-MM-DD HH:mm:ss')
  157. }}</span>
  158. </a-comment>
  159. </a-list-item>
  160. </a-list>
  161. </div>
  162. </a-tab-pane>
  163. <a-tab-pane key="3" tab="访问">
  164. <div v-if="spin" :class="$style.example">
  165. <a-spin />
  166. </div>
  167. <div v-else>
  168. <a-empty v-if="visitRecordData.length === 0" />
  169. <a-table
  170. v-else
  171. bordered
  172. :columns="columnsVisit"
  173. :data-source="visitRecordData"
  174. :pagination="pagination1"
  175. >
  176. <template slot="firstSeen" slot-scope="firstSeen">
  177. {{ moment(firstSeen).format('YYYY-MM-DD HH:mm:ss') }}
  178. </template>
  179. <template slot="lastSeen" slot-scope="lastSeen">
  180. {{ moment(lastSeen).format('YYYY-MM-DD HH:mm:ss') }}
  181. </template>
  182. </a-table>
  183. </div>
  184. </a-tab-pane>
  185. </a-tabs>
  186. </div> -->
  187. </div>
  188. </a-col>
  189. <!-- <a-col flex="0 1 350px">
  190. <div :class="$style.rightContent">
  191. <a-skeleton v-if="!isAlertShow" active />
  192. <div v-else :class="$style.articleInfo">
  193. <p :class="$style.title">文档信息</p>
  194. <a-divider />
  195. <div :class="$style.userInfo">
  196. <div :class="$style.user">
  197. <p>上传者</p>
  198. <a-row :class="$style.userImg" type="flex">
  199. <a-col flex="80px">
  200. <a-avatar
  201. :class="$style.userinfo"
  202. icon="user"
  203. :size="65"
  204. :src="
  205. `api/mobile/v1/user-manager/userAvatar/${news.creatorAccount}`
  206. | sdResource
  207. "
  208. alt="avatar"
  209. />
  210. </a-col>
  211. <a-col flex="auto">
  212. <p :class="$style.username">{{ news.creatorName }}</p>
  213. <p>{{ news.createDeptName }}</p>
  214. </a-col>
  215. </a-row>
  216. <a-divider />
  217. </div>
  218. <div :class="$style.userNum">
  219. <span><a-icon type="sd-message" />{{ news.commentNumber }}</span>
  220. <span><a-icon type="share-alt" />{{ news.recommendNumber }}</span>
  221. <span><a-icon type="sd-eye" />{{ news.readNumber }}</span>
  222. </div>
  223. </div>
  224. <div :class="$style.infos">
  225. <p v-if="news.type === 0" :class="$style.edition"
  226. ><i>版本</i>:<span>{{ news.versionNum }}</span></p
  227. >
  228. <p :class="$style.type"
  229. ><i>分类</i>:<span>{{
  230. categoryrArr.map((item) => item.categoryName).join(' 、')
  231. }}</span></p
  232. >
  233. <p :class="$style.labels"
  234. ><i>标签</i>:<span>{{
  235. labelArr.map((item) => item.name).join(' 、')
  236. }}</span></p
  237. >
  238. <p v-if="news.type === 0" :class="$style.field"
  239. >业务领域:<span>{{
  240. businessAreaArr.map((item) => item.name).join(' 、')
  241. }}</span></p
  242. >
  243. <p
  244. v-if="news.onlinePreview === '1' && news.type === 0"
  245. :class="$style.abstract"
  246. ><i>摘要</i>:<span>{{ news.abstractMessage }}</span></p
  247. >
  248. </div>
  249. </div>
  250. <a-skeleton v-if="!isAlertShow" active />
  251. <div
  252. v-else-if="news.onlinePreview === '1' && news.type === 0"
  253. :class="$style.articleInfo"
  254. >
  255. <p :class="$style.title">链接文档</p>
  256. <a-divider />
  257. <div v-if="attachments.length > 0" :class="$style.wordlist">
  258. <p
  259. v-for="(item, index) in attachments"
  260. :key="index"
  261. :class="[
  262. $style.downloda,
  263. currentIndex === index ? $style.actived : '',
  264. index === 0 && !clickChange ? $style.defalutColor : '',
  265. ]"
  266. @click="chooseAttach(item, index)"
  267. >{{ item.name }}
  268. <a
  269. v-if="news.authDownload === '1'"
  270. :download="item.name"
  271. :href="
  272. `api/flow-mobile/v1/task-form-process/download-attachments/${item.code}`
  273. | sdResource
  274. "
  275. @click="attachmentRecord(item.name, item.code)"
  276. ><a-icon type="vertical-align-bottom"/></a
  277. ></p>
  278. </div>
  279. <a-empty v-else />
  280. </div>
  281. </div>
  282. </a-col> -->
  283. </a-row>
  284. </div>
  285. </div>
  286. </div>
  287. </a-card>
  288. </a-layout-content>
  289. </a-layout>
  290. </template>
  291. <script>
  292. import moment from 'moment'
  293. import loginService from '@/login/login-service'
  294. import { Modal, Message } from 'ant-design-vue'
  295. import errorUtil from '@/common/services/error-util'
  296. import axios from '@/common/services/axios-instance'
  297. import { getUserInfo } from '@/common/store-mixin'
  298. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  299. import FlowService from '@/webflow/flow-service'
  300. import KmKnowledageService from '@product/iam/audit/auditsource/km/km-knowledage-service'
  301. import components from './_import-components/iam-audit-home-view-import'
  302. import { Base65 } from './base65'
  303. const columnsVisit = [
  304. {
  305. title: '首次访问时间',
  306. dataIndex: 'firstSeen',
  307. scopedSlots: { customRender: 'firstSeen' },
  308. },
  309. {
  310. title: '最近访问时间',
  311. dataIndex: 'lastSeen',
  312. scopedSlots: { customRender: 'lastSeen' },
  313. },
  314. {
  315. title: '访问人',
  316. dataIndex: 'creatorName',
  317. },
  318. {
  319. title: '访问次数',
  320. dataIndex: 'visitCount',
  321. },
  322. ]
  323. export default {
  324. name: 'IamAuditHomeView',
  325. metaInfo: {
  326. title: '详情查看',
  327. },
  328. components: {
  329. ...components,
  330. },
  331. data() {
  332. return {
  333. docReadNumber: '', // 阅读次数
  334. columnsVisit,
  335. pagination1: {
  336. onChange: (page) => {},
  337. pageSize: 10,
  338. },
  339. pagination2: {
  340. onChange: (page) => {},
  341. pageSize: 10,
  342. },
  343. show: false, // 控制显示收藏弹框
  344. isEdit: false, // 控制显示勘误弹框
  345. fwId: Number(this.$route.query.id),
  346. creatorName: '', // 作者
  347. creationTime: null, // 创建时间
  348. recommendNum: null, // 推荐次数
  349. versionNum: null, // 版本号
  350. categoryName: '', // 分类
  351. label: '', // 标签
  352. businessArea: '', // 业务领域
  353. abstractMessage: '', // 摘要
  354. badgeCount: 0,
  355. favoritiesShow: false,
  356. isRecommend: false,
  357. labelCol: { span: 4 },
  358. wrapperCol: { span: 14 },
  359. // 推荐
  360. recommendForm: {
  361. resource: '',
  362. desc: '',
  363. },
  364. rules: {
  365. resource: [
  366. { required: true, message: 'Please select activity resource', trigger: 'change' },
  367. ],
  368. desc: [{ required: true, message: 'Please input activity form', trigger: 'blur' }],
  369. },
  370. isClick: '',
  371. loading: false,
  372. columns: [
  373. {
  374. title: '姓名',
  375. dataIndex: 'name',
  376. },
  377. {
  378. sorter: true,
  379. dataIndex: 'account',
  380. title: 'ID',
  381. },
  382. {
  383. title: '状态',
  384. dataIndex: 'status',
  385. },
  386. ],
  387. attachments: [],
  388. coverAttachments: [],
  389. comments: [],
  390. submitting: false,
  391. commentValue: '',
  392. moment,
  393. still: 1000,
  394. confirmLoading: false,
  395. // 版本
  396. editionModal: false,
  397. editionForm: {
  398. edition: '',
  399. },
  400. editionrules: {
  401. edition: [{ required: true, message: '版本号不能为空!', trigger: 'change' }],
  402. },
  403. // 获取所有点评入参
  404. commentParams: {
  405. columns:
  406. 'commentContent,businessId,creatorName,creationTime,creatorId,praiseNumber,creatorAccount',
  407. expressions: [
  408. {
  409. dataType: 'str',
  410. name: 'commentContent',
  411. op: 'like',
  412. stringValue: '%%',
  413. },
  414. {
  415. dataType: 'str',
  416. name: 'businessId',
  417. op: 'eq',
  418. stringValue: this.$route.query.id,
  419. },
  420. ],
  421. formId: 'kmComment',
  422. maxResults: 3,
  423. orderBy: 'creationTime asc',
  424. startPosition: 0,
  425. },
  426. // 发表点评 入参
  427. publishData: {
  428. eventId: 'save',
  429. inputs: [
  430. {
  431. name: 'commentContent',
  432. value: '',
  433. },
  434. {
  435. name: 'businessId',
  436. value: this.$route.query.id,
  437. },
  438. ],
  439. pageFlowId: 'string',
  440. pagePath: '/audit/km/comp/comment/kmComment',
  441. },
  442. showLoadingMore: true,
  443. pagination: {
  444. onChange: (page, pageSize) => this.changePage(page, pageSize),
  445. hideOnSinglePage: true,
  446. current: 1,
  447. pageSize: 3,
  448. total: 0,
  449. showTotal: (total) => {
  450. return `总共${total}条`
  451. },
  452. },
  453. loadingMore: false,
  454. lastPage: '',
  455. moreData: false,
  456. allCommentNum: null,
  457. news: {},
  458. isAlertShow: false,
  459. currentUser: '',
  460. // 推荐记录入参
  461. recommendrecord: {
  462. maxResults: -1,
  463. startPosition: 0,
  464. orderBy: 'id asc',
  465. expressions: [
  466. {
  467. dataType: 'str',
  468. name: 'knowledgeId',
  469. op: 'eq',
  470. stringValue: this.$route.query.id,
  471. },
  472. ],
  473. },
  474. // 访问记录入参
  475. visitedrecord: {
  476. maxResults: -1,
  477. startPosition: 0,
  478. orderBy: 'id asc',
  479. expressions: [
  480. {
  481. dataType: 'str',
  482. name: 'beanId',
  483. op: 'eq',
  484. stringValue: this.$route.query.id,
  485. },
  486. ],
  487. },
  488. recommendRecordData: [],
  489. visitRecordData: [],
  490. flag: null,
  491. clickChange: false,
  492. currentIndex: '',
  493. changeCode: '',
  494. changeName: '',
  495. active: false,
  496. choosedViewCategory: [],
  497. clickNum: 0,
  498. categoryrArr: [],
  499. businessAreaArr: [],
  500. labelArr: [],
  501. spin: true,
  502. infotype: this.$route.query.type,
  503. }
  504. },
  505. created() {
  506. this.currentUser = getUserInfo().account
  507. // 获取所有评论
  508. this.queryComment(this.commentParams)
  509. // 获取知识点赞数
  510. this.queryKnowledgeComment()
  511. const obj = {}
  512. obj.categoryId = this.$route.query.typeId
  513. obj.categoryName = this.$route.query.typeName
  514. this.choosedViewCategory.push(obj)
  515. this.callback('2')
  516. },
  517. mounted() {
  518. // 判断是否有权限借阅
  519. this.queryKnowledgeCheck()
  520. },
  521. methods: {
  522. gotoReaderList() {
  523. // 处理点击事件
  524. const param = {}
  525. param.formId = this.news.formId
  526. param.beanId = this.$route.query.id
  527. param.title = this.news.title
  528. window.open('#/iam-audit-reader-list?params=' + encodeURIComponent(JSON.stringify(param)))
  529. },
  530. refreshData() {
  531. // 获取推荐,访问记录
  532. this.queryRecommendOrVisitRecord(this.recommendrecord, '2')
  533. // 获取详情
  534. this.queryKnowledgeDetails()
  535. },
  536. // 下载记录
  537. attachmentRecord(attachmentName, attachmentCode) {
  538. const params = {
  539. knowledgeId: this.$route.query.id,
  540. knowledgeName: this.$route.query.title,
  541. categoryId: JSON.parse(this.news.category)[0].categoryId,
  542. categoryName: JSON.parse(this.news.category)[0].categoryName,
  543. attachmentGroupId: this.news.applyAttachment,
  544. attachmentName: attachmentName,
  545. attachmentCode: attachmentCode,
  546. }
  547. KmKnowledageService.getAttachmentRecord(params).then((res) => {})
  548. },
  549. previewAttachment(attachment) {
  550. const domain = `${location.origin}${location.pathname}`
  551. const url = `${domain}api/framework/v1/task-form-process/download-attachments/${
  552. attachment.code
  553. }?access_token=${loginService.getTokens().access_token}&fullfilename=${attachment.name}`
  554. console.log(url)
  555. console.log(encodeURIComponent(Base65.encode(url)))
  556. const targetUrl = `http://super-search.szsj.spic/weread/onlinePreview?url=${encodeURIComponent(
  557. Base65.encode(url)
  558. )}`
  559. window.open(targetUrl, '_blank')
  560. },
  561. showModal() {
  562. this.isRecommend = false
  563. },
  564. chooseAttach(item, index) {
  565. this.clickChange = true
  566. this.changeCode = item.code
  567. this.changeName = item.name
  568. this.currentIndex = index
  569. },
  570. queryRecommendOrVisitRecord(record, key) {
  571. if (key === '3') {
  572. // 访问记录
  573. record.columns = 'creationTime,creatorName,createDeptName,firstSeen,lastSeen,visitCount'
  574. record.formId = 'kmPreview'
  575. KmKnowledageService.getKnowledgeComment(record).then((res) => {
  576. this.spin = false
  577. if (res.data.data.length > 0) {
  578. this.visitRecordData = res.data.data
  579. record.columns = ''
  580. record.formId = ''
  581. } else {
  582. this.visitRecordData = []
  583. }
  584. })
  585. }
  586. },
  587. // 是否有借阅权限
  588. queryKnowledgeCheck() {
  589. const params = {
  590. id: this.$route.query.id,
  591. }
  592. KmKnowledageService.getKnowledgeCheck(params)
  593. .then((res) => {
  594. if (res.data.success) {
  595. // 获取详情
  596. this.queryKnowledgeDetails()
  597. }
  598. })
  599. .catch((err) => {
  600. const msg = errorUtil.getMessage(err)
  601. if (
  602. msg === '该知识未发布无法预览,待发布后进行详情查看!' ||
  603. msg === '查无数据,请核实入参!'
  604. ) {
  605. Message.error(msg)
  606. setTimeout(() => {
  607. window.close()
  608. }, 1000)
  609. } else {
  610. // 借阅提醒
  611. this.showRemind()
  612. }
  613. })
  614. },
  615. // 获取知识详情
  616. queryKnowledgeDetails() {
  617. // 通知公告
  618. if ((this.infotype === 'tzgg') | (this.infotype === 'xwdt') | (this.infotype === 'gxjb')) {
  619. axios({
  620. url: `api/flow-mobile/v1/task-form-process/done-pages/${this.$route.query.id}`,
  621. method: 'get',
  622. }).then((res) => {
  623. const info = res.data.processFormData.processFormPropertyValues
  624. this.isAlertShow = true
  625. this.news = {
  626. onlinePreview: '0',
  627. type: 1,
  628. creationTime: info.find((item) => {
  629. return item.name === 'creationTime'
  630. }).value,
  631. title: info.find((item) => {
  632. return item.name === 'title'
  633. }).value,
  634. creatorName: info.find((item) => {
  635. return item.name === 'creatorName'
  636. }).value,
  637. belongUnit: info.find((item) => {
  638. return item.name === 'createDeptName'
  639. }).value,
  640. content: info.find((item) => {
  641. return item.name === 'inforDescription'
  642. }).value,
  643. formId: res.data.processFormData.formId,
  644. }
  645. // 获取文档附件
  646. this.getAttachmentCode(
  647. JSON.parse(
  648. info.find((item) => {
  649. return item.name === 'attachment'
  650. }).value
  651. ).value
  652. )
  653. // 获取和增加阅读次数
  654. this.setReadNums(res.data.processFormData.formId)
  655. })
  656. } else if (this.infotype === 'laws') {
  657. // 法律法规
  658. axios({
  659. url: `api/xcoa-mobile/v1/page/wp/core/law/iamLaw?id=${this.$route.query.id}`,
  660. method: 'get',
  661. }).then((res) => {
  662. const info = res.data.pageFormData.pageFieldInfos
  663. this.isAlertShow = true
  664. this.news = {
  665. onlinePreview: '0',
  666. type: 1,
  667. creationTime: info.find((item) => {
  668. return item.name === 'mainteTime'
  669. }).value,
  670. title: info.find((item) => {
  671. return item.name === 'docTitle'
  672. }).value,
  673. creatorName: info.find((item) => {
  674. return item.name === 'maintePerson'
  675. }).value,
  676. belongUnit: info.find((item) => {
  677. return item.name === 'publishUnit'
  678. }).value,
  679. content: info.find((item) => {
  680. return item.name === 'content'
  681. }).value,
  682. }
  683. // 获取文档附件
  684. this.getAttachmentCode(
  685. JSON.parse(
  686. info.find((item) => {
  687. return item.name === 'attachment'
  688. }).value
  689. ).value
  690. )
  691. // 获取和增加阅读次数
  692. this.setReadNums(res.data.pageFormData.formId)
  693. })
  694. } else if (this.infotype === 'nbzd') {
  695. // 内部制度
  696. axios({
  697. url: `api/xcoa-mobile/v1/page/wp/audit/auditsource/institution/iamInstitution?id=${this.$route.query.id}`,
  698. method: 'get',
  699. }).then((res) => {
  700. const info = res.data.pageFormData.pageFieldInfos
  701. this.isAlertShow = true
  702. this.news = {
  703. onlinePreview: '0',
  704. type: 1,
  705. creationTime: info.find((item) => {
  706. return item.name === 'mainteTime'
  707. }).value,
  708. title: info.find((item) => {
  709. return item.name === 'docTitle'
  710. }).value,
  711. creatorName: info.find((item) => {
  712. return item.name === 'maintePerson'
  713. }).value,
  714. belongUnit: info.find((item) => {
  715. return item.name === 'publishUnit'
  716. }).value,
  717. content: info.find((item) => {
  718. return item.name === 'content'
  719. }).value,
  720. }
  721. // 获取文档附件
  722. this.getAttachmentCode(
  723. JSON.parse(
  724. info.find((item) => {
  725. return item.name === 'attachment'
  726. }).value
  727. ).value
  728. )
  729. // 获取和增加阅读次数
  730. this.setReadNums(res.data.pageFormData.formId)
  731. })
  732. } else {
  733. KmKnowledageService.getKnowledgeDetails({ id: this.$route.query.id })
  734. .then((res) => {
  735. if (res.status === 200) {
  736. this.isAlertShow = true
  737. this.news = res.data
  738. this.flag = this.news.praiseed
  739. this.labelArr = this.news.label?.split('、')
  740. // 获取文档附件
  741. this.getAttachmentCode(res.data.applyAttachment)
  742. }
  743. })
  744. .catch((err) => {
  745. Modal.error({
  746. title: '数据异常!',
  747. content: err.response?.data?.message?.split(':')[1] || '获取详情失败!',
  748. onOk() {
  749. // window.close()
  750. },
  751. })
  752. })
  753. }
  754. },
  755. // 获取阅读次数及增加阅读次数
  756. setReadNums(formId) {
  757. // 增加阅读次数
  758. axios({
  759. url: `api/xcoa-mobile/v1/portal/addIamPortalReadNumberEntity?formId=${formId}&beanId=${this.$route.query.id}`,
  760. })
  761. // 获取阅读次数
  762. axios({
  763. url: `api/xcoa-mobile/v1/portal/getIamPortalReadNumberEntity?formId=${formId}&beanId=${this.$route.query.id}`,
  764. }).then((res) => {
  765. // 把本次也计算上
  766. this.docReadNumber = res.data + 1
  767. })
  768. },
  769. // 获取附件code
  770. getAttachmentCode(groupId) {
  771. axios
  772. .get(`api/xcoa-mobile/v1/attachment-extend/attachments-info-perm/${groupId}`)
  773. .then((res) => {
  774. if (res.data.length > 0) {
  775. this.attachments = res.data
  776. } else {
  777. this.attachments = []
  778. }
  779. })
  780. },
  781. // 获取所有评论
  782. queryComment(params) {
  783. KmKnowledageService.getKnowledgeComment(params).then((res) => {
  784. if (res.data.totalSize < 4) {
  785. this.showLoadingMore = false
  786. }
  787. this.pagination.total = res.data.totalSize
  788. this.lastPage = Math.ceil(res.data.totalSize / this.pagination.pageSize)
  789. if (
  790. this.comments.length !== 0 &&
  791. this.moreData === true &&
  792. this.showLoadingMore !== false
  793. ) {
  794. this.comments = this.comments.concat(res.data.data)
  795. this.loadingMore = false
  796. this.$nextTick(() => {
  797. window.dispatchEvent(new Event('resize'))
  798. })
  799. } else {
  800. this.comments = res.data.data
  801. this.allCommentNum = res.data.totalSize
  802. }
  803. if (parseInt(this.pagination.total / 3) === this.clickNum) {
  804. this.showLoadingMore = false
  805. }
  806. })
  807. },
  808. // 获取更多评论
  809. clickMore() {
  810. this.clickNum++
  811. if (this.comments.length === this.allCommentNum) {
  812. this.showLoadingMore = false
  813. }
  814. if (this.allCommentNum < 4) {
  815. this.showLoadingMore = false
  816. }
  817. this.loadingMore = true
  818. this.moreData = true
  819. this.pagination.current += 1
  820. this.commentParams.startPosition =
  821. this.commentParams.maxResults * (this.pagination.current - 1)
  822. this.$nextTick(function() {
  823. this.queryComment(this.commentParams)
  824. })
  825. },
  826. // 获取知识点赞数
  827. queryKnowledgeComment() {
  828. const params = {
  829. id: this.$route.query.id,
  830. }
  831. KmKnowledageService.getKnowledgePraiseNum(params).then((res) => {
  832. this.badgeCount = res.data
  833. })
  834. },
  835. // 借阅提醒弹框
  836. showRemind() {
  837. const _this = this
  838. Modal.confirm({
  839. title: '借阅提醒',
  840. content: (h) => <div>您没有该文档的阅读权限,是否申请借阅?</div>,
  841. onOk() {
  842. _this.$router.replace(
  843. `/km-flow-guide?code=PROJECT_ZSGL_ZSJY&knowledgeId=${_this.$route.query.id}&title=${_this.$route.query.title}`
  844. )
  845. },
  846. onCancel() {
  847. window.close()
  848. },
  849. class: 'test',
  850. })
  851. },
  852. // 知识点赞
  853. handleLike(v) {
  854. const params = {
  855. id: this.$route.query.id,
  856. }
  857. KmKnowledageService.getKnowledgePraise(params).then((res) => {
  858. if (res.status === 200) {
  859. if (this.news.praiseed) {
  860. this.badgeCount = this.badgeCount - 1
  861. Message.success({ content: '取消点赞' })
  862. this.flag = false
  863. this.news.praiseed = false
  864. } else {
  865. this.badgeCount = this.badgeCount + 1
  866. Message.success({ content: '点赞成功' })
  867. this.flag = true
  868. this.news.praiseed = true
  869. }
  870. this.queryKnowledgeComment()
  871. // // 获取详情
  872. // this.queryKnowledgeDetails()
  873. }
  874. })
  875. },
  876. // 收藏
  877. handleCollect(v) {
  878. this.favoritiesShow = true
  879. },
  880. // 选择收藏夹save
  881. handleOkInFavorities(e) {
  882. this.onFavorities()
  883. },
  884. // 新建收藏夹
  885. createFavorites(e) {
  886. this.show = !this.show
  887. },
  888. getselectKey(key) {
  889. this.modelSelectedKey = key
  890. },
  891. // 收藏按钮点击处理, 目前通用接口没返回,手写的
  892. onFavorities() {
  893. const key = Symbol.for()
  894. Message.loading({ content: '处理中...', key })
  895. const url = window.location.hash
  896. const params = {
  897. eventId: 'save',
  898. inputs: [
  899. {
  900. name: 'title',
  901. value: this.news.title,
  902. },
  903. {
  904. name: 'topping',
  905. value: 1, // 0置顶, 1不置顶,默认不置顶
  906. },
  907. {
  908. name: 'url',
  909. value: url.split('#')[1],
  910. },
  911. {
  912. name: 'formId',
  913. value: this.news.formId,
  914. },
  915. {
  916. name: 'beanType',
  917. value: String(this.news.beanId),
  918. },
  919. {
  920. name: 'folderId',
  921. value: this.modelSelectedKey,
  922. },
  923. {
  924. name: 'businessTypeName',
  925. value: this.news.businessTypeName,
  926. },
  927. {
  928. name: 'businessTypeId',
  929. value: this.news.businessTypeId,
  930. },
  931. ],
  932. pageFlowId: 'string',
  933. pagePath: 'comp/bookmark/kmBookmarkContent',
  934. }
  935. FlowService.saveFavorities(params).then(
  936. () => {
  937. Message.success({ content: '收藏成功', key })
  938. this.news.collectioned = true
  939. },
  940. (_) => {
  941. Message.error({ content: '收藏失败', key })
  942. }
  943. )
  944. this.favoritiesShow = false
  945. },
  946. // 取消收藏
  947. onCancelFavorities() {
  948. const key = Symbol.for()
  949. Message.loading({ content: '处理中...', key })
  950. const params = {
  951. formId: this.news.formId,
  952. beanType: this.news.beanId,
  953. }
  954. FlowService.cancelFavorities(params).then(
  955. () => {
  956. Message.success({ content: '取消收藏成功', key })
  957. this.news.collectioned = false
  958. },
  959. (_) => {
  960. Message.error({ content: '取消收藏失败', key })
  961. }
  962. )
  963. },
  964. // 推荐
  965. handleRecommend(v) {
  966. this.isClick = v
  967. this.isRecommend = true
  968. },
  969. recomentChange(values) {},
  970. // 点评
  971. goAnchor(v) {
  972. this.isClick = v
  973. this.$refs.textarea.focus()
  974. document.getElementById('divId').scrollIntoView()
  975. },
  976. // 生成链接
  977. goLink(v) {
  978. this.isClick = v
  979. this.copyToClip(window.location.href)
  980. },
  981. copyToClip(content, message) {
  982. var aux = document.createElement('input')
  983. aux.setAttribute('value', content)
  984. document.body.appendChild(aux)
  985. aux.select()
  986. document.execCommand('copy')
  987. document.body.removeChild(aux)
  988. if (message == null) {
  989. Message.success('链接已生成!')
  990. } else {
  991. Message.warning('链接生成出错!')
  992. }
  993. },
  994. // 勘误
  995. goEdit(v) {
  996. this.isEdit = !this.isEdit
  997. },
  998. // 新版本
  999. goEdition(v) {
  1000. this.isClick = v
  1001. this.editionModal = true
  1002. },
  1003. handleEditionModalOk() {
  1004. this.$refs.editionRuleForm.validate((valid) => {
  1005. if (valid) {
  1006. const advancedFields = this.news.applyPerson.map((item) => item.name).join(',')
  1007. const attFields = []
  1008. attFields.push(this.news.applyAttachment)
  1009. attFields.push(this.news.coverAttachment)
  1010. const inputs = [
  1011. {
  1012. name: 'flowId',
  1013. value: this.news.flowId,
  1014. },
  1015. {
  1016. name: 'formId',
  1017. value: this.news.formId,
  1018. },
  1019. {
  1020. name: 'beanId',
  1021. value: String(this.news.beanId),
  1022. },
  1023. {
  1024. name: 'advancedFields',
  1025. value: advancedFields,
  1026. },
  1027. {
  1028. name: 'attFields',
  1029. value: 'applyAttachment,coverAttachment',
  1030. },
  1031. {
  1032. name: 'pagePath',
  1033. value: '/knowledge/contribution/kmKnowledge',
  1034. },
  1035. ]
  1036. // 复制附件
  1037. KmKnowledageService.copyAttachment({ inputs: inputs }).then((res) => {
  1038. window.open(
  1039. `#/sd-webflow/pages/draft/${res.data.instId}?versionNum=${this.editionForm.edition}&relationId=${this.news.relationId}`,
  1040. '_blank'
  1041. )
  1042. this.editionForm.edition = ''
  1043. })
  1044. this.editionModal = false
  1045. } else {
  1046. return false
  1047. }
  1048. })
  1049. },
  1050. handleEditionModalCancel() {
  1051. this.editionModal = false
  1052. },
  1053. change(values) {},
  1054. // tab切换
  1055. callback(key) {
  1056. if (key === '2') {
  1057. // 获取推荐,访问记录
  1058. this.queryRecommendOrVisitRecord(this.recommendrecord, key)
  1059. } else if (key === '3') {
  1060. // 获取推荐,访问记录
  1061. this.queryRecommendOrVisitRecord(this.visitedrecord, key)
  1062. }
  1063. },
  1064. // 发表评论
  1065. handleSubmit() {
  1066. if (!this.commentValue) {
  1067. return
  1068. }
  1069. this.submitting = true
  1070. this.publishData.inputs[0].value = this.commentValue
  1071. KmKnowledageService.getComment(this.publishData).then((res) => {
  1072. if (res.status === 200) {
  1073. this.submitting = false
  1074. this.still = 1000
  1075. Message.success({ content: '评论成功!', duration: 1 })
  1076. if (!this.showLoadingMore) {
  1077. // 初始化为0
  1078. this.commentParams.startPosition = this.startNum
  1079. // 结束位置+1
  1080. this.commentParams.maxResults = this.pagination.total + 1
  1081. this.$nextTick(function() {
  1082. this.queryComment(this.commentParams)
  1083. })
  1084. } else {
  1085. this.$nextTick(function() {
  1086. this.queryComment(this.commentParams)
  1087. })
  1088. }
  1089. this.commentValue = ''
  1090. }
  1091. })
  1092. },
  1093. handleChange() {
  1094. const txtVal = this.commentValue.length
  1095. this.still = 1000 - txtVal
  1096. },
  1097. // 评论点赞
  1098. like(item) {
  1099. KmKnowledageService.getPraise({ id: item.id })
  1100. .then((res) => {
  1101. this.moreData = false
  1102. if (res.data.accountOperation === 0) {
  1103. Message.success('取消点赞成功', 2)
  1104. } else {
  1105. Message.success('点赞成功', 2)
  1106. }
  1107. if (!this.showLoadingMore) {
  1108. // 初始化为0
  1109. this.commentParams.startPosition = this.startNum
  1110. // 结束位置为
  1111. this.commentParams.maxResults = this.pagination.total + 1
  1112. this.$nextTick(function() {
  1113. this.queryComment(this.commentParams)
  1114. })
  1115. } else {
  1116. this.$nextTick(function() {
  1117. this.queryComment(this.commentParams)
  1118. })
  1119. }
  1120. })
  1121. .catch(() => {
  1122. this.submitting = false
  1123. })
  1124. },
  1125. treeSelected() {},
  1126. close(flag) {
  1127. crossWindowWatcher.notifyChange(this.$route.path, flag)
  1128. window.close()
  1129. },
  1130. },
  1131. }
  1132. </script>
  1133. <style module lang="scss">
  1134. @use '@/common/design' as *;
  1135. $header-lh: 50px;
  1136. $comment-bg: #e4e4e4;
  1137. $font-size-middle: 14px;
  1138. $link-icon-size: 22px;
  1139. $bgcolor: #f7f7f7;
  1140. .layout {
  1141. height: 100%;
  1142. .layout-content {
  1143. min-height: calc(100% - 64px);
  1144. }
  1145. .bgcolor {
  1146. height: 100%;
  1147. background: $bgcolor;
  1148. :global(.ant-card-body) {
  1149. background-color: $bgcolor;
  1150. }
  1151. }
  1152. .header {
  1153. width: 100%;
  1154. height: 50px;
  1155. padding: 0 20px;
  1156. line-height: $header-lh;
  1157. color: $heading-color-dark;
  1158. background-color: $primary-color;
  1159. }
  1160. .news-main {
  1161. max-width: 1300px;
  1162. margin: 0 auto;
  1163. }
  1164. .recoment-radio {
  1165. margin-left: 140px;
  1166. }
  1167. .know-ledage {
  1168. padding: 20px 0;
  1169. overflow: hidden;
  1170. .kl-operation {
  1171. width: 100%;
  1172. padding-top: 20px;
  1173. margin-bottom: 20px;
  1174. text-align: left;
  1175. .drage {
  1176. sup {
  1177. top: -8px;
  1178. span {
  1179. p {
  1180. color: $heading-color-dark;
  1181. }
  1182. }
  1183. }
  1184. }
  1185. .is-active {
  1186. color: $primary-color;
  1187. i {
  1188. color: $primary-color;
  1189. }
  1190. }
  1191. > span {
  1192. margin-right: 20px;
  1193. }
  1194. span {
  1195. color: $text-color;
  1196. i {
  1197. padding-right: 5px;
  1198. }
  1199. &:hover {
  1200. color: $primary-color;
  1201. cursor: pointer;
  1202. }
  1203. }
  1204. .down-btn {
  1205. float: right;
  1206. padding: 6px 20px;
  1207. color: $white;
  1208. background: $primary-color;
  1209. border-radius: $border-radius-base;
  1210. }
  1211. }
  1212. .kl-article {
  1213. margin-top: 10px;
  1214. .left-content {
  1215. h3 {
  1216. font-size: $heading-3-size;
  1217. text-align: center;
  1218. }
  1219. .infos {
  1220. padding-bottom: 10px;
  1221. text-align: center;
  1222. :global(.ant-tag) {
  1223. background: white;
  1224. }
  1225. span {
  1226. padding-right: 15px;
  1227. font-size: $font-size-middle;
  1228. i {
  1229. font-style: normal;
  1230. color: $highlight-color;
  1231. }
  1232. }
  1233. }
  1234. .content {
  1235. min-height: 250px;
  1236. padding-top: 40px;
  1237. margin-bottom: 40px;
  1238. p {
  1239. font-size: $font-size-base;
  1240. line-height: $line-height-base;
  1241. text-indent: 60px;
  1242. }
  1243. }
  1244. .files {
  1245. margin: 0 0 10px;
  1246. overflow: hidden;
  1247. .files-name {
  1248. float: left;
  1249. }
  1250. .files-btn {
  1251. float: right;
  1252. button {
  1253. margin-right: 20px;
  1254. }
  1255. }
  1256. }
  1257. .artice-text {
  1258. padding: 40px 40px 10px;
  1259. background: #fff;
  1260. }
  1261. .comment {
  1262. padding: 20px;
  1263. margin-top: 20px;
  1264. background: #fff;
  1265. .pl-content {
  1266. .comment-text {
  1267. margin-bottom: 10px;
  1268. }
  1269. .comment-score {
  1270. .score {
  1271. float: left;
  1272. }
  1273. .publish {
  1274. float: right;
  1275. .text-num {
  1276. padding-right: 40px;
  1277. font-size: $font-size-middle;
  1278. color: $modal-mask-bg;
  1279. em {
  1280. padding: 0 2px;
  1281. font-style: normal;
  1282. }
  1283. }
  1284. }
  1285. }
  1286. }
  1287. .comment-list {
  1288. margin-top: -20px;
  1289. }
  1290. }
  1291. }
  1292. .right-content {
  1293. margin: 0 0 0 40px;
  1294. .article-info {
  1295. padding: 20px;
  1296. margin-bottom: 20px;
  1297. background: #fff;
  1298. p.title {
  1299. font-size: $font-size-lg;
  1300. font-weight: bold;
  1301. }
  1302. .user-info {
  1303. padding-top: 10px;
  1304. p {
  1305. margin-bottom: 10px;
  1306. }
  1307. .user-img {
  1308. padding-bottom: 10px;
  1309. .username {
  1310. margin-top: 8px;
  1311. margin-bottom: 0;
  1312. font-size: $btn-font-size-lg;
  1313. font-weight: bold;
  1314. }
  1315. .userinfo {
  1316. width: 65px;
  1317. height: 65px;
  1318. border-radius: 50%;
  1319. }
  1320. }
  1321. .user-num {
  1322. padding: 10px 0;
  1323. span {
  1324. padding-right: 40px;
  1325. font-weight: bold;
  1326. color: $black;
  1327. i {
  1328. padding-right: 10px;
  1329. }
  1330. }
  1331. }
  1332. }
  1333. .infos {
  1334. p {
  1335. margin-bottom: 5px;
  1336. font-size: $btn-font-size-sm;
  1337. i {
  1338. width: 4em; /* 这个值是看最长能显示几个文字,如x,则为x em */
  1339. margin-right: -2em; /* 同上 */
  1340. font-style: normal;
  1341. text-align: center;
  1342. letter-spacing: 2em; /* 如果需要y个字两端对齐,则为(x-y)/(y-1),这里是(4-2)/(2-1)=2em */
  1343. }
  1344. }
  1345. }
  1346. .wordlist {
  1347. .downloda {
  1348. display: inline-block;
  1349. width: 100%;
  1350. padding: 0 10px;
  1351. line-height: $btn-height-lg;
  1352. color: $btn-default-color;
  1353. cursor: pointer;
  1354. i {
  1355. padding-left: 10px;
  1356. }
  1357. }
  1358. .actived {
  1359. background: rgba(173, 212, 247, 0.78);
  1360. }
  1361. .defalut-color {
  1362. background: rgba(173, 212, 247, 0.78);
  1363. }
  1364. }
  1365. }
  1366. }
  1367. .moredata {
  1368. margin-top: 20px;
  1369. text-align: center;
  1370. cursor: pointer;
  1371. }
  1372. .no-comment {
  1373. text-align: center;
  1374. }
  1375. }
  1376. .wpsread {
  1377. height: 800px;
  1378. }
  1379. .example {
  1380. text-align: center;
  1381. }
  1382. }
  1383. .handle-btn {
  1384. padding: 0 $link-icon-size / 2;
  1385. span {
  1386. padding: 0 $link-icon-size / 2;
  1387. margin-right: 0;
  1388. margin-left: 10px;
  1389. cursor: pointer;
  1390. a {
  1391. cursor: pointer;
  1392. }
  1393. }
  1394. }
  1395. .list-item {
  1396. display: flex;
  1397. div {
  1398. &:first-child {
  1399. min-width: 150px;
  1400. }
  1401. &:nth-child(2) {
  1402. margin-left: 50px;
  1403. }
  1404. &:nth-child(3) {
  1405. margin-left: 50px;
  1406. }
  1407. }
  1408. }
  1409. .ulheight {
  1410. :global(.ant-list-items) {
  1411. max-height: 500px;
  1412. overflow-y: scroll;
  1413. }
  1414. }
  1415. :global(.ant-divider) {
  1416. margin: 0;
  1417. }
  1418. }
  1419. </style>