albumList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <rx-layout>
  3. <div slot="center" style>
  4. <rx-fit>
  5. <div slot="toolheader" border="false" foldbtn="false">
  6. <breadcrumb firstLevel="专辑管理" lastLevel="专辑列表" />
  7. <div class="mainContent">
  8. <div class="body" :style="{'padding-right': $store.state.appSetting.collapsed ? '0px' : '20px' }">
  9. <div class="content">
  10. <a-form ref="searchForm" layout="inline" style="display:flex;">
  11. <div style="width:80%;;display:flex;flex-wrap:wrap;">
  12. <div style="display:flex;flex-wrap:wrap;">
  13. <a-form-item
  14. style="width:320px;margin: 5px 40px 5px 0;"
  15. label="专辑名称"
  16. name="name">
  17. <a-input v-model="queryParam.name" placeholder="请输入"/>
  18. </a-form-item>
  19. <a-form-item
  20. style="width:320px;margin: 5px 40px 5px 0;"
  21. label="专辑分类"
  22. name="categoryIds">
  23. <a-cascader v-model="categoryIds"
  24. :options="classifyLevelList"
  25. :fieldNames="{ label: 'name', value: 'pkId', children: 'children' }"
  26. placeholder="请选择"
  27. changeOnSelect
  28. @change="handleClassifyChange" />
  29. </a-form-item>
  30. </div>
  31. <div style="display:flex;flex-wrap:wrap;" v-if="extend" :class="{'show-other': extend}">
  32. <a-form-item
  33. style="width:320px;margin: 5px 40px 5px 0;"
  34. label="负责人"
  35. name="ownerName" >
  36. <a-input v-model="queryParam.ownerName" placeholder="请输入" />
  37. </a-form-item>
  38. <!-- <a-form-item
  39. style="width:320px;margin: 5px 40px 5px 0;"
  40. label="审核状态"
  41. name="categoryIds">
  42. <a-cascader v-model="categoryIds"
  43. :options="classifyList"
  44. :fieldNames="{ label: 'name', value: 'pkId', children: 'children' }"
  45. placeholder="请选择"
  46. changeOnSelect
  47. @change="handleClassifyChange" />
  48. </a-form-item> -->
  49. <a-form-item
  50. style="width:320px;margin: 5px 40px 5px 0;"
  51. label="创建时间"
  52. name="createTime" >
  53. <a-range-picker v-model="createTime"
  54. separator="→"
  55. format="YYYY/MM/DD"
  56. valueFormat="YYYY-MM-DD"
  57. @change="handleClearTimeChange">
  58. <a-icon v-if="$store.state.appSetting.collapsed" slot="suffixIcon" type="calendar" />
  59. </a-range-picker>
  60. </a-form-item>
  61. </div>
  62. </div>
  63. <div style="width:20%;display:flex;justify-content:flex-end;align-content: flex-start;flex-wrap:wrap;">
  64. <div style="display:flex;justify-content:center;margin-top: 8px;">
  65. <a-button @click="handleResetClick(true)">重置</a-button>
  66. <a-button type="primary" @click="handleSearchClick">查询</a-button>
  67. </div>
  68. <div style="margin-top: 8px;">
  69. <a-button type="link" @click="extend = !extend">
  70. <template v-if="!extend">
  71. <div>
  72. 展开
  73. <a-icon type="down" />
  74. </div>
  75. </template>
  76. <template v-else>
  77. <div>
  78. 收起
  79. <a-icon type="up" />
  80. </div>
  81. </template>
  82. </a-button>
  83. </div>
  84. </div>
  85. </a-form>
  86. <rx-button :class="{'knowledge-manage':yelpNum != 0}" :data-attr="yelpNum" alias="albumListComment" :butn-icon="'false'" @click="handleJumpPathClick('comment')">点评审核</rx-button>
  87. <rx-button :class="{'knowledge-manage':approveNum != 0}" :data-attr="approveNum" alias="albumListAudit" :butn-icon="'false'" @click="handleJumpPathClick('album')">专辑审核</rx-button>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <rx-grid
  93. ref="albumRef"
  94. class="table-style"
  95. style="background: #fff"
  96. :columns="columns"
  97. :url="api.query"
  98. :queryParam="queryParam"
  99. data-field="result.data"
  100. :defaultPageSize="10"
  101. :pageSizeOptions="['10','20','30','40']"
  102. idField="pkId"
  103. >
  104. <template slot="state" slot-scope="{text,record}">
  105. <div>{{ record.state == 0 ? '专辑关闭' : computedState(record.versionState) }}</div>
  106. </template>
  107. <template slot="action" slot-scope="{text,record}">
  108. <template v-if="record.actionFlagM.length">
  109. <rx-button v-show="record.actionFlagM.indexOf('edit') > -1" class="clearBtn" alias="albumListEdite" :butn-icon="'none'" @click="handleJumpUpdateClick(record)">编辑</rx-button>
  110. <rx-button v-show="record.actionFlagM.indexOf('delete') > -1" class="clearBtn" alias="albumListDel" :butn-icon="'none'" @click="handleDeleteClick(record)">删除</rx-button>
  111. <rx-button v-show="record.actionFlagM.indexOf('view') > -1" class="clearBtn" alias="albumListLook" :butn-icon="'none'" @click="handleJumpUpdateClick(record)">查看</rx-button>
  112. </template>
  113. </template>
  114. </rx-grid>
  115. </rx-fit>
  116. </div>
  117. </rx-layout>
  118. </template>
  119. <script>
  120. import breadcrumb from '../components/breadcrumb'
  121. import api from '@/api/knowledge/album/album'
  122. import classApi from '@/api/knowledge/classify'
  123. import mixin from "../aMixin/mixin"
  124. import initMixin from "../aMixin/initMixin"
  125. const albumMixin = new mixin('album')
  126. export default {
  127. name: 'knowledgeManageList',
  128. components: {
  129. breadcrumb
  130. },
  131. mixins: [ initMixin, albumMixin ],
  132. data() {
  133. return {
  134. api,
  135. classApi,
  136. extend: true,
  137. queryParam: {
  138. name: '',
  139. categoryId: '',
  140. ownerName: '',
  141. createTimeStart: '',
  142. createTimeEnd: '',
  143. },
  144. classifyLevelList: [],
  145. createTime: [],
  146. categoryIds: [],
  147. columns: [
  148. {
  149. title: '专辑ID',
  150. dataIndex: 'pkId',
  151. align: 'center',
  152. width: 200
  153. },
  154. {
  155. title: '专辑名称',
  156. dataIndex: 'name',
  157. align: 'center'
  158. },
  159. {
  160. title: '所属分类',
  161. dataIndex: 'categoryName',
  162. align: 'center',
  163. width: 150
  164. },
  165. {
  166. title: '收录知识量',
  167. dataIndex: 'knowledgeTotal',
  168. align: 'center',
  169. width: 100
  170. },
  171. {
  172. title: '点评量',
  173. dataIndex: 'yelpTotal',
  174. align: 'center',
  175. width: 100
  176. },
  177. {
  178. title: '访问量',
  179. dataIndex: 'views',
  180. align: 'center',
  181. width: 100
  182. },
  183. {
  184. title: '专辑负责人',
  185. dataIndex: 'ownerName',
  186. align: 'center',
  187. width: 100
  188. },
  189. {
  190. title: '创建时间',
  191. dataIndex: 'createTime',
  192. align: 'center',
  193. },
  194. {
  195. title: '状态',
  196. dataIndex: 'state',
  197. align: 'center',
  198. width: 100,
  199. scopedSlots: {customRender: 'state'}
  200. },
  201. {
  202. title: '操作人',
  203. dataIndex: 'operator',
  204. align: 'center',
  205. width: 100
  206. },
  207. {
  208. title: '操作时间',
  209. dataIndex: 'updateTime',
  210. align: 'center',
  211. },
  212. {
  213. title: '操作',
  214. dataIndex: 'action',
  215. // align: 'center',
  216. width: 100,
  217. scopedSlots: {customRender: 'action'}
  218. }
  219. ],
  220. knowledgeList: [
  221. {value: null, label: '全部'},
  222. {value: '1', label: '文档知识'},
  223. {value: '2', label: '维基知识'}
  224. ],
  225. yelpNum: 0,
  226. approveNum: 0
  227. }
  228. },
  229. created() {
  230. let albumClassifyId = this.$route.query.pkId
  231. if(albumClassifyId) {
  232. this.queryParam.categoryId = albumClassifyId
  233. this.categoryIds = [ albumClassifyId ]
  234. }
  235. this.init()
  236. },
  237. computed: {
  238. computedState() {
  239. return function(state) {
  240. switch (state) {
  241. case 1:
  242. return '审核中'
  243. case 2:
  244. return '发布中'
  245. case 3:
  246. return '无此状态'
  247. case 4:
  248. return '已驳回'
  249. }
  250. }
  251. }
  252. },
  253. methods: {
  254. async init() {
  255. let yelp = await api.yelp()
  256. this.yelpNum = yelp.data || 0
  257. let approve = await api.approve()
  258. this.approveNum = approve.data || 0
  259. let res = await api.categories()
  260. this.classifyLevelList = this.formatData(res.data)
  261. },
  262. formatData(data) {
  263. const that = this
  264. data.forEach((element) => {
  265. if (element.children && element.children.length > 0) {
  266. that.formatData(element.children)
  267. } else {
  268. delete element.children
  269. }
  270. })
  271. return data
  272. },
  273. handleSearchClick() {
  274. if(this.createTime && this.createTime.length) {
  275. this.queryParam.createTimeStart = this.createTime[0]
  276. this.queryParam.createTimeEnd = this.createTime[1]
  277. }
  278. if(this.categoryIds && this.categoryIds.length) {
  279. this.queryParam.categoryId = this.categoryIds.slice('-1')[0]
  280. }
  281. this.reloadTable()
  282. },
  283. // 跳转审核管理
  284. handleJumpPathClick(arg) {
  285. if(arg == 'comment') {
  286. this.$router.push({
  287. path: '/knowledge/commentAuditList',
  288. query: { showOnlyUser: true }
  289. })
  290. } else {
  291. this.$router.push({
  292. path: '/knowledge/albumAuditList',
  293. query: { showOnlyUser: true }
  294. })
  295. }
  296. },
  297. // 编辑
  298. handleJumpUpdateClick(record) {
  299. this.$router.push({
  300. path: '/knowledge/albumInfo',
  301. // pkId state: 专辑状态 versionState: 版本状态 showCheck
  302. query: { pkId: record.pkId, showCheck: false }
  303. })
  304. },
  305. // 重新加载表格
  306. reloadTable() {
  307. this.$refs.albumRef.loadData()
  308. },
  309. }
  310. }
  311. </script>
  312. <style lang="less" scoped>
  313. @gary: #f8f8f8;
  314. @white: #fff;
  315. .rx-fit {
  316. padding: 40px!important;
  317. background: @gary;
  318. .fit-header {
  319. .mainContent {
  320. width: 100%;
  321. .body {
  322. background: @white;
  323. padding: 10px 0 10px 20px;
  324. .content {
  325. background: @white;
  326. button:first-child {
  327. margin-right: 20px;
  328. }
  329. >button {
  330. margin: 10px;
  331. margin-left: 0;
  332. }
  333. }
  334. }
  335. }
  336. }
  337. .table-style {
  338. padding: 20px;
  339. .clearBtn {
  340. background: none;
  341. color: #3294F7;
  342. text-shadow: none;
  343. padding: 0px 6px;
  344. border: none;
  345. box-shadow: none;
  346. }
  347. }
  348. }
  349. .knowledge-manage {
  350. position: relative;
  351. }
  352. .knowledge-manage::after {
  353. position: absolute;
  354. top: -11px;
  355. left: 76px;
  356. content: attr(data-attr);
  357. width: 20px;
  358. height: 20px;
  359. background: red;
  360. border-radius: 50%;
  361. }
  362. .show-other{
  363. width: 100%;
  364. animation:show-other-search 0.8s;
  365. }
  366. @keyframes show-other-search{
  367. 0%{opacity:0;}
  368. 50%{opacity:0.8;}
  369. 100%{opacity: 1;}
  370. }
  371. </style>
  372. <style scoped>
  373. /deep/ .ant-btn > .anticon + span {
  374. margin-left: 0;
  375. }
  376. /deep/.ant-table-thead > tr > th {
  377. text-align: center;
  378. height: 54px;
  379. }
  380. /deep/ .ant-table-tbody > tr > td {
  381. height: 54px;
  382. }
  383. /deep/ .ant-form{
  384. padding: 0;
  385. }
  386. /deep/ .gridContent{
  387. border: none;
  388. }
  389. </style>