|
|
@ -4,27 +4,19 @@ |
|
|
|
<el-form :inline="true" :model="searchInfo" class="demo-form-inline"> |
|
|
|
<el-form-item label="字典名(中)"> |
|
|
|
<el-input placeholder="搜索条件" v-model="searchInfo.name"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="字典名(英)"> |
|
|
|
<el-input placeholder="搜索条件" v-model="searchInfo.type"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="状态" prop="status"> |
|
|
|
<el-select v-model="searchInfo.status" clear placeholder="请选择"> |
|
|
|
<el-option |
|
|
|
key="true" |
|
|
|
label="是" |
|
|
|
value="true"> |
|
|
|
</el-option> |
|
|
|
<el-option |
|
|
|
key="false" |
|
|
|
label="否" |
|
|
|
value="false"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="状态" prop="status"> |
|
|
|
<el-select v-model="searchInfo.status" clear placeholder="请选择"> |
|
|
|
<el-option key="true" label="是" value="true"></el-option> |
|
|
|
<el-option key="false" label="否" value="false"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="描述"> |
|
|
|
<el-input placeholder="搜索条件" v-model="searchInfo.desc"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-button @click="onSubmit" type="primary">查询</el-button> |
|
|
|
</el-form-item> |
|
|
@ -41,21 +33,21 @@ |
|
|
|
style="width: 100%" |
|
|
|
tooltip-effect="dark" |
|
|
|
> |
|
|
|
<el-table-column type="selection" width="55"></el-table-column> |
|
|
|
<el-table-column label="日期" width="180"> |
|
|
|
<template slot-scope="scope">{{scope.row.CreatedAt|formatDate}}</template> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="字典名(中)" prop="name" width="120"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="字典名(英)" prop="type" width="120"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="状态" prop="status" width="120"> |
|
|
|
<template slot-scope="scope">{{scope.row.status|formatBoolean}}</template> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="描述" prop="desc" width="280"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column type="selection" width="55"></el-table-column> |
|
|
|
<el-table-column label="日期" width="180"> |
|
|
|
<template slot-scope="scope">{{scope.row.CreatedAt|formatDate}}</template> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="字典名(中)" prop="name" width="120"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="字典名(英)" prop="type" width="120"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="状态" prop="status" width="120"> |
|
|
|
<template slot-scope="scope">{{scope.row.status|formatBoolean}}</template> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="描述" prop="desc" width="280"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="按钮组"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button @click="toDetile(scope.row)" size="small" type="success">详情</el-button> |
|
|
@ -85,20 +77,30 @@ |
|
|
|
|
|
|
|
<el-dialog :before-close="closeDialog" :visible.sync="dialogFormVisible" title="弹窗操作"> |
|
|
|
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="110px"> |
|
|
|
<el-form-item label="字典名(中)" prop="name"> |
|
|
|
<el-input v-model="formData.name" placeholder="请输入字典名(中)" clearable :style="{width: '100%'}"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="字典名(英)" prop="type"> |
|
|
|
<el-input v-model="formData.type" placeholder="请输入字典名(英)" clearable :style="{width: '100%'}"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="状态" prop="status" required> |
|
|
|
<el-switch v-model="formData.status" active-text="开启" inactive-text="停用"></el-switch> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="描述" prop="desc"> |
|
|
|
<el-input v-model="formData.desc" placeholder="请输入描述" clearable :style="{width: '100%'}"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
|
|
|
|
<el-form-item label="字典名(中)" prop="name"> |
|
|
|
<el-input |
|
|
|
v-model="formData.name" |
|
|
|
placeholder="请输入字典名(中)" |
|
|
|
clearable |
|
|
|
:style="{width: '100%'}" |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="字典名(英)" prop="type"> |
|
|
|
<el-input |
|
|
|
v-model="formData.type" |
|
|
|
placeholder="请输入字典名(英)" |
|
|
|
clearable |
|
|
|
:style="{width: '100%'}" |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="状态" prop="status" required> |
|
|
|
<el-switch v-model="formData.status" active-text="开启" inactive-text="停用"></el-switch> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="描述" prop="desc"> |
|
|
|
<el-input v-model="formData.desc" placeholder="请输入描述" clearable :style="{width: '100%'}"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
|
|
|
|
<div class="dialog-footer" slot="footer"> |
|
|
|
<el-button @click="closeDialog">取 消</el-button> |
|
|
|
<el-button @click="enterDialog" type="primary">确 定</el-button> |
|
|
@ -111,12 +113,12 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import { |
|
|
|
createSysDictionary, |
|
|
|
deleteSysDictionary, |
|
|
|
updateSysDictionary, |
|
|
|
findSysDictionary, |
|
|
|
getSysDictionaryList |
|
|
|
} from "@/api/sysDictionary"; // 此处请自行替换地址 |
|
|
|
createSysDictionary, |
|
|
|
deleteSysDictionary, |
|
|
|
updateSysDictionary, |
|
|
|
findSysDictionary, |
|
|
|
getSysDictionaryList |
|
|
|
} from "@/api/sysDictionary"; // 此处请自行替换地址 |
|
|
|
import { formatTimeToStr } from "@/utils/date"; |
|
|
|
import infoList from "@/mixins/infoList"; |
|
|
|
export default { |
|
|
@ -129,25 +131,34 @@ export default { |
|
|
|
visible: false, |
|
|
|
type: "", |
|
|
|
formData: { |
|
|
|
name:null,type:null,status:true,desc:null |
|
|
|
name: null, |
|
|
|
type: null, |
|
|
|
status: true, |
|
|
|
desc: null |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
name: [{ |
|
|
|
required: true, |
|
|
|
message: '请输入字典名(中)', |
|
|
|
trigger: 'blur' |
|
|
|
}], |
|
|
|
type: [{ |
|
|
|
required: true, |
|
|
|
message: '请输入字典名(英)', |
|
|
|
trigger: 'blur' |
|
|
|
}], |
|
|
|
desc: [{ |
|
|
|
required: true, |
|
|
|
message: '请输入描述', |
|
|
|
trigger: 'blur' |
|
|
|
}], |
|
|
|
}, |
|
|
|
name: [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: "请输入字典名(中)", |
|
|
|
trigger: "blur" |
|
|
|
} |
|
|
|
], |
|
|
|
type: [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: "请输入字典名(英)", |
|
|
|
trigger: "blur" |
|
|
|
} |
|
|
|
], |
|
|
|
desc: [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: "请输入描述", |
|
|
|
trigger: "blur" |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
}; |
|
|
|
}, |
|
|
|
filters: { |
|
|
@ -161,30 +172,30 @@ export default { |
|
|
|
}, |
|
|
|
formatBoolean: function(bool) { |
|
|
|
if (bool != null) { |
|
|
|
return bool ? "是" :"否"; |
|
|
|
return bool ? "是" : "否"; |
|
|
|
} else { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
toDetile(row){ |
|
|
|
this.$router.push({ |
|
|
|
name:"dictionaryDetail", |
|
|
|
params:{ |
|
|
|
id:row.ID |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
//条件搜索前端看此方法 |
|
|
|
onSubmit() { |
|
|
|
this.page = 1 |
|
|
|
this.pageSize = 10 |
|
|
|
if (this.searchInfo.status==""){ |
|
|
|
this.searchInfo.status=null |
|
|
|
} |
|
|
|
this.getTableData() |
|
|
|
}, |
|
|
|
toDetile(row) { |
|
|
|
this.$router.push({ |
|
|
|
name: "dictionaryDetail", |
|
|
|
params: { |
|
|
|
id: row.ID |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
//条件搜索前端看此方法 |
|
|
|
onSubmit() { |
|
|
|
this.page = 1; |
|
|
|
this.pageSize = 10; |
|
|
|
if (this.searchInfo.status == "") { |
|
|
|
this.searchInfo.status = null; |
|
|
|
} |
|
|
|
this.getTableData(); |
|
|
|
}, |
|
|
|
async updateSysDictionary(row) { |
|
|
|
const res = await findSysDictionary({ ID: row.ID }); |
|
|
|
this.type = "update"; |
|
|
@ -196,10 +207,10 @@ export default { |
|
|
|
closeDialog() { |
|
|
|
this.dialogFormVisible = false; |
|
|
|
this.formData = { |
|
|
|
name:null, |
|
|
|
type:null, |
|
|
|
status:true, |
|
|
|
desc:null, |
|
|
|
name: null, |
|
|
|
type: null, |
|
|
|
status: true, |
|
|
|
desc: null |
|
|
|
}; |
|
|
|
}, |
|
|
|
async deleteSysDictionary(row) { |
|
|
@ -210,12 +221,15 @@ export default { |
|
|
|
type: "success", |
|
|
|
message: "删除成功" |
|
|
|
}); |
|
|
|
if (this.tableData.length == 1) { |
|
|
|
this.page--; |
|
|
|
} |
|
|
|
this.getTableData(); |
|
|
|
} |
|
|
|
}, |
|
|
|
async enterDialog() { |
|
|
|
this.$refs['elForm'].validate(async valid => { |
|
|
|
if (!valid) return |
|
|
|
this.$refs["elForm"].validate(async valid => { |
|
|
|
if (!valid) return; |
|
|
|
let res; |
|
|
|
switch (this.type) { |
|
|
|
case "create": |
|
|
@ -228,12 +242,11 @@ export default { |
|
|
|
res = await createSysDictionary(this.formData); |
|
|
|
break; |
|
|
|
} |
|
|
|
if (res.code == 0) { |
|
|
|
this.closeDialog(); |
|
|
|
this.getTableData(); |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
if (res.code == 0) { |
|
|
|
this.closeDialog(); |
|
|
|
this.getTableData(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
openDialog() { |
|
|
|
this.type = "create"; |
|
|
|