Sfoglia il codice sorgente

管理员端v1.7.2事后审核接口调试

yuwenjun1997 2 anni fa
parent
commit
bfe2a13f0c

+ 8 - 1
src/api/auth.js

@@ -73,6 +73,14 @@ export function auditAuth(data) {
   })
 }
 
+// 审核-已查看
+export function auditAuthCheck(id) {
+  return request({
+    url: `/auth/check/${id}`,
+    method: 'post'
+  })
+}
+
 // 获取用户反馈信息列表
 export function getFeedbackList(params) {
   return request({
@@ -189,4 +197,3 @@ export function setStarClub(data) {
     data
   })
 }
-

+ 9 - 1
src/api/doctor.js

@@ -46,7 +46,7 @@ export function doctorStatusChange(data) {
 }
 
 // 审核
-export function doctorAudit(data) {
+export function auditDoctor(data) {
   return request({
     url: '/doctor/audit',
     method: 'post',
@@ -54,6 +54,14 @@ export function doctorAudit(data) {
   })
 }
 
+// 审核
+export function auditDoctorCheck(id) {
+  return request({
+    url: `/doctor/check/${id}`,
+    method: 'post'
+  })
+}
+
 // 医师机构列表
 export function fetchDoctorClubList(params) {
   return request({

+ 18 - 0
src/api/product.js

@@ -54,6 +54,14 @@ export function auditProduct(data) {
   })
 }
 
+// 审核商品 /auth/product/audit
+export function auditProductCheck(id) {
+  return request({
+    url: `/auth/product/check/${id}`,
+    method: 'post'
+  })
+}
+
 // 添加设备分类
 export function createProductCate(data) {
   return request({
@@ -116,6 +124,15 @@ export function auditProductCate(data) {
     data
   })
 }
+
+// 设备分类审核
+export function auditProductCateCheck(id) {
+  return request({
+    url: `/auth/product/type/check/${id}`,
+    method: 'post'
+  })
+}
+
 // 设备sn码列表
 export function fetchProductSnList(params) {
   return request({
@@ -124,6 +141,7 @@ export function fetchProductSnList(params) {
     params
   })
 }
+
 // 通过sn码获取设备信息
 export function fetchDetialBySnCode(params) {
   return request({

+ 5 - 1
src/components/AuditButtonGroup/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="audit-button-group">
-    <el-badge :is-dot="isDot" class="mr-12">
+    <el-badge v-if="review" :is-dot="isDot" class="mr-12">
       <el-button type="primary" size="mini" @click="onClick('review')">查看</el-button>
     </el-badge>
     <template v-if="type === 'result'">
@@ -32,6 +32,10 @@ export default {
     marginRight: {
       type: Boolean,
       default: false
+    },
+    review: {
+      type: Boolean,
+      default: false
     }
   },
   methods: {

+ 0 - 1
src/components/Pagination/index.vue

@@ -93,7 +93,6 @@ export default {
 <style scoped>
 .pagination-container {
   background: #fff;
-  padding: 32px 16px;
 }
 .pagination-container.hidden {
   display: none;

+ 93 - 28
src/views/admin/audit/club/device/index.vue

@@ -57,28 +57,49 @@
       </el-table-column>
       <el-table-column label="操作" width="240px" align="center">
         <template slot-scope="{ row }">
-          <!-- <el-button
-            v-if="row.auditStatus !== 1"
-            type="primary"
-            size="mini"
-            @click="navigationTo(`/audit/club/device-detail?id=${row.productId}&authId=${listQuery.authId}`)"
-          >审核</el-button> -->
-          <audit-button-group type="audit" :is-dot="true" :margin-right="false" @click="onClick(row, $event)" />
+          <audit-button-group
+            :review="row.auditStatus !== 2"
+            :type="row.auditStatus === 1 ? 'result' : 'audit'"
+            :is-dot="row.checkFlag === 0"
+            :margin-right="false"
+            @click="onClick(row, $event)"
+          />
         </template>
       </el-table-column>
     </el-table>
     <!-- 表格区域END -->
     <!-- 页码 -->
-    <pagination :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList" />
+    <pagination
+      :total="total"
+      :page.sync="listQuery.pageNum"
+      :limit.sync="listQuery.pageSize"
+      @pagination="fetchProductList"
+    />
+
+    <!-- 审核弹窗 -->
+    <el-dialog title="驳回" :visible.sync="resultVisible" width="30%" @close="onDialogClose">
+      <div class="auth-info">
+        <el-form ref="formRef" :model="dialogData" label-width="80px" :rules="rules">
+          <el-form-item label="原因:" prop="invalidReason">
+            <el-input v-model="dialogData.invalidReason" type="textarea" rows="4" placeholder="请说明原因" />
+          </el-form-item>
+        </el-form>
+      </div>
+      <div slot="footer">
+        <el-button @click="resultVisible = false">取 消</el-button>
+        <el-button type="primary" @click="onSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { getProdList } from '@/api/product'
+import { auditProduct, getProdList } from '@/api/product'
 export default {
   data() {
     return {
       listLoading: false,
+      resultVisible: false,
       listQuery: {
         listType: 2,
         authId: '',
@@ -89,7 +110,15 @@ export default {
         pageSize: 10
       },
       total: 0,
-      list: []
+      list: [],
+      dialogData: {
+        productId: '', // 授权机构id
+        auditStatus: 0, // 审核状态
+        invalidReason: '' // 审核信息
+      },
+      rules: {
+        invalidReason: [{ required: true, message: '不通过原因不能为空', tigger: 'blur' }]
+      }
     }
   },
   created() {
@@ -97,6 +126,26 @@ export default {
     this.getList()
   },
   methods: {
+    // 获取列表信息
+    async getList() {
+      this.listQuery.pageNum = 1
+      this.list = []
+      this.fetchProductList()
+    },
+
+    async fetchProductList() {
+      try {
+        this.listLoading = true
+        const res = await getProdList(this.listQuery)
+        this.total = res.data.total
+        this.list = res.data.list
+      } catch (error) {
+        console.log(error)
+      } finally {
+        this.listLoading = false
+      }
+    },
+
     // 按钮组点击事件
     onClick(row, type) {
       const actions = {
@@ -109,32 +158,48 @@ export default {
 
     // 预览
     onReview(row) {
-      console.log('预览')
-      this.$router.push(`/audit/club/device-detail?productId=${row.productId}&authId=${this.listQuery.authId}&type=review`)
+      this.$router.push(
+        `/audit/club/device-detail?relationId=${row.relationId}&productId=${row.productId}&authId=${this.listQuery.authId}&type=review`
+      )
     },
     // 驳回
     onResult(row) {
-      console.log('驳回')
+      this.resultVisible = true
+      this.dialogData.productId = row.productId
     },
     // 审核
     onAudit(row) {
-      this.$router.push(`/audit/club/device-detail?productId=${row.productId}&authId=${this.listQuery.authId}&type=audit`)
+      this.$router.push(
+        `/audit/club/device-detail?relationId=${row.relationId}&productId=${row.productId}&authId=${this.listQuery.authId}&type=audit`
+      )
     },
-    // 过滤列表
-    handleFilter() {},
-    // 获取列表信息
-    getList() {
-      this.listLoading = true
-      getProdList(this.listQuery)
-        .then((res) => {
-          if (res.code !== 0) return
-          this.total = res.data.total
-          this.list = res.data.list
-        })
-        .finally(() => {
-          this.listLoading = false
-        })
+
+    // 审核
+    async onSubmit() {
+      try {
+        await this.$refs.formRef.validate()
+        await this.onAuthResult()
+      } catch (error) {
+        console.log(error)
+      }
     },
+
+    // 驳回
+    async onAuthResult() {
+      try {
+        await auditProduct(this.dialogData)
+        this.$message.success('驳回成功')
+        this.getList()
+        this.resultVisible = false
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
+    onDialogClose() {
+      this.$refs.formRef.resetFields()
+    },
+
     indexMethod(index) {
       return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
     }

+ 38 - 25
src/views/admin/audit/club/device/review.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="page-form-container">
-    <device-detail :product-id="productId" />
+    <device-detail :product-id="auditForm.productId" :relation-id="auditForm.relationId" />
     <template v-if="type === 'audit'">
       <el-form ref="auditForm" label-width="112px" :model="auditForm" :rules="rules">
         <el-form-item label="审核:">
@@ -22,7 +22,7 @@
 </template>
 
 <script>
-import { auditProduct } from '@/api/product'
+import { auditProduct, auditProductCheck } from '@/api/product'
 import { mapGetters } from 'vuex'
 import { DeviceDetail } from '@/views/components'
 export default {
@@ -32,11 +32,10 @@ export default {
   data() {
     return {
       type: 'review',
-      productId: '',
       auditForm: {
+        authId: '',
         productId: '',
-        auditBy: '', // 审核人id
-        authId: '', // 机构id
+        relationId: '',
         auditStatus: 1, // 审核状态
         invalidReason: '' // 审核信息
       },
@@ -49,30 +48,44 @@ export default {
     ...mapGetters(['authUserId'])
   },
   created() {
-    this.authId = this.$route.query.authId
-    this.productId = this.$route.query.productId
+    this.auditForm.authId = this.$route.query.authId
+    this.auditForm.productId = this.$route.query.productId
+    this.auditForm.relationId = this.$route.query.relationId
     this.type = this.$route.query.type
+    this.auditAuthCheck()
   },
   methods: {
+    async auditAuthCheck() {
+      try {
+        await auditProductCheck(this.auditForm.productId)
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
     // 提交审核信息
-    submit() {
-      this.auditForm.productId = this.productId
-      this.$refs.auditForm.validate((valid) => {
-        if (valid) {
-          this.isLoading = true
-          // 指定审核人
-          this.auditForm.auditBy = this.authUserId
-          auditProduct(this.auditForm)
-            .then((res) => {
-              this.$message.success(res.data)
-              this.$store.dispatch('tagsView/delView', this.$route)
-              this.$router.back()
-            })
-            .finally(() => {
-              this.isLoading = false
-            })
-        }
-      })
+    async submit() {
+      try {
+        await this.$refs.auditForm.validate()
+        this.onAudit()
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
+    // 审核
+    async onAudit() {
+      try {
+        this.isLoading = true
+        const res = await auditProduct(this.auditForm)
+        this.$message.success(res.data)
+        this.$store.dispatch('tagsView/delView', this.$route)
+        this.$router.back()
+      } catch (error) {
+        console.log(error)
+      } finally {
+        this.isLoading = false
+      }
     }
   }
 }

+ 68 - 92
src/views/admin/audit/club/list.vue

@@ -69,14 +69,13 @@
 
       <el-table-column label="操作" width="280px" align="center">
         <template slot-scope="{ row }">
-          <audit-button-group type="audit" :is-dot="true" :margin-right="true" @click="onClick(row, $event)" />
-          <!-- <el-button
-            v-if="row.auditStatus !== 1"
-            type="warning"
-            size="mini"
-            style="margin-right: 12px"
-            @click="navigationTo(`/audit/club/club-detail?authId=${row.authId}`)"
-          >审核</el-button> -->
+          <audit-button-group
+            :review="row.auditStatus !== 2"
+            :type="row.auditStatus === 1 ? 'result' : 'audit'"
+            :is-dot="row.checkFlag === 0"
+            :margin-right="true"
+            @click="onClick(row, $event)"
+          />
           <el-badge :hidden="row.lowerAuditStatus === 1" :value="row.waitAuditNum" :max="99">
             <el-button
               type="primary"
@@ -89,29 +88,24 @@
     </el-table>
     <!-- 表格区域END -->
     <!-- 页码 -->
-    <pagination :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList" />
+    <pagination
+      :total="total"
+      :page.sync="listQuery.pageNum"
+      :limit.sync="listQuery.pageSize"
+      @pagination="fecthAuthList"
+    />
     <!-- 审核弹窗 -->
-    <el-dialog title="授权机构审核" :visible.sync="dialogVisible" width="450px" @close="dialogClosed">
+    <el-dialog title="驳回" :visible.sync="resultVisible" width="30%" @close="onDialogClose">
       <div class="auth-info">
-        <div class="auth-name">
-          <i>授权机构:</i>
-          <b>{{ dialogData.authParty }}</b>
-        </div>
-        <el-form ref="formRef" :model="dialogData" label-width="85px" :rules="dialogFormRules">
-          <el-form-item label="审核状态:">
-            <el-radio-group v-model="dialogData.auditStatus">
-              <el-radio :label="1">通过</el-radio>
-              <el-radio :label="0">不通过</el-radio>
-            </el-radio-group>
-          </el-form-item>
-          <el-form-item v-if="dialogData.auditStatus === 0" label="原因:" prop="invalidReason">
-            <el-input v-model="dialogData.invalidReason" type="textarea" placeholder="请说明原因" />
+        <el-form ref="formRef" :model="dialogData" label-width="80px" :rules="rules">
+          <el-form-item label="原因:" prop="invalidReason">
+            <el-input v-model="dialogData.invalidReason" type="textarea" rows="4" placeholder="请说明原因" />
           </el-form-item>
         </el-form>
       </div>
       <div slot="footer">
-        <el-button @click="dialogVisible = false">取 消</el-button>
-        <el-button type="primary" @click="auditStatusHandle">确 定</el-button>
+        <el-button @click="resultVisible = false">取 消</el-button>
+        <el-button type="primary" @click="onSubmit">确 定</el-button>
       </div>
     </el-dialog>
   </div>
@@ -119,12 +113,12 @@
 
 <script>
 import { fecthAuthList, auditAuth } from '@/api/auth'
-import { mapGetters, mapMutations } from 'vuex'
+import { mapGetters } from 'vuex'
 export default {
   data() {
     return {
       // 是否显示dialog
-      dialogVisible: false,
+      resultVisible: false,
       listLoading: false,
       // 查询参数
       listQuery: {
@@ -138,18 +132,12 @@ export default {
       },
       total: 0,
       dialogData: {
-        auditBy: '', // 审核人
         authId: '', // 授权机构id
-        authParty: '', // 授权机构名称
-        auditStatus: 1, // 审核状态
+        auditStatus: 0, // 审核状态
         invalidReason: '' // 审核信息
       },
-      dialogFormRules: {
-        invalidReason: {
-          required: true,
-          message: '不通过原因不能为空',
-          tigger: 'blur'
-        }
+      rules: {
+        invalidReason: [{ required: true, message: '不通过原因不能为空', tigger: 'blur' }]
       },
       // 机构信息审核列表
       list: []
@@ -163,7 +151,26 @@ export default {
     this.getList()
   },
   methods: {
-    ...mapMutations({ setMessageState: 'webSocket/SET_MESSAGE_STATE' }),
+    // 获取授权列表
+    async getList() {
+      this.listQuery.pageNum = 1
+      this.list = []
+      this.fecthAuthList()
+    },
+
+    async fecthAuthList() {
+      try {
+        this.listLoading = true
+        const res = await fecthAuthList(this.listQuery)
+        const { list, total } = res.data
+        this.list = list
+        this.total = total
+      } catch (error) {
+        console.log(error)
+      } finally {
+        this.listLoading = false
+      }
+    },
 
     // 按钮组点击事件
     onClick(row, type) {
@@ -177,78 +184,47 @@ export default {
 
     // 预览
     onReview(row) {
-      console.log('预览')
       this.$router.push(`/audit/club/club-detail?authId=${row.authId}&type=review`)
     },
     // 驳回
     onResult(row) {
-      console.log('驳回')
+      this.resultVisible = true
+      this.dialogData.authId = row.authId
     },
     // 审核
     onAudit(row) {
       this.$router.push(`/audit/club/club-detail?authId=${row.authId}&type=audit`)
     },
 
-    // 获取授权列表
-    getList() {
-      this.listLoading = true
-      fecthAuthList(this.listQuery)
-        .then((response) => {
-          if (response.code !== 0) return
-          const { list, total } = response.data
-          this.list = list
-          this.total = total
-        })
-        .finally(() => {
-          this.listLoading = false
-        })
-    },
     // 审核
-    auditStatusHandle() {
-      this.$refs.formRef.validate((valid) => {
-        if (valid) {
-          // 指定审核人
-          this.dialogData.auditBy = this.authUserId
-          // 提交审核信息
-          auditAuth(this.dialogData)
-            .then((res) => {
-              if (res.code !== 0) return
-              this.$message.success(res.data)
-              this.setMessageState({ id: this.dialogData.authId, type: 1 })
-            })
-            .finally(() => {
-              this.dialogVisible = false
-              this.getList()
-            })
-        }
-      })
+    async onSubmit() {
+      try {
+        await this.$refs.formRef.validate()
+        await this.onAuthResult()
+      } catch (error) {
+        console.log(error)
+      }
     },
-    // 审核对话框
-    handleShowDialog(item) {
-      console.log(item)
-      this.dialogData.authParty = item.authParty
-      this.dialogData.authId = item.authId
-      this.dialogVisible = true
+
+    // 驳回
+    async onAuthResult() {
+      try {
+        await auditAuth(this.dialogData)
+        this.$message.success('驳回成功')
+        this.getList()
+        this.resultVisible = false
+      } catch (error) {
+        console.log(error)
+      }
     },
-    // 审核对话框关闭
-    dialogClosed() {
-      this.dialogData.authParty = ''
-      this.dialogData.reviewStatus = 1
+
+    onDialogClose() {
+      this.$refs.formRef.resetFields()
     },
+
     indexMethod(index) {
       return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
     }
   }
 }
 </script>
-
-<style lang="scss" scoped>
-.auth-info {
-  .auth-name {
-    font-size: 16px;
-    padding-bottom: 25px;
-    border-bottom: 1px solid #ddd;
-    margin-bottom: 25px;
-  }
-}
-</style>

+ 37 - 19
src/views/admin/audit/club/review.vue

@@ -1,6 +1,6 @@
 <template>
-  <div class="page-form-container">
-    <club-detail :auth-id="authId" />
+  <div v-loading="isLoading" class="page-form-container">
+    <club-detail :auth-id="auditForm.authId" />
     <template v-if="type === 'audit'">
       <el-form ref="auditForm" label-width="112px" :model="auditForm" :rules="rules">
         <el-form-item label="审核:">
@@ -22,7 +22,7 @@
 </template>
 
 <script>
-import { auditAuth } from '@/api/auth'
+import { auditAuth, auditAuthCheck } from '@/api/auth'
 import { ClubDetail } from '@/views/components'
 import { mapGetters } from 'vuex'
 export default {
@@ -31,10 +31,9 @@ export default {
   },
   data() {
     return {
+      isLoading: false,
       type: 'review',
-      authId: '',
       auditForm: {
-        auditBy: '', // 审核人id
         authId: '', // 机构id
         auditStatus: 1, // 审核状态
         invalidReason: '' // 审核信息
@@ -48,10 +47,19 @@ export default {
     ...mapGetters(['authUserId'])
   },
   created() {
-    this.authId = this.$route.query.authId
+    this.auditForm.authId = this.$route.query.authId
     this.type = this.$route.query.type
+    this.auditAuthCheck()
   },
   methods: {
+    async auditAuthCheck() {
+      try {
+        await auditAuthCheck(this.auditForm.authId)
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
     // 地图定位
     initMap() {
       this.dialogMapVisible = true
@@ -61,20 +69,30 @@ export default {
         })
       }
     },
+
     // 提交审核信息
-    submit() {
-      this.auditForm.authId = this.authId
-      this.auditForm.auditBy = this.authUserId
-      this.$refs.auditForm.validate((valid) => {
-        if (valid) {
-          // 提交审核信息
-          auditAuth(this.auditForm).then((res) => {
-            this.$message.success(res.data)
-            this.$store.dispatch('tagsView/delView', this.$route)
-            this.$router.back()
-          })
-        }
-      })
+    async submit() {
+      try {
+        await this.$refs.auditForm.validate()
+        this.onAudit()
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
+    // 审核
+    async onAudit() {
+      try {
+        this.isLoading = true
+        const res = await auditAuth(this.auditForm)
+        this.$message.success(res.data)
+        this.$store.dispatch('tagsView/delView', this.$route)
+        this.$router.back()
+      } catch (error) {
+        console.log(error)
+      } finally {
+        this.isLoading = false
+      }
     }
   }
 }

+ 84 - 13
src/views/admin/audit/device/list.vue

@@ -49,22 +49,49 @@
       </el-table-column>
       <el-table-column label="操作" width="240px" align="center">
         <template slot-scope="{ row }">
-          <!-- <el-button v-if="row.auditStatus !== 1" type="warning" size="mini" @click="handleAudit(row)">审核</el-button>
-          <span v-else class="status success el-icon-check">&nbsp;已审核</span> -->
-          <audit-button-group type="audit" :is-dot="true" :margin-right="false" @click="onClick(row, $event)" />
+          <audit-button-group
+            :review="row.auditStatus !== 2"
+            :type="row.auditStatus === 1 ? 'result' : 'audit'"
+            :is-dot="row.checkFlag === 0"
+            :margin-right="false"
+            @click="onClick(row, $event)"
+          />
         </template>
       </el-table-column>
     </el-table>
+    <!-- 页码 -->
+    <pagination
+      :total="total"
+      :page.sync="listQuery.pageNum"
+      :limit.sync="listQuery.pageSize"
+      @pagination="fetchProductCateList"
+    />
+    <!-- 审核弹窗 -->
+    <el-dialog title="驳回" :visible.sync="resultVisible" width="30%" @close="onDialogClose">
+      <div class="auth-info">
+        <el-form ref="formRef" :model="dialogData" label-width="80px" :rules="rules">
+          <el-form-item label="原因:" prop="invalidReason">
+            <el-input v-model="dialogData.invalidReason" type="textarea" rows="4" placeholder="请说明原因" />
+          </el-form-item>
+        </el-form>
+      </div>
+      <div slot="footer">
+        <el-button @click="resultVisible = false">取 消</el-button>
+        <el-button type="primary" @click="onSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { fetchProductCateList } from '@/api/product'
+import { fetchProductCateList, auditProductCate } from '@/api/product'
 import { mapGetters } from 'vuex'
 
 export default {
   data() {
     return {
+      // 是否显示dialog
+      resultVisible: false,
       listLoading: false,
       listQuery: {
         authUserId: '',
@@ -77,16 +104,44 @@ export default {
       },
       list: [],
       total: 0,
-      srcList: [] // 预览图片列表
+      dialogData: {
+        productTypeId: '', // 授权机构id
+        auditStatus: 0, // 审核状态
+        invalidReason: '' // 审核信息
+      },
+      rules: {
+        invalidReason: [{ required: true, message: '不通过原因不能为空', tigger: 'blur' }]
+      }
     }
   },
   computed: {
     ...mapGetters(['authUserId'])
   },
   created() {
+    this.listQuery.authUserId = parseInt(this.$route.query.authUserId)
     this.getList()
   },
   methods: {
+    // 获取列表
+    getList() {
+      this.listQuery.pageNum = 1
+      this.list = []
+      this.fetchProductCateList()
+    },
+
+    async fetchProductCateList() {
+      try {
+        this.listLoading = true
+        const res = await fetchProductCateList(this.listQuery)
+        this.list = res.data.list
+        this.total = res.data.total
+      } catch (error) {
+        console.log(error)
+      } finally {
+        this.listLoading = false
+      }
+    },
+
     // 按钮组点击事件
     onClick(row, type) {
       const actions = {
@@ -99,28 +154,44 @@ export default {
 
     // 预览
     onReview(row) {
-      console.log('预览')
       this.$router.push(`/audit/device/cate-detail?id=${row.productTypeId}&type=review`)
     },
     // 驳回
     onResult(row) {
-      console.log('驳回')
+      this.resultVisible = true
+      this.dialogData.productTypeId = row.productTypeId
     },
     // 审核
     onAudit(row) {
-      console.log('审核')
       this.$router.push(`/audit/device/cate-detail?id=${row.productTypeId}&type=audit`)
     },
-    async getList() {
+
+    // 审核
+    async onSubmit() {
       try {
-        this.listQuery.authUserId = parseInt(this.$route.query.authUserId)
-        const res = await fetchProductCateList(this.listQuery)
-        this.list = res.data.list
-        this.total = res.data.total
+        await this.$refs.formRef.validate()
+        await this.onAuthResult()
       } catch (error) {
         console.log(error)
       }
     },
+
+    // 驳回
+    async onAuthResult() {
+      try {
+        await auditProductCate(this.dialogData)
+        this.$message.success('驳回成功')
+        this.getList()
+        this.resultVisible = false
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
+    onDialogClose() {
+      this.$refs.formRef.resetFields()
+    },
+
     indexMethod(index) {
       return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
     }

+ 28 - 19
src/views/admin/audit/device/review.vue

@@ -37,14 +37,16 @@
         <el-input v-model="auditForm.invalidReason" type="textarea" :rows="3" />
       </el-form-item>
       <el-form-item>
-        <el-button type="info" @click="navigateBack">返回</el-button>
-        <el-button type="primary" @click="submit">提交</el-button>
+        <div class="control-box" style="text-align: left">
+          <el-button type="info" @click="navigateBack">返回</el-button>
+          <el-button type="primary" @click="submit">提交</el-button>
+        </div>
       </el-form-item>
     </el-form>
   </div>
 </template>
 <script>
-import { auditProductCate, fetchAuthProductFormData } from '@/api/product'
+import { auditProductCate, auditProductCateCheck, fetchAuthProductFormData } from '@/api/product'
 import { mapGetters } from 'vuex'
 export default {
   data() {
@@ -52,7 +54,6 @@ export default {
       type: 'review',
       isLoading: false,
       auditForm: {
-        auditBy: '', // 审核人id
         productTypeId: '', // 机构id
         auditStatus: 1, // 审核状态
         invalidReason: '' // 审核信息
@@ -67,16 +68,22 @@ export default {
     ...mapGetters(['authUserId'])
   },
   created() {
+    this.auditForm.productTypeId = this.$route.query.id
     this.type = this.$route.query.type
     this.getDetail()
+    this.auditAuthCheck()
   },
   methods: {
+    async auditAuthCheck() {
+      try {
+        await auditProductCateCheck(this.auditForm.productTypeId)
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
     // 数据回显
     async getDetail() {
-      this.auditForm.productTypeId = this.$route.query.id
-      // getAuthFormData({ authId: this.auditForm.authId }).then((res) => {
-      //   this.clubInfo = { ...this.clubInfo, ...res.data }
-      // })
       try {
         const { data } = await fetchAuthProductFormData({ productTypeId: this.auditForm.productTypeId })
         this.cateData = data
@@ -84,10 +91,21 @@ export default {
         console.log(error)
       }
     },
+
+    // 提交审核信息
+    async submit() {
+      try {
+        await this.$refs.auditForm.validate()
+        await this.onAudit()
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
+    // 审核
     async onAudit() {
-      this.isLoading = true
-      this.auditForm.auditBy = this.authUserId
       try {
+        this.isLoading = true
         const res = await auditProductCate(this.auditForm)
         this.$message.success(res.data)
         this.$store.dispatch('tagsView/delView', this.$route)
@@ -97,15 +115,6 @@ export default {
       } finally {
         this.isLoading = false
       }
-    },
-    // 提交审核信息
-    async submit() {
-      try {
-        await this.$refs.auditForm.validate()
-        await this.onAudit()
-      } catch (error) {
-        console.log(error)
-      }
     }
   }
 }

+ 84 - 35
src/views/admin/audit/personnel/operate/index.vue

@@ -24,13 +24,12 @@
     </div>
     <!-- 表格区域 -->
     <el-table
-      :key="tableKey"
       v-loading="listLoading"
       :data="list"
       border
       fit
       highlight-current-row
-      style="width: 100%;"
+      style="width: 100%"
       header-row-class-name="tableHeader"
     >
       <el-table-column label="序号" :index="indexMethod" type="index" align="center" width="80" />
@@ -60,16 +59,13 @@
       <!-- <el-table-column v-if="false" label="创建人" width="180px" align="center" prop="createBy" /> -->
       <el-table-column label="操作" align="center" width="160px" class-name="small-padding fixed-width">
         <template slot-scope="{ row }">
-          <!-- <el-button
-            v-if="row.auditStatus !== 1"
-            type="primary"
-            size="mini"
-            @click="navigationTo(`doctor-detail?id=${row.doctorId}`)"
-          >
-            审核
-          </el-button>
-          <span v-else class="status success el-icon-check">&nbsp;已审核</span> -->
-          <audit-button-group type="audit" :is-dot="true" :margin-right="false" @click="onClick(row, $event)" />
+          <audit-button-group
+            :review="row.auditStatus !== 2"
+            :type="row.auditStatus === 1 ? 'result' : 'audit'"
+            :is-dot="row.checkFlag === 0"
+            :margin-right="false"
+            @click="onClick(row, $event)"
+          />
         </template>
       </el-table-column>
     </el-table>
@@ -78,20 +74,33 @@
       :total="total"
       :page.sync="listQuery.pageNum"
       :limit.sync="listQuery.pageSize"
-      @pagination="getList"
+      @pagination="fetchDoctorList"
     />
+    <!-- 审核弹窗 -->
+    <el-dialog title="驳回" :visible.sync="resultVisible" width="30%" @close="onDialogClose">
+      <div class="auth-info">
+        <el-form ref="formRef" :model="dialogData" label-width="80px" :rules="rules">
+          <el-form-item label="原因:" prop="invalidReason">
+            <el-input v-model="dialogData.invalidReason" type="textarea" rows="4" placeholder="请说明原因" />
+          </el-form-item>
+        </el-form>
+      </div>
+      <div slot="footer">
+        <el-button @click="resultVisible = false">取 消</el-button>
+        <el-button type="primary" @click="onSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { mapGetters } from 'vuex'
-import { fetchDoctorList } from '@/api/doctor'
-
+import { fetchDoctorList, auditDoctor } from '@/api/doctor'
 export default {
   data() {
     return {
+      // 是否显示dialog
+      resultVisible: false,
       listLoading: false,
-      tableKey: 0,
       total: 0,
       listQuery: {
         authUserId: '',
@@ -104,16 +113,42 @@ export default {
         pageNum: 1,
         pageSize: 10
       },
-      list: []
+      list: [],
+      dialogData: {
+        doctorId: '', // 授权机构id
+        auditStatus: 0, // 审核状态
+        invalidReason: '' // 审核信息
+      },
+      rules: {
+        invalidReason: [{ required: true, message: '不通过原因不能为空', tigger: 'blur' }]
+      }
     }
   },
-  computed: {
-    ...mapGetters(['authUserId', 'proxyInfo'])
-  },
   created() {
+    this.listQuery.authUserId = parseInt(this.$route.query.authUserId)
     this.getList()
   },
   methods: {
+    // 获取列表
+    getList() {
+      this.listQuery.pageNum = 1
+      this.list = []
+      this.fetchDoctorList()
+    },
+
+    async fetchDoctorList() {
+      try {
+        this.listLoading = true
+        const res = await fetchDoctorList(this.listQuery)
+        this.list = res.data.list
+        this.total = res.data.total
+      } catch (error) {
+        console.log(error)
+      } finally {
+        this.listLoading = false
+      }
+    },
+
     // 按钮组点击事件
     onClick(row, type) {
       const actions = {
@@ -126,28 +161,44 @@ export default {
 
     // 预览
     onReview(row) {
-      console.log('预览')
       this.$router.push(`doctor-detail?id=${row.doctorId}&type=review`)
     },
     // 驳回
     onResult(row) {
-      console.log('驳回')
+      this.resultVisible = true
+      this.dialogData.doctorId = row.doctorId
     },
     // 审核
     onAudit(row) {
       this.$router.push(`doctor-detail?id=${row.doctorId}&type=audit`)
     },
-    // 获取列表
-    getList() {
-      this.listQuery.authUserId = this.$route.query.authUserId
 
-      console.log(this.listQuery.authUserId)
-      fetchDoctorList(this.listQuery).then(res => {
-        console.log(res)
-        this.list = res.data.list
-        this.total = res.data.total
-      })
+    // 审核
+    async onSubmit() {
+      try {
+        await this.$refs.formRef.validate()
+        await this.onAuthResult()
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
+    // 驳回
+    async onAuthResult() {
+      try {
+        await auditDoctor(this.dialogData)
+        this.$message.success('驳回成功')
+        this.getList()
+        this.resultVisible = false
+      } catch (error) {
+        console.log(error)
+      }
     },
+
+    onDialogClose() {
+      this.$refs.formRef.resetFields()
+    },
+
     // 表格索引
     indexMethod(index) {
       return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
@@ -156,6 +207,4 @@ export default {
 }
 </script>
 
-<style lang="scss" scoped>
-
-</style>
+<style lang="scss" scoped></style>

+ 51 - 34
src/views/admin/audit/personnel/operate/review.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="doctor-edit">
-    <el-form ref="formRef" class="doctor-edit-form" label-width="140px" :model="formData" :rules="formRules">
+    <el-form ref="formRef" class="doctor-edit-form" label-width="140px" :model="auditForm" :rules="formRules">
       <el-form-item label="操作师姓名:">
         <span>{{ doctorInfo.doctorName }}</span>
       </el-form-item>
@@ -70,17 +70,19 @@
       <!-- 审核表单 -->
       <template v-if="type === 'audit'">
         <el-form-item label="审核状态:">
-          <el-radio-group v-model="formData.auditStatus">
+          <el-radio-group v-model="auditForm.auditStatus">
             <el-radio :label="1">通过</el-radio>
             <el-radio :label="0">不通过</el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item v-if="formData.auditStatus !== 1" prop="invalidReason" label="原因:">
-          <el-input v-model="formData.invalidReason" type="textarea" placeholder="请说明原因" />
+        <el-form-item v-if="auditForm.auditStatus !== 1" prop="invalidReason" label="原因:">
+          <el-input v-model="auditForm.invalidReason" type="textarea" placeholder="请说明原因" />
         </el-form-item>
         <el-form-item>
-          <el-button type="info" @click="navigateBack">返回</el-button>
-          <el-button type="primary" @click="submit">提交</el-button>
+          <div class="control-box left">
+            <el-button type="info" @click="navigateBack">返回</el-button>
+            <el-button type="primary" @click="submit">提交</el-button>
+          </div>
         </el-form-item>
       </template>
     </el-form>
@@ -89,7 +91,7 @@
 
 <script>
 import { mapGetters } from 'vuex'
-import { doctorFormData, doctorAudit } from '@/api/doctor'
+import { doctorFormData, auditDoctor, auditDoctorCheck } from '@/api/doctor'
 
 export default {
   data() {
@@ -107,11 +109,11 @@ export default {
         doctorImage: '',
         equipmentList: '',
         tagList: [],
-        paramsList: [],
+        paramList: [],
         auditStatus: '',
         invalidReason: ''
       },
-      formData: {
+      auditForm: {
         auditBy: '', // 审核人id
         doctorId: '', // 商品id
         auditStatus: 1, // 商品审核状态
@@ -129,17 +131,30 @@ export default {
     ...mapGetters(['authUserId'])
   },
   created() {
-    this.doctorId = this.formData.doctorId = parseInt(this.$route.query.id)
+    this.auditForm.doctorId = parseInt(this.$route.query.id)
     this.type = this.$route.query.type
-    this.initFormData()
+    this.fetchDoctorDetail()
+    this.auditDoctorCheck()
   },
   methods: {
+    async auditDoctorCheck() {
+      try {
+        await auditDoctorCheck(this.auditForm.doctorId)
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
     // 表单数据回显
-    initFormData() {
-      doctorFormData({ doctorId: this.doctorId }).then((res) => {
+    async fetchDoctorDetail() {
+      try {
+        const res = await doctorFormData({ doctorId: this.auditForm.doctorId })
         this.setFormData(res.data)
-      })
+      } catch (error) {
+        console.log(error)
+      }
     },
+
     // 设置表单数据
     setFormData(data) {
       this.doctorInfo.doctorName = data.doctorName
@@ -150,32 +165,34 @@ export default {
       this.doctorInfo.equipmentList = data.equipmentList
       this.doctorInfo.tagList = data.tagList
       this.doctorInfo.paramList = data.paramList
-
       this.doctorImgList = [data.doctorImage]
       this.bannerImgList = data.bannerList
       this.equipmentImgList = data.equipmentList.map((item) => item.image)
     },
 
     // 提交审核信息
-    submit() {
-      this.$refs.formRef.validate((valid) => {
-        if (valid) {
-          this.isLoading = true
-          // 指定审核人
-          this.formData.auditBy = this.authUserId
-          // 提交审核信息
-          doctorAudit(this.formData)
-            .then((res) => {
-              if (res.code !== 0) return
-              this.$message.success(res.data)
-              this.$store.dispatch('tagsView/delView', this.$route)
-              this.$router.back()
-            })
-            .finally(() => {
-              this.isLoading = false
-            })
-        }
-      })
+    async submit() {
+      try {
+        await this.$refs.formRef.validate()
+        this.onAudit()
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
+    // 审核
+    async onAudit() {
+      try {
+        this.isLoading = true
+        const res = await auditDoctor(this.auditForm)
+        this.$message.success(res.data)
+        this.$store.dispatch('tagsView/delView', this.$route)
+        this.$router.back()
+      } catch (error) {
+        console.log(error)
+      } finally {
+        this.isLoading = false
+      }
     }
   }
 }

+ 83 - 33
src/views/admin/audit/personnel/training/index.vue

@@ -30,7 +30,7 @@
       border
       fit
       highlight-current-row
-      style="width: 100%;"
+      style="width: 100%"
       header-row-class-name="tableHeader"
     >
       <el-table-column label="序号" :index="indexMethod" type="index" align="center" width="80" />
@@ -60,36 +60,44 @@
       <!-- <el-table-column v-if="false" label="创建人" width="180px" align="center" prop="createBy" /> -->
       <el-table-column label="操作" align="center" width="160px" class-name="small-padding fixed-width">
         <template slot-scope="{ row }">
-          <!-- <el-button
-            v-if="row.auditStatus !== 1"
-            type="primary"
-            size="mini"
-            @click="navigationTo(`doctor-detail?id=${row.doctorId}`)"
-          >
-            审核
-          </el-button>
-          <span v-else class="status success el-icon-check">&nbsp;已审核</span> -->
-          <audit-button-group type="audit" :is-dot="true" :margin-right="false" @click="onClick(row, $event)" />
+          <audit-button-group
+            :review="row.auditStatus !== 2"
+            :type="row.auditStatus === 1 ? 'result' : 'audit'"
+            :is-dot="row.checkFlag === 0"
+            :margin-right="false"
+            @click="onClick(row, $event)"
+          />
         </template>
       </el-table-column>
     </el-table>
     <!-- 页码 -->
-    <pagination
-      :total="total"
-      :page.sync="listQuery.pageNum"
-      :limit.sync="listQuery.pageSize"
-      @pagination="getList"
-    />
+    <pagination :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList" />
+    <!-- 审核弹窗 -->
+    <el-dialog title="驳回" :visible.sync="resultVisible" width="30%" @close="onDialogClose">
+      <div class="auth-info">
+        <el-form ref="formRef" :model="dialogData" label-width="80px" :rules="rules">
+          <el-form-item label="原因:" prop="invalidReason">
+            <el-input v-model="dialogData.invalidReason" type="textarea" rows="4" placeholder="请说明原因" />
+          </el-form-item>
+        </el-form>
+      </div>
+      <div slot="footer">
+        <el-button @click="resultVisible = false">取 消</el-button>
+        <el-button type="primary" @click="onSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import { mapGetters } from 'vuex'
-import { fetchDoctorList } from '@/api/doctor'
+import { auditDoctor, fetchDoctorList } from '@/api/doctor'
 
 export default {
   data() {
     return {
+      // 是否显示dialog
+      resultVisible: false,
       listLoading: false,
       tableKey: 0,
       total: 0,
@@ -104,16 +112,45 @@ export default {
         pageNum: 1,
         pageSize: 10
       },
-      list: []
+      list: [],
+      dialogData: {
+        doctorId: '', // 授权机构id
+        auditStatus: 0, // 审核状态
+        invalidReason: '' // 审核信息
+      },
+      rules: {
+        invalidReason: [{ required: true, message: '不通过原因不能为空', tigger: 'blur' }]
+      }
     }
   },
   computed: {
     ...mapGetters(['authUserId', 'proxyInfo'])
   },
   created() {
+    this.listQuery.authUserId = parseInt(this.$route.query.authUserId)
     this.getList()
   },
   methods: {
+    // 获取列表
+    getList() {
+      this.listQuery.pageNum = 1
+      this.list = []
+      this.fetchDoctorList()
+    },
+
+    async fetchDoctorList() {
+      try {
+        this.listLoading = true
+        const res = await fetchDoctorList(this.listQuery)
+        this.list = res.data.list
+        this.total = res.data.total
+      } catch (error) {
+        console.log(error)
+      } finally {
+        this.listLoading = false
+      }
+    },
+
     // 按钮组点击事件
     onClick(row, type) {
       const actions = {
@@ -126,29 +163,44 @@ export default {
 
     // 预览
     onReview(row) {
-      console.log('预览')
       this.$router.push(`doctor-detail?id=${row.doctorId}&type=review`)
     },
     // 驳回
     onResult(row) {
-      console.log('驳回')
+      this.resultVisible = true
+      this.dialogData.doctorId = row.doctorId
     },
     // 审核
     onAudit(row) {
       this.$router.push(`doctor-detail?id=${row.doctorId}&type=audit`)
     },
 
-    // 获取列表
-    getList() {
-      this.listQuery.authUserId = this.$route.query.authUserId
+    // 审核
+    async onSubmit() {
+      try {
+        await this.$refs.formRef.validate()
+        await this.onAuthResult()
+      } catch (error) {
+        console.log(error)
+      }
+    },
 
-      console.log(this.listQuery.authUserId)
-      fetchDoctorList(this.listQuery).then(res => {
-        console.log(res)
-        this.list = res.data.list
-        this.total = res.data.total
-      })
+    // 驳回
+    async onAuthResult() {
+      try {
+        await auditDoctor(this.dialogData)
+        this.$message.success('驳回成功')
+        this.getList()
+        this.resultVisible = false
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
+    onDialogClose() {
+      this.$refs.formRef.resetFields()
     },
+
     // 表格索引
     indexMethod(index) {
       return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
@@ -157,6 +209,4 @@ export default {
 }
 </script>
 
-<style lang="scss" scoped>
-
-</style>
+<style lang="scss" scoped></style>

+ 47 - 38
src/views/admin/audit/personnel/training/review.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="doctor-edit">
-    <el-form ref="formRef" class="doctor-edit-form" label-width="140px" :model="formData" :rules="formRules">
+    <el-form ref="formRef" class="doctor-edit-form" label-width="140px" :model="auditForm" :rules="formRules">
       <el-form-item label="培训师姓名:">
         <span>{{ doctorInfo.doctorName }}</span>
       </el-form-item>
@@ -52,13 +52,13 @@
       <!-- 审核表单 -->
       <template v-if="type === 'audit'">
         <el-form-item label="审核状态:">
-          <el-radio-group v-model="formData.auditStatus">
+          <el-radio-group v-model="auditForm.auditStatus">
             <el-radio :label="1">通过</el-radio>
             <el-radio :label="0">不通过</el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item v-if="formData.auditStatus !== 1" prop="invalidReason" label="原因:">
-          <el-input v-model="formData.invalidReason" type="textarea" placeholder="请说明原因" />
+        <el-form-item v-if="auditForm.auditStatus !== 1" prop="invalidReason" label="原因:">
+          <el-input v-model="auditForm.invalidReason" type="textarea" placeholder="请说明原因" />
         </el-form-item>
         <el-form-item>
           <el-button type="info" @click="navigateBack">返回</el-button>
@@ -70,9 +70,7 @@
 </template>
 
 <script>
-import { mapGetters } from 'vuex'
-import { doctorFormData, doctorAudit } from '@/api/doctor'
-
+import { doctorFormData, auditDoctor, auditDoctorCheck } from '@/api/doctor'
 export default {
   data() {
     return {
@@ -88,12 +86,11 @@ export default {
         bannerList: '',
         doctorImage: '',
         tagList: [],
-        paramsList: [],
+        paramList: [],
         auditStatus: '',
         invalidReason: ''
       },
-      formData: {
-        auditBy: '', // 审核人id
+      auditForm: {
         doctorId: '', // 商品id
         auditStatus: 1, // 商品审核状态
         invalidReason: '' // 审核信息
@@ -106,21 +103,31 @@ export default {
       equipmentImgList: []
     }
   },
-  computed: {
-    ...mapGetters(['authUserId'])
-  },
   created() {
-    this.doctorId = this.formData.doctorId = parseInt(this.$route.query.id)
+    this.auditForm.doctorId = parseInt(this.$route.query.id)
     this.type = this.$route.query.type
-    this.initFormData()
+    this.fetchDoctorDetail()
+    this.auditDoctorCheck()
   },
   methods: {
+    async auditDoctorCheck() {
+      try {
+        await auditDoctorCheck(this.auditForm.doctorId)
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
     // 表单数据回显
-    initFormData() {
-      doctorFormData({ doctorId: this.doctorId }).then((res) => {
+    async fetchDoctorDetail() {
+      try {
+        const res = await doctorFormData({ doctorId: this.auditForm.doctorId })
         this.setFormData(res.data)
-      })
+      } catch (error) {
+        console.log(error)
+      }
     },
+
     // 设置表单数据
     setFormData(data) {
       this.doctorInfo.doctorName = data.doctorName
@@ -130,31 +137,33 @@ export default {
       this.doctorInfo.doctorImage = data.doctorImage
       this.doctorInfo.tagList = data.tagList
       this.doctorInfo.paramList = data.paramList
-
       this.doctorImgList = [data.doctorImage]
       this.bannerImgList = data.bannerList
     },
 
     // 提交审核信息
-    submit() {
-      this.$refs.formRef.validate((valid) => {
-        if (valid) {
-          this.isLoading = true
-          // 指定审核人
-          this.formData.auditBy = this.authUserId
-          // 提交审核信息
-          doctorAudit(this.formData)
-            .then((res) => {
-              if (res.code !== 0) return
-              this.$message.success(res.data)
-              this.$store.dispatch('tagsView/delView', this.$route)
-              this.$router.back()
-            })
-            .finally(() => {
-              this.isLoading = false
-            })
-        }
-      })
+    async submit() {
+      try {
+        await this.$refs.formRef.validate()
+        this.onAudit()
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
+    // 审核
+    async onAudit() {
+      try {
+        this.isLoading = true
+        const res = await auditDoctor(this.auditForm)
+        this.$message.success(res.data)
+        this.$store.dispatch('tagsView/delView', this.$route)
+        this.$router.back()
+      } catch (error) {
+        console.log(error)
+      } finally {
+        this.isLoading = false
+      }
     }
   }
 }