统一editSites状态开关数据类型为Boolean

This commit is contained in:
buvta
2020-11-08 18:02:08 +08:00
parent 81476e0f20
commit ae7aaec623
2 changed files with 13 additions and 35 deletions

View File

@@ -12,7 +12,7 @@
<div class="listpage-header" v-show="enableBatchEdit">
<el-switch v-model="enableBatchEdit" active-text="批处理分组"></el-switch>
<el-input placeholder="新组名" v-model="batchGroupName"></el-input>
<el-switch v-model="batchIsActive" :active-value="1" :inactive-value="0" active-text="启用"></el-switch>
<el-switch v-model="batchIsActive" active-text="启用"></el-switch>
<el-button type="primary" icon="el-icon-edit" @click.stop="saveBatchEdit">保存</el-button>
<el-button @click="removeSelectedSites" icon="el-icon-delete-solid">删除</el-button>
</div>
@@ -35,14 +35,12 @@
<el-table-column
prop="isActive"
width="120"
:filters = "[{text:'启用', value: 1}, {text:'停用', value: 0}]"
:filters = "[{text:'启用', value: true}, {text:'停用', value: false}]"
:filter-method="(value, row) => value === row.isActive"
label="启用">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isActive"
:active-value="1"
:inactive-value="0"
@click.native.stop='isActiveChangeEvent(scope.row)'>
</el-switch>
</template>
@@ -135,7 +133,7 @@ export default {
api: '',
download: '',
group: '',
isActive: 1
isActive: true
},
siteGroup: [],
rules: {
@@ -148,7 +146,7 @@ export default {
},
enableBatchEdit: false,
batchGroupName: '',
batchIsActive: 1,
batchIsActive: true,
shiftDown: false,
selectionBegin: '',
selectionEnd: '',
@@ -236,6 +234,11 @@ export default {
},
getSites () {
sites.all().then(res => {
res.forEach(ele => {
if (ele.isActive === undefined) {
ele.isActive = true
}
})
this.sites = res
})
},
@@ -262,7 +265,7 @@ export default {
api: '',
download: '',
group: '',
isActive: 1
isActive: true
}
},
editSite (siteInfo) {
@@ -379,7 +382,7 @@ export default {
if (ele.api && this.sites.filter(x => x.key === ele.key).length === 0 && this.sites.filter(x => x.name === ele.name && x.api === ele.api).length === 0) {
// 不含该key 同时也不含名字和url一样的
if (ele.isActive === undefined) {
ele.isActive = 1
ele.isActive = true
}
if (ele.group === undefined) {
ele.group = '导入'
@@ -486,7 +489,7 @@ export default {
row.status = '可用'
} else {
row.status = '失效'
row.isActive = 0
row.isActive = false
}
sites.remove(row.id)
sites.add(row)