|
@ -21,14 +21,28 @@ |
|
|
<el-input v-model="searchInfo.desc" placeholder="搜索条件" /> |
|
|
<el-input v-model="searchInfo.desc" placeholder="搜索条件" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item> |
|
|
<el-form-item> |
|
|
<el-button size="mini" type="primary" icon="search" @click="onSubmit">查询</el-button> |
|
|
|
|
|
<el-button size="mini" icon="refresh" @click="onReset">重置</el-button> |
|
|
|
|
|
|
|
|
<el-button |
|
|
|
|
|
size="mini" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
icon="search" |
|
|
|
|
|
@click="onSubmit" |
|
|
|
|
|
>查询</el-button> |
|
|
|
|
|
<el-button |
|
|
|
|
|
size="mini" |
|
|
|
|
|
icon="refresh" |
|
|
|
|
|
@click="onReset" |
|
|
|
|
|
>重置</el-button> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-form> |
|
|
</el-form> |
|
|
</div> |
|
|
</div> |
|
|
<div class="gva-table-box"> |
|
|
<div class="gva-table-box"> |
|
|
<div class="gva-btn-list"> |
|
|
<div class="gva-btn-list"> |
|
|
<el-button size="mini" type="primary" icon="plus" @click="openDialog">新增</el-button> |
|
|
|
|
|
|
|
|
<el-button |
|
|
|
|
|
size="mini" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
icon="plus" |
|
|
|
|
|
@click="openDialog" |
|
|
|
|
|
>新增</el-button> |
|
|
</div> |
|
|
</div> |
|
|
<el-table |
|
|
<el-table |
|
|
ref="multipleTable" |
|
|
ref="multipleTable" |
|
@ -39,31 +53,72 @@ |
|
|
> |
|
|
> |
|
|
<el-table-column type="selection" width="55" /> |
|
|
<el-table-column type="selection" width="55" /> |
|
|
<el-table-column align="left" label="日期" width="180"> |
|
|
<el-table-column align="left" label="日期" width="180"> |
|
|
<template #default="scope">{{ formatDate(scope.row.CreatedAt) }}</template> |
|
|
|
|
|
|
|
|
<template #default="scope">{{ |
|
|
|
|
|
formatDate(scope.row.CreatedAt) |
|
|
|
|
|
}}</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
|
|
|
|
|
|
<el-table-column align="left" label="字典名(中)" prop="name" width="160" /> |
|
|
|
|
|
|
|
|
<el-table-column |
|
|
|
|
|
align="left" |
|
|
|
|
|
label="字典名(中)" |
|
|
|
|
|
prop="name" |
|
|
|
|
|
width="160" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
<el-table-column align="left" label="字典名(英)" prop="type" width="120" /> |
|
|
|
|
|
|
|
|
<el-table-column |
|
|
|
|
|
align="left" |
|
|
|
|
|
label="字典名(英)" |
|
|
|
|
|
prop="type" |
|
|
|
|
|
width="120" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
<el-table-column align="left" label="状态" prop="status" width="120"> |
|
|
<el-table-column align="left" label="状态" prop="status" width="120"> |
|
|
<template #default="scope">{{ formatBoolean(scope.row.status) }}</template> |
|
|
|
|
|
|
|
|
<template #default="scope">{{ |
|
|
|
|
|
formatBoolean(scope.row.status) |
|
|
|
|
|
}}</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
|
|
|
|
|
|
<el-table-column align="left" label="描述" prop="desc" width="280" /> |
|
|
<el-table-column align="left" label="描述" prop="desc" width="280" /> |
|
|
|
|
|
|
|
|
<el-table-column align="left" label="按钮组"> |
|
|
<el-table-column align="left" label="按钮组"> |
|
|
<template #default="scope"> |
|
|
<template #default="scope"> |
|
|
<el-button size="mini" icon="document" type="text" @click="toDetile(scope.row)">详情</el-button> |
|
|
|
|
|
<el-button size="mini" icon="edit" type="text" @click="updateSysDictionary(scope.row)">变更</el-button> |
|
|
|
|
|
<el-popover :visible="scope.row.visible" placement="top" width="160"> |
|
|
|
|
|
|
|
|
<el-button |
|
|
|
|
|
size="mini" |
|
|
|
|
|
icon="document" |
|
|
|
|
|
type="text" |
|
|
|
|
|
@click="toDetile(scope.row)" |
|
|
|
|
|
>详情</el-button> |
|
|
|
|
|
<el-button |
|
|
|
|
|
size="mini" |
|
|
|
|
|
icon="edit" |
|
|
|
|
|
type="text" |
|
|
|
|
|
@click="updateSysDictionaryFunc(scope.row)" |
|
|
|
|
|
>变更</el-button> |
|
|
|
|
|
<el-popover |
|
|
|
|
|
:visible="scope.row.visible" |
|
|
|
|
|
placement="top" |
|
|
|
|
|
width="160" |
|
|
|
|
|
> |
|
|
<p>确定要删除吗?</p> |
|
|
<p>确定要删除吗?</p> |
|
|
<div style="text-align: right; margin-top: 8px;"> |
|
|
|
|
|
<el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button> |
|
|
|
|
|
<el-button type="primary" size="mini" @click="deleteSysDictionary(scope.row)">确定</el-button> |
|
|
|
|
|
|
|
|
<div style="text-align: right; margin-top: 8px"> |
|
|
|
|
|
<el-button |
|
|
|
|
|
size="mini" |
|
|
|
|
|
type="text" |
|
|
|
|
|
@click="scope.row.visible = false" |
|
|
|
|
|
>取消</el-button> |
|
|
|
|
|
<el-button |
|
|
|
|
|
type="primary" |
|
|
|
|
|
size="mini" |
|
|
|
|
|
@click="deleteSysDictionaryFunc(scope.row)" |
|
|
|
|
|
>确定</el-button> |
|
|
</div> |
|
|
</div> |
|
|
<template #reference> |
|
|
<template #reference> |
|
|
<el-button type="text" icon="delete" size="mini" style="margin-left:10px">删除</el-button> |
|
|
|
|
|
|
|
|
<el-button |
|
|
|
|
|
type="text" |
|
|
|
|
|
icon="delete" |
|
|
|
|
|
size="mini" |
|
|
|
|
|
style="margin-left: 10px" |
|
|
|
|
|
>删除</el-button> |
|
|
</template> |
|
|
</template> |
|
|
</el-popover> |
|
|
</el-popover> |
|
|
</template> |
|
|
</template> |
|
@ -82,14 +137,24 @@ |
|
|
/> |
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<el-dialog v-model="dialogFormVisible" :before-close="closeDialog" title="弹窗操作"> |
|
|
|
|
|
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="110px"> |
|
|
|
|
|
|
|
|
<el-dialog |
|
|
|
|
|
v-model="dialogFormVisible" |
|
|
|
|
|
:before-close="closeDialog" |
|
|
|
|
|
title="弹窗操作" |
|
|
|
|
|
> |
|
|
|
|
|
<el-form |
|
|
|
|
|
ref="dialogForm" |
|
|
|
|
|
:model="formData" |
|
|
|
|
|
:rules="rules" |
|
|
|
|
|
size="medium" |
|
|
|
|
|
label-width="110px" |
|
|
|
|
|
> |
|
|
<el-form-item label="字典名(中)" prop="name"> |
|
|
<el-form-item label="字典名(中)" prop="name"> |
|
|
<el-input |
|
|
<el-input |
|
|
v-model="formData.name" |
|
|
v-model="formData.name" |
|
|
placeholder="请输入字典名(中)" |
|
|
placeholder="请输入字典名(中)" |
|
|
clearable |
|
|
clearable |
|
|
:style="{width: '100%'}" |
|
|
|
|
|
|
|
|
:style="{ width: '100%' }" |
|
|
/> |
|
|
/> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="字典名(英)" prop="type"> |
|
|
<el-form-item label="字典名(英)" prop="type"> |
|
@ -97,20 +162,33 @@ |
|
|
v-model="formData.type" |
|
|
v-model="formData.type" |
|
|
placeholder="请输入字典名(英)" |
|
|
placeholder="请输入字典名(英)" |
|
|
clearable |
|
|
clearable |
|
|
:style="{width: '100%'}" |
|
|
|
|
|
|
|
|
:style="{ width: '100%' }" |
|
|
/> |
|
|
/> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="状态" prop="status" required> |
|
|
<el-form-item label="状态" prop="status" required> |
|
|
<el-switch v-model="formData.status" active-text="开启" inactive-text="停用" /> |
|
|
|
|
|
|
|
|
<el-switch |
|
|
|
|
|
v-model="formData.status" |
|
|
|
|
|
active-text="开启" |
|
|
|
|
|
inactive-text="停用" |
|
|
|
|
|
/> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="描述" prop="desc"> |
|
|
<el-form-item label="描述" prop="desc"> |
|
|
<el-input v-model="formData.desc" placeholder="请输入描述" clearable :style="{width: '100%'}" /> |
|
|
|
|
|
|
|
|
<el-input |
|
|
|
|
|
v-model="formData.desc" |
|
|
|
|
|
placeholder="请输入描述" |
|
|
|
|
|
clearable |
|
|
|
|
|
:style="{ width: '100%' }" |
|
|
|
|
|
/> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-form> |
|
|
</el-form> |
|
|
<template #footer> |
|
|
<template #footer> |
|
|
<div class="dialog-footer"> |
|
|
<div class="dialog-footer"> |
|
|
<el-button size="small" @click="closeDialog">取 消</el-button> |
|
|
<el-button size="small" @click="closeDialog">取 消</el-button> |
|
|
<el-button size="small" type="primary" @click="enterDialog">确 定</el-button> |
|
|
|
|
|
|
|
|
<el-button |
|
|
|
|
|
size="small" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
@click="enterDialog" |
|
|
|
|
|
>确 定</el-button> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
@ -118,140 +196,174 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
|
|
|
export default { |
|
|
|
|
|
name: 'SysDictionary', |
|
|
|
|
|
} |
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<script setup> |
|
|
import { |
|
|
import { |
|
|
createSysDictionary, |
|
|
createSysDictionary, |
|
|
deleteSysDictionary, |
|
|
deleteSysDictionary, |
|
|
updateSysDictionary, |
|
|
updateSysDictionary, |
|
|
findSysDictionary, |
|
|
findSysDictionary, |
|
|
getSysDictionaryList |
|
|
|
|
|
|
|
|
getSysDictionaryList, |
|
|
} from '@/api/sysDictionary' // 此处请自行替换地址 |
|
|
} from '@/api/sysDictionary' // 此处请自行替换地址 |
|
|
import infoList from '@/mixins/infoList' |
|
|
|
|
|
import warningBar from '@/components/warningBar/warningBar.vue' |
|
|
import warningBar from '@/components/warningBar/warningBar.vue' |
|
|
export default { |
|
|
|
|
|
name: 'SysDictionary', |
|
|
|
|
|
components: { |
|
|
|
|
|
warningBar |
|
|
|
|
|
}, |
|
|
|
|
|
mixins: [infoList], |
|
|
|
|
|
data() { |
|
|
|
|
|
return { |
|
|
|
|
|
listApi: getSysDictionaryList, |
|
|
|
|
|
dialogFormVisible: false, |
|
|
|
|
|
type: '', |
|
|
|
|
|
formData: { |
|
|
|
|
|
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' |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
async created() { |
|
|
|
|
|
this.getTableData() |
|
|
|
|
|
}, |
|
|
|
|
|
methods: { |
|
|
|
|
|
toDetile(row) { |
|
|
|
|
|
this.$router.push({ |
|
|
|
|
|
name: 'dictionaryDetail', |
|
|
|
|
|
params: { |
|
|
|
|
|
id: row.ID |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
onReset() { |
|
|
|
|
|
this.searchInfo = {} |
|
|
|
|
|
}, |
|
|
|
|
|
// 条件搜索前端看此方法 |
|
|
|
|
|
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' |
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
this.formData = res.data.resysDictionary |
|
|
|
|
|
this.dialogFormVisible = true |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
import { ref } from 'vue' |
|
|
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
|
|
import { ElMessage } from 'element-plus' |
|
|
|
|
|
import { formatBoolean, formatDate } from '@/utils/format' |
|
|
|
|
|
|
|
|
|
|
|
const router = useRouter() |
|
|
|
|
|
|
|
|
|
|
|
const dialogFormVisible = ref(false) |
|
|
|
|
|
const type = ref('') |
|
|
|
|
|
const formData = ref({ |
|
|
|
|
|
name: null, |
|
|
|
|
|
type: null, |
|
|
|
|
|
status: true, |
|
|
|
|
|
desc: null, |
|
|
|
|
|
}) |
|
|
|
|
|
const rules = ref({ |
|
|
|
|
|
name: [ |
|
|
|
|
|
{ |
|
|
|
|
|
required: true, |
|
|
|
|
|
message: '请输入字典名(中)', |
|
|
|
|
|
trigger: 'blur', |
|
|
}, |
|
|
}, |
|
|
closeDialog() { |
|
|
|
|
|
this.dialogFormVisible = false |
|
|
|
|
|
this.formData = { |
|
|
|
|
|
name: null, |
|
|
|
|
|
type: null, |
|
|
|
|
|
status: true, |
|
|
|
|
|
desc: null |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
], |
|
|
|
|
|
type: [ |
|
|
|
|
|
{ |
|
|
|
|
|
required: true, |
|
|
|
|
|
message: '请输入字典名(英)', |
|
|
|
|
|
trigger: 'blur', |
|
|
}, |
|
|
}, |
|
|
async deleteSysDictionary(row) { |
|
|
|
|
|
row.visible = false |
|
|
|
|
|
const res = await deleteSysDictionary({ ID: row.ID }) |
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
this.$message({ |
|
|
|
|
|
type: 'success', |
|
|
|
|
|
message: '删除成功' |
|
|
|
|
|
}) |
|
|
|
|
|
if (this.tableData.length === 1 && this.page > 1) { |
|
|
|
|
|
this.page-- |
|
|
|
|
|
} |
|
|
|
|
|
this.getTableData() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
], |
|
|
|
|
|
desc: [ |
|
|
|
|
|
{ |
|
|
|
|
|
required: true, |
|
|
|
|
|
message: '请输入描述', |
|
|
|
|
|
trigger: 'blur', |
|
|
}, |
|
|
}, |
|
|
async enterDialog() { |
|
|
|
|
|
this.$refs['elForm'].validate(async valid => { |
|
|
|
|
|
if (!valid) return |
|
|
|
|
|
let res |
|
|
|
|
|
switch (this.type) { |
|
|
|
|
|
case 'create': |
|
|
|
|
|
res = await createSysDictionary(this.formData) |
|
|
|
|
|
break |
|
|
|
|
|
case 'update': |
|
|
|
|
|
res = await updateSysDictionary(this.formData) |
|
|
|
|
|
break |
|
|
|
|
|
default: |
|
|
|
|
|
res = await createSysDictionary(this.formData) |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
this.closeDialog() |
|
|
|
|
|
this.getTableData() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
], |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const page = ref(1) |
|
|
|
|
|
const total = ref(0) |
|
|
|
|
|
const pageSize = ref(10) |
|
|
|
|
|
const tableData = ref([]) |
|
|
|
|
|
const searchInfo = ref({}) |
|
|
|
|
|
|
|
|
|
|
|
const onReset = () => { |
|
|
|
|
|
searchInfo.value = {} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 条件搜索前端看此方法 |
|
|
|
|
|
const onSubmit = () => { |
|
|
|
|
|
page.value = 1 |
|
|
|
|
|
pageSize.value = 10 |
|
|
|
|
|
if (searchInfo.value.status === '') { |
|
|
|
|
|
searchInfo.value.status = null |
|
|
|
|
|
} |
|
|
|
|
|
getTableData() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 分页 |
|
|
|
|
|
const handleSizeChange = (val) => { |
|
|
|
|
|
pageSize.value = val |
|
|
|
|
|
getTableData() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const handleCurrentChange = (val) => { |
|
|
|
|
|
page.value = val |
|
|
|
|
|
getTableData() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 查询 |
|
|
|
|
|
const getTableData = async() => { |
|
|
|
|
|
const table = await getSysDictionaryList({ |
|
|
|
|
|
page: page.value, |
|
|
|
|
|
pageSize: pageSize.value, |
|
|
|
|
|
...searchInfo.value, |
|
|
|
|
|
}) |
|
|
|
|
|
if (table.code === 0) { |
|
|
|
|
|
tableData.value = table.data.list |
|
|
|
|
|
total.value = table.data.total |
|
|
|
|
|
page.value = table.data.page |
|
|
|
|
|
pageSize.value = table.data.pageSize |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getTableData() |
|
|
|
|
|
|
|
|
|
|
|
const toDetile = (row) => { |
|
|
|
|
|
router.push({ |
|
|
|
|
|
name: 'dictionaryDetail', |
|
|
|
|
|
params: { |
|
|
|
|
|
id: row.ID, |
|
|
}, |
|
|
}, |
|
|
openDialog() { |
|
|
|
|
|
this.type = 'create' |
|
|
|
|
|
this.dialogFormVisible = true |
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const updateSysDictionaryFunc = async(row) => { |
|
|
|
|
|
const res = await findSysDictionary({ ID: row.ID }) |
|
|
|
|
|
type.value = 'update' |
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
formData.value = res.data.resysDictionary |
|
|
|
|
|
dialogFormVisible.value = true |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
const closeDialog = () => { |
|
|
|
|
|
dialogFormVisible.value = false |
|
|
|
|
|
formData.value = { |
|
|
|
|
|
name: null, |
|
|
|
|
|
type: null, |
|
|
|
|
|
status: true, |
|
|
|
|
|
desc: null, |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
const deleteSysDictionaryFunc = async(row) => { |
|
|
|
|
|
row.visible = false |
|
|
|
|
|
const res = await deleteSysDictionary({ ID: row.ID }) |
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
ElMessage({ |
|
|
|
|
|
type: 'success', |
|
|
|
|
|
message: '删除成功', |
|
|
|
|
|
}) |
|
|
|
|
|
if (tableData.value.length === 1 && page.value > 1) { |
|
|
|
|
|
page.value-- |
|
|
} |
|
|
} |
|
|
|
|
|
getTableData() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const dialogForm = ref(null) |
|
|
|
|
|
const enterDialog = async() => { |
|
|
|
|
|
dialogForm.value.validate(async(valid) => { |
|
|
|
|
|
if (!valid) return |
|
|
|
|
|
let res |
|
|
|
|
|
switch (type.value) { |
|
|
|
|
|
case 'create': |
|
|
|
|
|
res = await createSysDictionary(formData.value) |
|
|
|
|
|
break |
|
|
|
|
|
case 'update': |
|
|
|
|
|
res = await updateSysDictionary(formData.value) |
|
|
|
|
|
break |
|
|
|
|
|
default: |
|
|
|
|
|
res = await createSysDictionary(formData.value) |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
closeDialog() |
|
|
|
|
|
getTableData() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
const openDialog = () => { |
|
|
|
|
|
type.value = 'create' |
|
|
|
|
|
dialogFormVisible.value = true |
|
|
|
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style> |
|
|
|
|
|
</style> |
|
|
|
|
|
|
|
|
<style></style> |