index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <div class="app-container review-box">
  3. <!-- 搜索区域 -->
  4. <div class="filter-container">
  5. <div class="filter-control">
  6. <span>文件名称:</span>
  7. <el-input
  8. v-model="listQuery.fileTitle"
  9. placeholder="文件名称"
  10. @keyup.enter.native="getList"
  11. />
  12. </div>
  13. <div class="filter-control">
  14. <span>审核状态:</span>
  15. <el-select
  16. v-model="listQuery.auditStatus"
  17. placeholder="审核状态"
  18. clearable
  19. @change="getList"
  20. >
  21. <el-option label="全部" value="" />
  22. <el-option label="待审核" :value="2" />
  23. <el-option label="审核通过" :value="1" />
  24. <el-option label="审核未通过" :value="0" />
  25. </el-select>
  26. </div>
  27. <div class="filter-control">
  28. <el-button type="primary" @click="getList">查询</el-button>
  29. </div>
  30. </div>
  31. <!-- 搜索区域END -->
  32. <!-- 表格区域 -->
  33. <el-table
  34. v-loading="listLoading"
  35. :data="list"
  36. style="width: 100%"
  37. border
  38. fit
  39. highlight-current-row
  40. header-row-class-name="tableHeader"
  41. cell-class-name="table-cell"
  42. >
  43. <el-table-column label="序号" :index="indexMethod" type="index" width="80" align="center" />
  44. <el-table-column label="文件名称" prop="fileTitle" align="center" />
  45. <el-table-column label="审核状态" width="150px" align="center">
  46. <template slot-scope="{ row }">
  47. <el-tag v-if="row.auditStatus === 2" size="small" type="warning">待审核</el-tag>
  48. <el-tag v-if="row.auditStatus === 1" size="small" type="success">审核通过</el-tag>
  49. <!-- 未通过原因展示 -->
  50. <template v-if="row.auditStatus === 0">
  51. <!-- <span class="status danger">审核未通过&nbsp;</span> -->
  52. <el-popover
  53. placement="top-start"
  54. title="审核说明"
  55. width="400"
  56. trigger="hover"
  57. :content="row.invalidReason"
  58. >
  59. <el-tag slot="reference" size="small" type="danger" class="reason">
  60. <span>审核未通过</span>
  61. <span class="el-icon-question status danger " />
  62. </el-tag>
  63. </el-popover>
  64. <!-- 未通过原因展示END -->
  65. </template>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="审核时间" width="250px" align="center">
  69. <template slot-scope="{row}">
  70. <span v-if="row.auditStatus!==2">{{ row.auditTime | formatTime }}</span>
  71. <span v-else>—</span>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="审核人" align="center" width="200px">
  75. <template slot-scope="{row}">
  76. <span v-if="row.auditStatus!==2">{{ row.auditBy }}</span>
  77. <span v-else>—</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="操作" width="150px" align="center">
  81. <template slot-scope="{row}">
  82. <el-button
  83. v-if="row.auditStatus===2"
  84. type="primary"
  85. size="mini"
  86. style="margin-right:5px"
  87. icon="el-icon-s-check"
  88. @click="handleShowDialog(row)"
  89. >审核</el-button>
  90. <span v-else class="status success el-icon-check">&nbsp;已审核</span>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. <!-- 表格区域END -->
  95. <!-- 页码 -->
  96. <pagination v-show="total > 0" :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList(listQuery)" />
  97. <!-- 视频预览对话框 -->
  98. <el-dialog
  99. title="视频审核"
  100. :visible.sync="dialogVisible"
  101. width="40%"
  102. @closed="dialogColosed"
  103. >
  104. <el-form ref="formRef" :model="dialogData" label-width="65px" :rules="dialogFormRules">
  105. <el-form-item label="标题:">
  106. {{ current.fileTitle }}
  107. </el-form-item>
  108. <el-form-item label="文件:">
  109. <img src="@/assets/img/pdf_cover.png" alt="文件封面" width="60" height="60">
  110. <span class="preview" @click.prevent="handlePreviewFile">预览</span>
  111. </el-form-item>
  112. <el-form-item label="审核:">
  113. <el-radio-group v-model="dialogData.auditStatus">
  114. <el-radio :label="1">通过</el-radio>
  115. <el-radio :label="0">不通过</el-radio>
  116. </el-radio-group>
  117. </el-form-item>
  118. <el-form-item v-if="dialogData.auditStatus === 0" label="原因:" prop="invalidReason">
  119. <el-input v-model="dialogData.invalidReason" type="textarea" placeholder="请说明原因" />
  120. </el-form-item>
  121. </el-form>
  122. <div slot="footer" class="dialog-footer">
  123. <el-button @click="dialogVisible = false">取 消</el-button>
  124. <el-button type="primary" @click="handleAuditStatus">提 交</el-button>
  125. </div>
  126. </el-dialog>
  127. <!-- 视频预览对话框END -->
  128. </div>
  129. </template>
  130. <script>
  131. import Pagination from '@/components/Pagination'
  132. import openWindow from '@/utils/open-window'
  133. import { formatDate } from '@/utils'
  134. import { getFileList } from '@/api/doc'
  135. import { auditfile } from '@/api/docReview'
  136. import { mapGetters } from 'vuex'
  137. export default {
  138. components: { Pagination },
  139. filters: {
  140. formatTime(time) {
  141. if (!time) {
  142. return ''
  143. }
  144. return formatDate(time, 'yyyy-MM-DD HH:mm:ss')
  145. }
  146. },
  147. data() {
  148. return {
  149. dialogVisible: false, // 文件审核dialog是否显示
  150. listLoading: false, // 列表加载
  151. total: 0, // 列表数据条数
  152. listQuery: {
  153. authUserId: '', // 机构id
  154. auditStatus: '', // 审核状态
  155. fileTitle: '', // 文件标题
  156. listType: 2, // 列表类型
  157. pageNum: 1, // 页码
  158. pageSize: 10, // 分页大小
  159. status: '' // 文章状态:0已下线,1已上线,2待上线
  160. },
  161. list: [],
  162. // 当前审核选中的文件数据,需要传给预览窗口的数据
  163. current: {
  164. currentfileUrl: '',
  165. fileTitle: ''
  166. },
  167. // 审核提交数据
  168. dialogData: {
  169. fileId: '', // 文章id
  170. auditStatus: 1, // 审核状态
  171. invalidReason: '', // 不同过原因
  172. auditBy: '' // 审核人
  173. },
  174. dialogFormRules: {
  175. invalidReason: { required: true, message: '不通过原因不能为空', tigger: 'blur' }
  176. }
  177. }
  178. },
  179. computed: {
  180. ...mapGetters(['authUserId'])
  181. },
  182. created() {
  183. this.listQuery.authUserId = this.$route.query.authUserId
  184. this.getList()
  185. },
  186. methods: {
  187. // 获取列表数据
  188. getList() {
  189. this.listLoading = true
  190. getFileList(this.listQuery)
  191. .then(res => {
  192. if (res.code !== 0) return
  193. this.list = res.data.list
  194. this.total = res.data.total
  195. console.log(res)
  196. })
  197. .finally(() => {
  198. this.listLoading = false
  199. })
  200. },
  201. // 显示审核dialog对话框
  202. handleShowDialog(row) {
  203. console.log('------')
  204. console.log(row)
  205. this.current.currentfileUrl = row.filePreviewUrl
  206. this.current.fileTitle = row.fileTitle
  207. this.dialogData.fileId = row.fileId
  208. this.dialogVisible = true
  209. },
  210. // dialog关闭后的回调
  211. dialogColosed() {
  212. this.currentfileUrl = ''
  213. this.current.currentfileUrl = ''
  214. this.current.fileTitle = ''
  215. this.dialogData.auditStatus = 1
  216. this.dialogData.fileId = ''
  217. },
  218. // 审核操作
  219. handleAuditStatus() {
  220. this.$refs.formRef.validate(valid => {
  221. if (valid) {
  222. this.dialogData.auditBy = this.authUserId
  223. auditfile(this.dialogData)
  224. .then(res => {
  225. console.log(res)
  226. if (res.code !== 0) return
  227. this.$message({
  228. message: res.data,
  229. type: 'success',
  230. duration: 1000
  231. })
  232. this.dialogVisible = false
  233. this.getList()
  234. })
  235. }
  236. })
  237. },
  238. // 小窗口浏览pdf文件
  239. handlePreviewFile() {
  240. openWindow(this.current.currentfileUrl, this.current.fileTitle, this.current.fileTitle, 1200, 600)
  241. },
  242. indexMethod(index) {
  243. return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
  244. }
  245. }
  246. }
  247. </script>
  248. <style lang="scss" scoped>
  249. .el-table .cell {
  250. overflow: visible;
  251. }
  252. .el-badge{
  253. margin: 0 6px;
  254. }
  255. .preview{
  256. cursor: pointer;
  257. margin-left: 5px;
  258. color: #0eaae7;
  259. }
  260. </style>