albumInfo.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. <template>
  2. <rx-layout>
  3. <div slot="center" style>
  4. <div class="mainContent">
  5. <breadcrumb firstLevel="专辑管理" lastLevel="专辑详情" />
  6. <div class="body-head">
  7. <div class="body-head-title">
  8. <div>基本信息</div>
  9. <div>
  10. <a-button v-if="actionFlag.indexOf('transfer') > -1" style="margin-right: 20px;" type="primary" @click="showAuditFlag = true">转移负责人</a-button>
  11. <a-button v-if="actionFlag.indexOf('open') > -1" type="primary" @click="handleSwitchClick" :loading="saveLoading">开启专辑</a-button>
  12. <a-button v-if="actionFlag.indexOf('close') > -1" type="primary" @click="handleSwitchClick" :loading="saveLoading">专辑关闭</a-button>
  13. </div>
  14. </div>
  15. <div class="body-head-details">
  16. <div>
  17. <div>
  18. <span>专辑名称: {{ baseInfo.name }}</span>
  19. <span>专辑负责人: {{ baseInfo.owner }}</span>
  20. <span>创建时间: {{ baseInfo.createTime }}</span>
  21. </div>
  22. <div>
  23. <span>所属公司: {{ baseInfo.ownerCompany }}</span>
  24. <span>所属部门: {{ baseInfo.ownerDepartment }}</span>
  25. <span>专辑分类: {{ baseInfo.categoryName }}</span>
  26. </div>
  27. <div>
  28. <span>阅读数量: {{ baseInfo.views }}</span>
  29. <span>点评数量: {{ baseInfo.yelpTotal }}</span>
  30. <span>发布状态: {{ baseInfo.versionState }}</span>
  31. </div>
  32. </div>
  33. <div>
  34. <img :src="'/api/api-system/system/core/sysFile/previewFile?fileId='+baseInfo.cover" alt="">
  35. </div>
  36. </div>
  37. </div>
  38. <div class="body-content" v-if="tabsList.length">
  39. <a-tabs v-model="tabsKeys" size="large" :animated="false" @change="handleTabChange">
  40. <a-tab-pane v-for="(item,index) in tabsList" :key="index + 1 + ''" :tab="computedTabName(item)">
  41. <!-- 专辑简介 -->
  42. <div class="album-desc">
  43. <div>专辑简介</div>
  44. <div>{{ versionInfo.summary }}</div>
  45. </div>
  46. <a-divider />
  47. <!-- 专辑目录 -->
  48. <template v-if="catalogInfo.length">
  49. <div class="album-catalog">
  50. <div>专辑目录</div>
  51. <album-catalog :catalogInfo="catalogInfo" @handleRemoveId="setId" />
  52. </div>
  53. <!-- 专辑page -->
  54. <div class="album-page">
  55. <a-pagination
  56. v-model="queryParam.pageNo"
  57. :page-size-options="pageSizeOptions"
  58. :total="total"
  59. show-size-changer
  60. showQuickJumper
  61. :page-size="queryParam.pageSize"
  62. @showSizeChange="handleShowSizeChange"
  63. @change="onChange"
  64. >
  65. <template slot="buildOptionText" slot-scope="props">
  66. <span>{{ props.value }}条/页</span>
  67. </template>
  68. </a-pagination>
  69. </div>
  70. </template>
  71. <template v-else>
  72. <div class="album-catalog">
  73. <div>专辑目录</div>
  74. <div style="text-indent: 2em">无内容</div>
  75. </div>
  76. </template>
  77. <!-- 专辑审批 -->
  78. <!-- 审核页进入的并且版本状态是审核中的才能审批-->
  79. <template v-if="showCheck && item.state == 1">
  80. <div class="album-check">
  81. <div>专辑审批</div>
  82. <a-radio-group v-model="auditForm.result" style="margin-bottom: 16px;">
  83. <a-radio value="1">通过</a-radio>
  84. <a-radio value="0">驳回</a-radio>
  85. </a-radio-group>
  86. <a-input v-model="auditForm.remark" type="textarea" :autosize="{minRows: 3, maxRows: 6}" :maxLength="200" placeholder="请输入审批意见" />
  87. <a-row :gutter="24" type="flex" justify="end" style="margin-top: 20px;padding-right:12px;">
  88. <a-button style="margin-right: 20px;" @click="$router.back()">取消</a-button>
  89. <a-button type="primary" :loading="saveLoading" @click="handleCheckClick">保存</a-button>
  90. </a-row>
  91. </div>
  92. </template>
  93. <a-divider />
  94. <!-- 专辑审批记录 -->
  95. <div class="album-check-record">
  96. <div>专辑审批记录</div>
  97. <div>
  98. <a-table :columns="approverColumns" :data-source="versionInfo.approvalFlows" :pagination="false">
  99. </a-table>
  100. </div>
  101. </div>
  102. </a-tab-pane>
  103. </a-tabs>
  104. </div>
  105. <!-- 点评信息 -->
  106. <template>
  107. <div class="body-footer">
  108. <template v-if="yelpList.length">
  109. <div>点评信息</div>
  110. <a-collapse v-model="collapseCheckKey" @change="handlePanelChange">
  111. <a-collapse-panel v-for="(item,index) in yelpList" :key="index + 1 + ''" :style="(yelpList.length != index + 1) && panelStyle">
  112. <!-- head -->
  113. <div slot="header" class="collapse-check">
  114. <div>
  115. <img :src="'/api/api-system/system/core/sysFile/previewFile?fileId='+item.createPhoto" style="width:20px;height:20px;border-radius:50%;" alt="">
  116. <span>{{ item.createName }}</span>
  117. </div>
  118. <div>
  119. {{ item.content }}
  120. </div>
  121. <div>
  122. <span>{{ item.createTime }}</span>
  123. <a-button type="link" @click="handleRemarkDelClick(index,item.pkId)">删除</a-button>
  124. </div>
  125. </div>
  126. <!-- body -->
  127. <template v-if="item.replies">
  128. <div style="padding-right: 6px;" v-for="(iten,indey) in item.replies" :key="indey" class="collapse-check">
  129. <div>
  130. <img :src="'/api/api-system/system/core/sysFile/previewFile?fileId='+iten.createPhoto" style="width:20px;height:20px;border-radius:50%;" alt="">
  131. <span>{{ iten.createName }}</span>
  132. </div>
  133. <div>
  134. {{ iten.content }}
  135. </div>
  136. <div>
  137. <span>{{ iten.createTime }}</span>
  138. <a-button type="link" @click="handleReplyDelClick(index,indey,iten.pkId)">删除</a-button>
  139. </div>
  140. </div>
  141. </template>
  142. <template v-else>
  143. <div>无内容</div>
  144. </template>
  145. <div v-if="item.replyCount > 2" class="show-return-info" @click="handleMoreClick(item.pkId)">
  146. 查看全部{{ item.replyCount - 2 }}条回复内容>
  147. </div>
  148. </a-collapse-panel>
  149. </a-collapse>
  150. </template>
  151. <template v-else>
  152. <div>点评信息</div>
  153. <div>无内容</div>
  154. </template>
  155. <a-row :gutter="24" type="flex" justify="end" style="margin-top: 20px; padding-right:12px;">
  156. <a-button style="margin-right: 20px;" @click="$router.back()">取消</a-button>
  157. <a-button v-if="actionFlag.indexOf('edit') > -1" type="primary" :loading="saveLoading" @click="handleSaveClick">保存</a-button>
  158. </a-row>
  159. </div>
  160. </template>
  161. </div>
  162. <a-modal v-model="showAuditFlag"
  163. width="1100"
  164. title="选择组织人员"
  165. centered
  166. okText="保存"
  167. @ok="handleOk">
  168. <org-people style="width:1100px;height:540px;" isOnlyChoosePeople @transCheckedTarget="transCheckedTarget"></org-people>
  169. </a-modal>
  170. </div>
  171. </rx-layout>
  172. </template>
  173. <script>
  174. import breadcrumb from '../components/breadcrumb'
  175. import orgPeople from './components/orgPeople'
  176. import albumCatalog from './components/albumCatalog.vue'
  177. import api from '@/api/knowledge/album/albumInfo'
  178. import albumAuditApi from '@/api/knowledge/album/albumAudit'
  179. export default {
  180. name: 'albumInfo',
  181. components: {
  182. breadcrumb,
  183. albumCatalog,
  184. orgPeople
  185. },
  186. data() {
  187. return {
  188. saveLoading: false,
  189. api,
  190. // 专辑id
  191. pkId: '',
  192. showCheck: false,
  193. baseInfo: {
  194. name: '',
  195. owner: '',
  196. createTime: '',
  197. ownerCompany: '',
  198. ownerDepartment: '',
  199. categoryName: '',
  200. views: '',
  201. yelpTotal: '',
  202. versionState: '',
  203. cover: ''
  204. },
  205. actionFlag: [],
  206. tabsList: [],
  207. tabsKeys: '1',
  208. // 版本id
  209. versionId: '',
  210. versionInfo: {
  211. summary: '',
  212. // 审核id
  213. approvalId: '',
  214. approvalFlows: []
  215. },
  216. approverColumns: [
  217. {
  218. title: '流程节点',
  219. align: 'center',
  220. dataIndex: 'name',
  221. },
  222. {
  223. title: '审批人',
  224. align: 'center',
  225. dataIndex: 'actualApproverName',
  226. },
  227. {
  228. title: '审批状态',
  229. align: 'center',
  230. dataIndex: 'approvalStatus',
  231. },
  232. {
  233. title: '审批备注',
  234. align: 'center',
  235. dataIndex: 'comment',
  236. },
  237. {
  238. title: '时间',
  239. align: 'center',
  240. dataIndex: 'approvalTime'
  241. },
  242. ],
  243. catalogInfo: [],
  244. pageSizeOptions: ['3', '10', '20', '30'],
  245. queryParam: {
  246. pageNo: 1,
  247. pageSize: 3,
  248. sortField: "",
  249. sortOrder:"asc",
  250. params:{
  251. // 专辑id 版本id
  252. albumId: '',
  253. versionId: ''
  254. }
  255. },
  256. total: 0,
  257. collapseCheckKey: '1',
  258. yelpList: [],
  259. yelpIndexInfo: [],
  260. auditForm: {
  261. pkIds: [],
  262. result: '1',
  263. remark: ''
  264. },
  265. panelStyle: 'border-bottom: 5px solid #fff;',
  266. showAuditFlag: false,
  267. // 目标人id
  268. target: '',
  269. catalogueIdAndKnowledgeList: {},
  270. yelps: []
  271. }
  272. },
  273. created() {
  274. this.pkId = this.$route.query.pkId
  275. this.showCheck = this.$route.query.showCheck
  276. this.init()
  277. },
  278. beforeDestroy() {
  279. this.baseInfo = Object.assign({},this.$options.data().baseInfo)
  280. this.versionInfo = Object.assign({},this.$options.data().versionInfo)
  281. this.catalogInfo = Object.assign({},this.$options.data().catalogInfo)
  282. this.auditForm = Object.assign({},this.$options.data().auditForm)
  283. },
  284. computed: {
  285. computedTabName() {
  286. return function(item) {
  287. return item.createTime.split(' ')[0] + ' (' + item.stateName + ')'
  288. }
  289. }
  290. },
  291. methods: {
  292. async init() {
  293. let detailData = await api.detail({pkId: this.pkId})
  294. let detailInfo = detailData.data
  295. this.baseInfo = { ...detailInfo, versionState: this.getVersionStateName(detailInfo.versionState)}
  296. this.actionFlag = detailInfo.actionFlag
  297. this.tabsList = detailInfo.versions || []
  298. if(this.tabsList.length) {
  299. this.versionId = this.tabsList[0].pkId
  300. this.getCatalogData()
  301. api.yelp({albumId: this.pkId}).then(res => {
  302. if(res.code == 200) {
  303. if(res.data.length) {
  304. this.yelpList = res.data
  305. }
  306. }
  307. })
  308. }
  309. },
  310. async getCatalogData() {
  311. api.version({pkId: this.versionId}).then(res => {
  312. if(res.code == 200) {
  313. this.versionInfo = { ...res.data }
  314. }
  315. })
  316. this.queryParam.params.albumId = this.pkId
  317. this.queryParam.params.versionId = this.versionId
  318. api.catalogue(this.queryParam).then(res => {
  319. if(res.code == 200) {
  320. this.total = res.result.totalCount
  321. this.catalogInfo = res.result.data
  322. }
  323. })
  324. },
  325. getVersionStateName(state) {
  326. switch (state) {
  327. case 1:
  328. return '审核中'
  329. case 2:
  330. return '发布中'
  331. case 3:
  332. return '无此状态'
  333. case 4:
  334. return '已驳回'
  335. }
  336. },
  337. // 关闭专辑
  338. handleSwitchClick() {
  339. this.saveLoading = true
  340. api.close({pkId: this.pkId}).then(res => {
  341. if(res.code == 200) {
  342. if(this.actionFlag.indexOf('open') > -1) {
  343. this.$message.success('开启成功')
  344. } else {
  345. this.$message.success('关闭成功')
  346. }
  347. setTimeout(() =>
  348. {
  349. this.$router.back()
  350. this.saveLoading = false
  351. }
  352. , 500)
  353. }
  354. })
  355. },
  356. // 转移负责人
  357. transCheckedTarget(arg) {
  358. this.target = arg.approverId
  359. },
  360. // 确认转移负责人
  361. handleOk() {
  362. if(!this.target) {
  363. this.$message.error('请选负责人')
  364. return
  365. }
  366. let data = {
  367. pkId: this.pkId,
  368. target: this.target
  369. }
  370. api.transferOwner(data).then(res => {
  371. if(res.code == 200) {
  372. this.showAuditFlag = false
  373. setTimeout(() =>
  374. {
  375. this.$router.back()
  376. }
  377. , 500)
  378. }
  379. })
  380. },
  381. // 切换tab
  382. handleTabChange(arg) {
  383. this.versionId = this.tabsList[(arg - 1)].pkId
  384. this.getCatalogData()
  385. },
  386. // 每页条数
  387. handleShowSizeChange(current, pageSize) {
  388. this.queryParam.pageNo = current
  389. this.queryParam.pageSize = pageSize;
  390. this.getCatalogData()
  391. },
  392. // 跳转
  393. onChange(pageNumber) {
  394. this.queryParam.pageNo = pageNumber
  395. this.getCatalogData()
  396. },
  397. // 审核
  398. handleCheckClick() {
  399. this.handleCheckClick = false
  400. this.auditForm.pkIds = [ this.versionInfo.approvalId ]
  401. albumAuditApi.approve(this.auditForm).then(res => {
  402. if(res.code) {
  403. setTimeout(() =>
  404. {
  405. this.$router.back()
  406. this.saveLoading = false
  407. }
  408. ,1000)
  409. }
  410. })
  411. },
  412. // 切换点评
  413. handlePanelChange(key) {
  414. // if(!key.length) return
  415. // let repliesData = this.yelpList[key[0] - 1].replies
  416. // this.yelpIndexInfo = repliesData.length < 2 ? repliesData : repliesData.slice(0,2)
  417. },
  418. // 显示更多回复
  419. handleMoreClick(yelpId) {
  420. // this.yelpIndexInfo = this.yelpList[parseInt(this.collapseCheckKey) - 1].replies
  421. let query = {
  422. pageNo: 1,
  423. pageSize: 100,
  424. sortField: "",
  425. sortOrder:"asc",
  426. params:{
  427. // 专辑id
  428. albumId: this.pkId,
  429. // yelpId
  430. yelpId: yelpId
  431. }
  432. }
  433. // 暂时还没写
  434. // api.queryComment(query).then(res => {
  435. // if(res.code == 200) {
  436. // this.yelpList[parseInt(this.collapseCheckKey) - 1].replies.push(...res.data)
  437. // }
  438. // })
  439. },
  440. // 添加要删除的知识
  441. setId(arg) {
  442. if(arg.pkId in this.catalogueIdAndKnowledgeList) {
  443. this.catalogueIdAndKnowledgeList[arg.pkId].push(arg.knowledgeId)
  444. } else {
  445. this.catalogueIdAndKnowledgeList[arg.pkId] = [arg.knowledgeId]
  446. }
  447. },
  448. // 删除点评信息
  449. handleRemarkDelClick(index,pkId) {
  450. this.yelpList.splice(index, 1)
  451. this.yelps.push(pkId)
  452. },
  453. // 删除回复信息
  454. handleReplyDelClick(index,indey,pkId) {
  455. this.yelpList[index].replies.splice(indey, 1)
  456. this.yelps.push(pkId)
  457. },
  458. // 保存
  459. handleSaveClick() {
  460. this.saveLoading = true
  461. let query = {
  462. pkId: this.pkId,
  463. versionId: this.versionId,
  464. catalogueIdAndKnowledgeList: this.catalogueIdAndKnowledgeList,
  465. yelps: this.yelps
  466. }
  467. api.removeKnowledgeAndYelp(query).then(res => {
  468. if(res.code == 200) {
  469. setTimeout(() =>
  470. {
  471. this.$router.back()
  472. this.saveLoading = false
  473. }
  474. ,1000)
  475. }
  476. })
  477. }
  478. }
  479. }
  480. </script>
  481. <style lang="less" scoped>
  482. @gary: #f8f8f8;
  483. @white: #fff;
  484. @fontSize: 17px;
  485. .mainContent {
  486. min-height: 100%;
  487. width: 100%;
  488. padding: 40px;
  489. background: #f8f8f8;
  490. position: relative;
  491. .ant-breadcrumb {
  492. position:absolute;
  493. top:10px;
  494. }
  495. .body-head {
  496. height: 100%;
  497. background: @white;
  498. padding: 20px 40px;
  499. .body-head-title {
  500. display: flex;
  501. justify-content: space-between;
  502. align-items: flex-end;
  503. >div:first-child {
  504. font-size: @fontSize;
  505. }
  506. }
  507. .body-head-details {
  508. margin-top: 15px;
  509. display:flex;
  510. >div:first-child {
  511. flex: 1;
  512. display: flex;
  513. flex-direction: column;
  514. div {
  515. display: flex;
  516. justify-content: space-between;
  517. // align-items: center;
  518. flex:1;
  519. span {
  520. display: inline-block;
  521. width: 100%;
  522. white-space: pre-line;
  523. }
  524. }
  525. }
  526. >div:last-child {
  527. width: 198px;
  528. height: 120px;
  529. flex-shrink: 1;
  530. img {
  531. width: 100%;
  532. height: 100%;
  533. }
  534. }
  535. }
  536. }
  537. .body-content {
  538. background: @white;
  539. padding: 20px 15px 20px 40px;
  540. margin-top: 20px;
  541. .album-desc {
  542. >div:first-child {
  543. font-size: @fontSize;
  544. }
  545. >div:last-child {
  546. margin-top: 20px;
  547. text-indent:2em;
  548. padding-right: 40px;
  549. }
  550. }
  551. .album-catalog {
  552. >div:first-child {
  553. font-size: @fontSize;
  554. margin-bottom: 20px;
  555. }
  556. }
  557. .album-page {
  558. width: 100%;;
  559. margin-top: 20px;
  560. text-align: right;
  561. }
  562. .album-check {
  563. width: 95%;
  564. >div:first-child {
  565. font-size: @fontSize;
  566. margin-bottom: 20px;
  567. }
  568. }
  569. .album-check-record {
  570. >div:first-child {
  571. font-size: @fontSize;
  572. margin-bottom: 20px;
  573. }
  574. >div:last-child {
  575. width: 70%;
  576. }
  577. }
  578. }
  579. .body-footer {
  580. background: @white;
  581. padding: 20px 15px 20px 40px;
  582. margin-top: 20px;
  583. >div:first-child {
  584. font-size: @fontSize;
  585. margin-bottom: 20px;
  586. }
  587. .collapse-check {
  588. padding-right: 20px;
  589. >div:nth-child(1) {
  590. display: flex;
  591. align-items: center;
  592. img {
  593. width:20px;
  594. height:20px;
  595. border-radius:50%;
  596. }
  597. span {
  598. margin-left: 15px;
  599. }
  600. }
  601. >div:nth-child(2) {
  602. margin: 10px 0;
  603. }
  604. >div:nth-child(3) {
  605. display: flex;
  606. justify-content: space-between;
  607. align-items: flex-start;
  608. span {
  609. color: #aaa;
  610. }
  611. button {
  612. padding: 3px;
  613. }
  614. }
  615. }
  616. }
  617. }
  618. .show-return-info {
  619. width: 200px;
  620. padding: 5px 20px;
  621. background: #f0f2f5;
  622. color: #aaa;
  623. cursor: pointer;
  624. }
  625. .clearBtn {
  626. background: none;
  627. color: #3294F7;
  628. text-shadow: none;
  629. padding: 0px 6px;
  630. border: none;
  631. box-shadow: none;
  632. }
  633. </style>
  634. <style scoped>
  635. /deep/.ant-btn > .anticon + span {
  636. margin-left: 0;
  637. }
  638. /deep/ .ant-tabs-bar {
  639. padding-left: 0;
  640. }
  641. /deep/ .ant-collapse {
  642. border-radius: 0px;
  643. }
  644. /deep/ .ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow {
  645. top: 24px;
  646. }
  647. /deep/ .ant-collapse-content {
  648. border: none;
  649. }
  650. /deep/ .ant-collapse-content > .ant-collapse-content-box {
  651. padding: 20px 30px 15px 50px;
  652. }
  653. /deep/ .ant-input {
  654. border-radius: 0;
  655. }
  656. /deep/ .ant-pagination {
  657. margin: 1px;
  658. }
  659. /* /deep/.ant-table-thead > tr > th {
  660. text-align: center;
  661. height: 54px;
  662. }
  663. /deep/ .ant-table-tbody > tr > td {
  664. height: 54px;
  665. } */
  666. /deep/ .ant-modal-footer {
  667. padding: 10px 24px;
  668. }
  669. </style>