index.vue 7.7 KB

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