|
@@ -1,13 +1,200 @@
|
|
|
<template>
|
|
|
- <div />
|
|
|
+ <div class="device-list app-container">
|
|
|
+ <div class="filter-container">
|
|
|
+ <div class="filter-control">
|
|
|
+ <span>设备名称:</span>
|
|
|
+ <el-input v-model="listQuery.name" placeholder="设备名称" @keyup.enter.native="getList" />
|
|
|
+ </div>
|
|
|
+ <div class="filter-control">
|
|
|
+ <span>审核状态:</span>
|
|
|
+ <el-select v-model="listQuery.auditStatus" placeholder="审核状态" clearable @change="getList">
|
|
|
+ <el-option label="全部" value="" />
|
|
|
+ <el-option label="已完成审核" :value="1" />
|
|
|
+ <el-option label="未完成审核" :value="0" />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="filter-control">
|
|
|
+ <el-button type="primary" @click="getList">查询</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 表格区域 -->
|
|
|
+ <el-table
|
|
|
+ v-loading="listLoading"
|
|
|
+ :data="list"
|
|
|
+ style="width: 100%"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ header-row-class-name="tableHeader"
|
|
|
+ cell-class-name="table-cell"
|
|
|
+ >
|
|
|
+ <el-table-column :index="indexMethod" label="序号" type="index" width="80" align="center" />
|
|
|
+ <el-table-column prop="name" label="设备名称" align="center" />
|
|
|
+ <el-table-column label="审核状态" width="220px" align="center">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tag v-if="row.auditStatus === 2" size="small" type="warning">待审核</el-tag>
|
|
|
+ <el-tag v-if="row.auditStatus === 1" size="small" type="success">审核通过</el-tag>
|
|
|
+ <!-- 未通过原因展示 -->
|
|
|
+ <template v-if="row.auditStatus === 0">
|
|
|
+ <!-- <span class="status danger">审核未通过 </span> -->
|
|
|
+ <el-popover placement="top-start" title="审核说明" width="400" trigger="hover" :content="row.invalidReason">
|
|
|
+ <el-tag slot="reference" size="small" type="danger" class="reason">
|
|
|
+ <span>审核未通过</span>
|
|
|
+ <span class="el-icon-question status danger " />
|
|
|
+ </el-tag>
|
|
|
+ </el-popover>
|
|
|
+ <!-- 未通过原因展示END -->
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="审核时间" width="250px" align="center">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <span v-if="row.auditStatus !== 2">{{ row.auditTime | formatTime }}</span>
|
|
|
+ <span v-else>—</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="审核人" align="center" width="200px">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <span v-if="row.auditStatus !== 2">{{ row.auditBy }}</span>
|
|
|
+ <span v-else>—</span>
|
|
|
+ </template>
|
|
|
+ </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"
|
|
|
+ style="margin-right:5px"
|
|
|
+ icon="el-icon-s-check"
|
|
|
+ @click="handleAudit(row)"
|
|
|
+ >审核</el-button>
|
|
|
+ <span v-else class="status success el-icon-check"> 已审核</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <!-- 审核对话框 -->
|
|
|
+ <el-dialog
|
|
|
+ title="审核"
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
+ width="30%"
|
|
|
+ @closed="onDialogClose"
|
|
|
+ >
|
|
|
+ <el-form label-width="80px">
|
|
|
+ <el-form-item label="设备名称:">
|
|
|
+ <span v-text="currentData.name" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="设备图片:">
|
|
|
+ <el-image
|
|
|
+ style="width: 200px; height: 200px"
|
|
|
+ :src="currentData.image"
|
|
|
+ :preview-src-list="srcList"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <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-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="handleAuditStatus">保存</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { auditProductCate, fetchProductCateList } from '@/api/product'
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
+const resetDialogData = () => ({
|
|
|
+ auditBy: '', // 审核人id
|
|
|
+ productTypeId: '', // 机构id
|
|
|
+ auditStatus: 1, // 审核状态
|
|
|
+ invalidReason: '' // 审核信息
|
|
|
+})
|
|
|
export default {
|
|
|
-
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ dialogVisible: false,
|
|
|
+ listLoading: false,
|
|
|
+ listQuery: {
|
|
|
+ authUserId: '',
|
|
|
+ name: '',
|
|
|
+ auditStatus: '',
|
|
|
+ listType: 2,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ status: ''
|
|
|
+ },
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ currentData: {},
|
|
|
+ dialogData: resetDialogData(),
|
|
|
+ srcList: [] // 预览图片列表
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['authUserId'])
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getList() {
|
|
|
+ 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
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 审核设备分类
|
|
|
+ handleAudit(row) {
|
|
|
+ this.currentData = row
|
|
|
+ this.srcList.push(row.image)
|
|
|
+ this.dialogVisible = true
|
|
|
+ },
|
|
|
+ // 审核
|
|
|
+ async handleAuditStatus() {
|
|
|
+ this.dialogData.auditBy = this.authUserId
|
|
|
+ this.dialogData.productTypeId = this.currentData.productTypeId
|
|
|
+ try {
|
|
|
+ const res = await auditProductCate(this.dialogData)
|
|
|
+ this.$message.success(res.data)
|
|
|
+ this.getList()
|
|
|
+ this.dialogVisible = false
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 对话框关闭事件
|
|
|
+ onDialogClose() {
|
|
|
+ this.dialogData = resetDialogData()
|
|
|
+ this.currentData = {}
|
|
|
+ this.srcList = []
|
|
|
+ },
|
|
|
+ indexMethod(index) {
|
|
|
+ return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
-
|
|
|
+<style scoped lang="scss">
|
|
|
+.app-container{
|
|
|
+ ::v-deep{
|
|
|
+ .el-dialog__body{
|
|
|
+ padding-bottom: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|