index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <div class="app-container">
  3. <!-- 搜索区域 -->
  4. <div class="filter-container">
  5. <div class="filter-control">
  6. <span>设备名称:</span>
  7. <el-input v-model="listQuery.productName" placeholder="请输入设备名称" @keyup.enter.native="getList" />
  8. </div>
  9. <div class="filter-control">
  10. <span>设备SN码:</span>
  11. <el-input v-model="listQuery.snCode" placeholder="请输入设备SN码" @keyup.enter.native="getList" />
  12. </div>
  13. <div class="filter-control">
  14. <span>审核状态:</span>
  15. <el-select v-model="listQuery.reviewStatus" placeholder="供应商类型" clearable @change="getList">
  16. <el-option label="所有类型" value="" />
  17. <el-option label="待审核" :value="1" />
  18. <el-option label="审核通过" :value="2" />
  19. <el-option label="审核未通过" :value="0" />
  20. </el-select>
  21. </div>
  22. <div class="filter-control">
  23. <el-button type="primary" @click="getList">查询</el-button>
  24. </div>
  25. </div>
  26. <!-- 搜索区域END -->
  27. <!-- 表格区域 -->
  28. <el-table
  29. v-loading="listLoading"
  30. :data="list"
  31. style="width: 100%"
  32. border
  33. fit
  34. highlight-current-row
  35. header-row-class-name="tableHeader"
  36. cell-class-name="table-cell"
  37. >
  38. <el-table-column :index="indexMethod" label="序号" type="index" width="80" align="center" />
  39. <el-table-column prop="productName" label="设备名称" align="center" />
  40. <el-table-column prop="snCode" label="设备SN码" align="center" />
  41. <el-table-column label="审核状态" width="120px" align="center">
  42. <template slot-scope="{ row }">
  43. <audit-status :status="row.auditStatus" :reason="row.invalidReason" />
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="审核时间" width="160px" align="center">
  47. <template slot-scope="{ row }">
  48. <span v-if="row.auditStatus !== 2">{{ row.auditTime | formatTime }}</span>
  49. <span v-else>—</span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="审核人" align="center">
  53. <template slot-scope="{ row }">
  54. <span v-if="row.auditStatus !== 2">{{ row.auditBy }}</span>
  55. <span v-else>—</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="操作" width="240px" align="center">
  59. <template slot-scope="{ row }">
  60. <audit-button-group
  61. :review="row.auditStatus !== 2"
  62. :type="row.auditStatus === 1 ? 'result' : 'audit'"
  63. :is-dot="row.checkFlag === 0"
  64. :margin-right="false"
  65. @click="onClick(row, $event)"
  66. />
  67. </template>
  68. </el-table-column>
  69. </el-table>
  70. <!-- 表格区域END -->
  71. <!-- 页码 -->
  72. <pagination
  73. :total="total"
  74. :page.sync="listQuery.pageNum"
  75. :limit.sync="listQuery.pageSize"
  76. @pagination="fetchProductList"
  77. />
  78. <!-- 审核弹窗 -->
  79. <el-dialog title="驳回" :visible.sync="resultVisible" width="30%" @close="onDialogClose">
  80. <div class="auth-info">
  81. <el-form ref="formRef" :model="dialogData" label-width="80px" :rules="rules">
  82. <el-form-item label="原因:" prop="invalidReason">
  83. <el-input v-model="dialogData.invalidReason" type="textarea" rows="4" placeholder="请说明原因" />
  84. </el-form-item>
  85. </el-form>
  86. </div>
  87. <div slot="footer">
  88. <el-button @click="resultVisible = false">取 消</el-button>
  89. <el-button type="primary" @click="onSubmit">确 定</el-button>
  90. </div>
  91. </el-dialog>
  92. </div>
  93. </template>
  94. <script>
  95. import { auditProduct, getProdList } from '@/api/product'
  96. export default {
  97. name: 'AuditClubDeviceList',
  98. data() {
  99. return {
  100. listLoading: false,
  101. resultVisible: false,
  102. listQuery: {
  103. listType: 2,
  104. authId: '',
  105. productName: '',
  106. reviewStatus: '',
  107. snCode: '',
  108. pageNum: 1,
  109. pageSize: 10
  110. },
  111. total: 0,
  112. list: [],
  113. dialogData: {
  114. productId: '', // 授权机构id
  115. auditStatus: 0, // 审核状态
  116. invalidReason: '' // 审核信息
  117. },
  118. rules: {
  119. invalidReason: [{ required: true, message: '不通过原因不能为空', tigger: 'blur' }]
  120. }
  121. }
  122. },
  123. created() {
  124. this.listQuery.authId = this.$route.query.authId
  125. this.getList()
  126. },
  127. methods: {
  128. // 获取列表信息
  129. async getList() {
  130. this.listQuery.pageNum = 1
  131. this.list = []
  132. this.fetchProductList()
  133. },
  134. async fetchProductList() {
  135. try {
  136. this.listLoading = true
  137. const res = await getProdList(this.listQuery)
  138. this.total = res.data.total
  139. this.list = res.data.list
  140. } catch (error) {
  141. console.log(error)
  142. } finally {
  143. this.listLoading = false
  144. }
  145. },
  146. // 按钮组点击事件
  147. onClick(row, type) {
  148. const actions = {
  149. review: this.onReview,
  150. result: this.onResult,
  151. audit: this.onAudit
  152. }
  153. actions[type](row)
  154. },
  155. // 预览
  156. onReview(row) {
  157. this.$router.push(
  158. `/audit/club/device-detail?relationId=${row.relationId}&productId=${row.productId}&authId=${this.listQuery.authId}&type=review`
  159. )
  160. },
  161. // 驳回
  162. onResult(row) {
  163. this.resultVisible = true
  164. this.dialogData.productId = row.productId
  165. },
  166. // 审核
  167. onAudit(row) {
  168. this.$router.push(
  169. `/audit/club/device-detail?relationId=${row.relationId}&productId=${row.productId}&authId=${this.listQuery.authId}&type=audit`
  170. )
  171. },
  172. // 审核
  173. async onSubmit() {
  174. try {
  175. await this.$refs.formRef.validate()
  176. await this.onAuthResult()
  177. } catch (error) {
  178. console.log(error)
  179. }
  180. },
  181. // 驳回
  182. async onAuthResult() {
  183. try {
  184. await auditProduct(this.dialogData)
  185. this.$message.success('驳回成功')
  186. this.getList()
  187. this.resultVisible = false
  188. } catch (error) {
  189. console.log(error)
  190. }
  191. },
  192. onDialogClose() {
  193. this.$refs.formRef.resetFields()
  194. },
  195. indexMethod(index) {
  196. return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
  197. }
  198. }
  199. }
  200. </script>
  201. <style lang="scss" scoped>
  202. .el-table .cell {
  203. overflow: visible;
  204. }
  205. </style>