Commit 0b43da6e authored by 张伯涛's avatar 张伯涛

岗位,字典,字典类型,状态按钮

parent 9302af52
......@@ -107,7 +107,18 @@
{{ isNaN(scope.row.dictSort) ? '-' : scope.row.dictSort }}
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="flag" :formatter="statusFormat" />
<el-table-column label="状态" align="center" prop="flag" :formatter="statusFormat" >
<template slot-scope="scope">
<el-switch
v-model="scope.row.flag"
class="switchDisabledStyle"
inactive-value="0"
active-value="1"
@click.native="changeStatus(scope.row)"
>
</el-switch>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" label="备注" prop="remarks">
<template slot-scope="scope">
{{ scope.row.remarks || '-' }}
......@@ -301,6 +312,7 @@ export default {
methods: {
// 状态
changeStatus(row) {
const text = row.flag === '1' ? '启用' : '停用'
const title = `“${row.dictLabel}”参数即将被${row.status === '0' ? '停用' : '启用'},是否继续?`
this.$confirm(title, '提示', {
confirmButtonText: '确定',
......@@ -312,6 +324,11 @@ export default {
updateData(row2).then(res => {
row.status = row.status === '0' ? '1' : '0'
}).catch()
}).then(() => {
this.$message({
message: text + '成功',
type: 'success'
})
}).catch()
},
/** 查询字典类型详细 */
......
......@@ -124,7 +124,18 @@
<div v-else>-</div>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="flag" :formatter="statusFormat" />
<el-table-column label="状态" align="center" prop="flag" :formatter="statusFormat" >
<template slot-scope="scope">
<el-switch
v-model="scope.row.flag"
class="switchDisabledStyle"
inactive-value="0"
active-value="1"
@click.native="handleStatusChange(scope.row)"
>
</el-switch>
</template>
</el-table-column>
<el-table-column label="备注" prop="remarks" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.remarks || '-' }}
......@@ -231,9 +242,11 @@ import { listType,
selectDictType
} from '@/api/system/dict/type'
import dictCons from '@/utils/dictCons'
import Template from "@/views/instance/Template";
export default {
name: 'Dict',
components: {Template},
data() {
const verifyTypeProp = (rule, value, callback) => {
if (value === '' || value === undefined || value === null) {
......@@ -384,8 +397,8 @@ export default {
}
},
handleStatusChange(row) {
const text = row.status === '0' ? '启用' : '停用'
this.$confirm(`${row.dictName}`, '提示', {
const text = row.flag === '1' ? '启用' : '停用'
this.$confirm('确认要"' + text + '""' + row.dictName + '"吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
......@@ -397,7 +410,7 @@ export default {
type: 'success'
})
}).catch(function() {
row.status = row.status === '0' ? '1' : '0'
row.flag = row.flag === '0' ? '1' : '0'
})
},
// 字典状态字典翻译
......
......@@ -106,6 +106,16 @@
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="flag" :formatter="statusFormat">
<template slot-scope="scope">
<el-switch
v-model="scope.row.flag"
class="switchDisabledStyle"
inactive-value="0"
active-value="1"
@click.native="handleStatusChange(scope.row)"
>
</el-switch>
</template>
<!-- <template slot-scope="scope">-->
<!-- {{ scope.row.flag || '-' }}-->
<!-- </template>-->
......@@ -412,7 +422,7 @@ export default {
updatePost(temp).then(() => {
this.$message({
type: 'success',
message: temp.status === '0' ? '启用成功' : '停用成功'
message: temp.status === '1' ? '启用成功' : '停用成功'
})
row.status = temp.status
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment