index.vue 8.6 KB

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