127 lines
3.8 KiB
Vue
127 lines
3.8 KiB
Vue
<template>
|
|
<page-header-wrapper :title="false">
|
|
<a-card :bordered="false">
|
|
<div class="table-page-search-wrapper">
|
|
<a-form layout="inline">
|
|
<a-row :gutter="48">
|
|
<a-col :md="6" :sm="24">
|
|
<a-form-item label="词典名称">
|
|
<a-input v-model="queryParam.dictionaryName" placeholder="请输入词典名称" @pressEnter="handleRefresh"/>
|
|
</a-form-item>
|
|
</a-col>
|
|
<a-col :md="6" :sm="24">
|
|
<a-form-item label="词典编码">
|
|
<a-input v-model="queryParam.dictionaryCode" placeholder="请输入词典编码" @pressEnter="handleRefresh"/>
|
|
</a-form-item>
|
|
</a-col>
|
|
<a-col :md="6" :sm="24">
|
|
<a-button type="primary" @click="handleRefresh">查询</a-button>
|
|
<a-button @click="() => {queryParam = {}, handleRefresh()}">重置</a-button>
|
|
</a-col>
|
|
<a-col :md="6" :sm="24" align="right" >
|
|
<a-button type="primary" @click="handleCreate">新增</a-button>
|
|
</a-col>
|
|
</a-row>
|
|
</a-form>
|
|
</div>
|
|
<s-table
|
|
ref="table"
|
|
size="default"
|
|
rowKey="id"
|
|
:columns="columns"
|
|
:data="loadData"
|
|
>
|
|
<template slot="action" slot-scope="text, record">
|
|
<a href="javascript:;" @click="handleEdit(record)">修改</a>
|
|
<a-divider type="vertical" />
|
|
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
|
|
<a href="javascript:;">删除</a>
|
|
</a-popconfirm>
|
|
<a-divider type="vertical" />
|
|
<a href="javascript:;" @click="handleDetail(record.id)">详情</a>
|
|
<a-divider type="vertical" />
|
|
<router-link :to="'/dictionary/dictionaryItem/list/' + record.id">词典项</router-link>
|
|
</template>
|
|
</s-table>
|
|
<dictionary-form ref="modal" @ok="handleOk" />
|
|
<dictionary-detail ref="detail" />
|
|
</a-card>
|
|
</page-header-wrapper>
|
|
</template>
|
|
|
|
<script>
|
|
import { dictionaryPage, dictionaryDel } from '@/api/sys/dictionary'
|
|
import { STable } from '@/components'
|
|
import DictionaryForm from './DictionaryForm'
|
|
import DictionaryDetail from './DictionaryDetail'
|
|
|
|
export default {
|
|
name: 'DictionaryList',
|
|
components: {
|
|
STable,
|
|
DictionaryForm,
|
|
DictionaryDetail
|
|
},
|
|
data () {
|
|
return {
|
|
queryParam: { dictionaryName: '', dictionaryCode: '' },
|
|
selectedRowKeys: [], // 选中行的key 出选择框时需要配置
|
|
selectedRows: [], // 选中行的数据
|
|
columns: [
|
|
{ title: '词典名称', width: 30, dataIndex: 'dictionaryName', key: 'dictionaryName' },
|
|
{ title: '词典编码', width: 30, dataIndex: 'dictionaryCode', key: 'dictionaryCode' },
|
|
{
|
|
title: '操作',
|
|
key: 'operation',
|
|
width: 10,
|
|
align: 'right',
|
|
scopedSlots: { customRender: 'action' }
|
|
}
|
|
],
|
|
loadData: parameter => {
|
|
return dictionaryPage(Object.assign(parameter, this.queryParam))
|
|
.then(res => {
|
|
const data = res.data
|
|
return data
|
|
})
|
|
}
|
|
}
|
|
},
|
|
computed: {
|
|
rowSelection () {
|
|
return {
|
|
selectedRowKeys: this.selectedRowKeys,
|
|
onChange: this.onSelectChange
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
// 增
|
|
handleCreate () {
|
|
this.$refs.modal.add()
|
|
},
|
|
// 改
|
|
handleEdit (record) {
|
|
this.$refs.modal.edit(record)
|
|
},
|
|
// 删
|
|
handleDelete (record) {
|
|
dictionaryDel({ id: record.id }).then(() => {
|
|
this.$refs.table.refresh()
|
|
})
|
|
},
|
|
// 编辑后回调
|
|
handleOk () {
|
|
this.$refs.table.refresh()
|
|
},
|
|
// 详情
|
|
handleDetail (id) {
|
|
this.$refs.detail.show(id)
|
|
},
|
|
handleRefresh () {
|
|
this.$refs.table.refresh(true)
|
|
}
|
|
}
|
|
}
|
|
</script>
|