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

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

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