|
@@ -25,10 +25,7 @@
|
|
|
</div>
|
|
|
<div class="filter-control">
|
|
|
<permission-button type="primary" @click="handleFilter">查询</permission-button>
|
|
|
- <permission-button
|
|
|
- type="primary"
|
|
|
- @click="handleAdd"
|
|
|
- >添加</permission-button>
|
|
|
+ <permission-button type="primary" @click="handleAdd">添加</permission-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 表格区域 -->
|
|
@@ -39,7 +36,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" />
|
|
@@ -55,7 +52,7 @@
|
|
|
<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 " />
|
|
|
+ <span class="el-icon-question status danger" />
|
|
|
</el-tag>
|
|
|
</el-popover>
|
|
|
<!-- 未通过原因展示END -->
|
|
@@ -68,17 +65,17 @@
|
|
|
<!-- 只有审核通过了才能操作上下线 auditStatus :审核状态 -->
|
|
|
<template v-if="row.auditStatus === 1">
|
|
|
<template v-if="row.status === 0">
|
|
|
- <span style="margin-right:10px;" class="status danger">已下线</span>
|
|
|
+ <span style="margin-right: 10px" class="status danger">已下线</span>
|
|
|
<permission-button type="primary" size="mini" @click="handleChangeStatus(row)">上线</permission-button>
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
- <span style="margin-right:10px;" class="status success ">已上线</span>
|
|
|
+ <span style="margin-right: 10px" class="status success">已上线</span>
|
|
|
<permission-button type="info" size="mini" @click="handleChangeStatus(row)">下线</permission-button>
|
|
|
</template>
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
<!-- <el-tag type="warning">待上线</el-tag> -->
|
|
|
- <span style="margin-right:10px;" class="status warning">待上线</span>
|
|
|
+ <span style="margin-right: 10px" class="status warning">待上线</span>
|
|
|
</template>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -91,16 +88,8 @@
|
|
|
<!-- <el-table-column v-if="false" label="创建人" width="180px" align="center" prop="createBy" /> -->
|
|
|
<el-table-column label="操作" align="center" width="240px" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="{ row }">
|
|
|
- <permission-button
|
|
|
- type="primary"
|
|
|
- size="mini"
|
|
|
- @click="handleEdit(row)"
|
|
|
- >
|
|
|
- 编辑
|
|
|
- </permission-button>
|
|
|
- <permission-button type="danger" size="mini" @click="handleRemove(row)">
|
|
|
- 删除
|
|
|
- </permission-button>
|
|
|
+ <permission-button type="primary" size="mini" @click="handleEdit(row)"> 编辑 </permission-button>
|
|
|
+ <permission-button type="danger" size="mini" @click="handleRemove(row)"> 删除 </permission-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -115,12 +104,7 @@
|
|
|
/>
|
|
|
|
|
|
<!-- 设备添加对话框 -->
|
|
|
- <el-dialog
|
|
|
- title="添加设备"
|
|
|
- :visible.sync="dialogVisible"
|
|
|
- width="30%"
|
|
|
- @close="onDialogClose"
|
|
|
- >
|
|
|
+ <el-dialog title="添加设备" :visible.sync="dialogVisible" width="30%" @close="onDialogClose">
|
|
|
<el-form ref="form" :model="formData" :rules="rules" label-width="100px">
|
|
|
<el-form-item prop="name" label="设备名称:">
|
|
|
<el-input v-model="formData.name" placeholder="请输入设备名称" />
|
|
@@ -138,7 +122,7 @@
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="onSave">保 存</el-button>
|
|
|
+ <el-button type="primary" :loading="isLoading" @click="onSave">保 存</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -174,6 +158,7 @@ export default {
|
|
|
|
|
|
data() {
|
|
|
return {
|
|
|
+ isLoading: false,
|
|
|
tableKey: 0,
|
|
|
list: null,
|
|
|
total: 0,
|
|
@@ -218,11 +203,27 @@ export default {
|
|
|
},
|
|
|
// 改变启用状态
|
|
|
async handleChangeStatus(row) {
|
|
|
- row.status = row.status ? 0 : 1
|
|
|
+ let status = Boolean(row.status)
|
|
|
+ const tip = status ? '下架' : '上架'
|
|
|
+ let confirmType = ''
|
|
|
+ try {
|
|
|
+ confirmType = await this.$confirm(`确定${tip}该设备管理吗?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ status = !status
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+
|
|
|
+ if (confirmType !== 'confirm') {
|
|
|
+ return
|
|
|
+ }
|
|
|
try {
|
|
|
await updateProductCateStatus({
|
|
|
productTypeId: row.productTypeId,
|
|
|
- status: row.status
|
|
|
+ status: Number(status)
|
|
|
})
|
|
|
this.$message.success('修改设备状态成功')
|
|
|
this.fetchProductList()
|
|
@@ -243,10 +244,12 @@ export default {
|
|
|
},
|
|
|
// 保存
|
|
|
async onSave() {
|
|
|
+ this.isLoading = true
|
|
|
try {
|
|
|
await this.$refs.form.validate()
|
|
|
} catch (error) {
|
|
|
console.log(error)
|
|
|
+ this.isLoading = false
|
|
|
}
|
|
|
this.formData.authUserId = this.authUserId
|
|
|
this.formData.createBy = this.authUserId
|
|
@@ -257,6 +260,8 @@ export default {
|
|
|
this.fetchProductList()
|
|
|
} catch (error) {
|
|
|
console.log(error)
|
|
|
+ } finally {
|
|
|
+ this.isLoading = false
|
|
|
}
|
|
|
},
|
|
|
// 添加分类
|
|
@@ -322,13 +327,13 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.app-container{
|
|
|
- ::v-deep{
|
|
|
- .el-dialog__body{
|
|
|
+.app-container {
|
|
|
+ ::v-deep {
|
|
|
+ .el-dialog__body {
|
|
|
padding-bottom: 0;
|
|
|
}
|
|
|
}
|
|
|
- .pd-10{
|
|
|
+ .pd-10 {
|
|
|
padding-top: 10px;
|
|
|
}
|
|
|
}
|