|
@@ -42,8 +42,13 @@
|
|
|
width="100"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <el-tag v-if="scope.row.status === 1" type="success">正常</el-tag>
|
|
|
- <el-tag v-if="scope.row.status === 0" type="danger">停用</el-tag>
|
|
|
+ <el-switch
|
|
|
+ v-model="scope.row.status"
|
|
|
+ active-color="#13ce66"
|
|
|
+ :active-value="1"
|
|
|
+ :inactive-value="0"
|
|
|
+ @change="handleStatusChange(scope.row)"
|
|
|
+ />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
@@ -57,12 +62,14 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<!-- 新增、编辑 -->
|
|
|
- <CreateDialog v-if="createData.bSwitch" :data="createData" :types="types" :categorys="categorys" />
|
|
|
+ <CreateDialog v-if="createData.bSwitch" :data="createData" :types="types" :categorys="categorys" @refresh="handleRefresh" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import CreateDialog from './CreateDialog.vue'
|
|
|
+import { createCaseRuleList } from '@/api/admin'
|
|
|
+
|
|
|
export default {
|
|
|
components: {
|
|
|
CreateDialog
|
|
@@ -109,6 +116,28 @@ export default {
|
|
|
onEdit(row) {
|
|
|
this.createData.row = row
|
|
|
this.createData.bSwitch = true
|
|
|
+ },
|
|
|
+ handleStatusChange(row) {
|
|
|
+ const index = row.status ? 1 : 0
|
|
|
+ this.$confirm('确认要更改为 <strong>' + ['停用', '正常'][index] + '</strong> 状态吗?', '提示', {
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ createCaseRuleList(row).then(res => {
|
|
|
+ this.data.bSwitch = false
|
|
|
+ this.$emit('refresh')
|
|
|
+ this.$message.success(res.m || '操作成功')
|
|
|
+ }).catch(function() {
|
|
|
+ row.status = row.status === 0 ? 1 : 0
|
|
|
+ })
|
|
|
+ }).catch(function() {
|
|
|
+ row.status = row.status === 0 ? 1 : 0
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleRefresh() {
|
|
|
+ this.$emit('refresh')
|
|
|
}
|
|
|
}
|
|
|
}
|