index.vue 8.9 KB

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