IDCDatasync-vue/src/views/ship/shipNum.vue
2025-03-08 19:02:56 +08:00

162 lines
4.3 KiB
Vue

<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="30">
<a-col :md="6" :sm="10" >
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- table区域-begin -->
<div style="height:900px;overflow-y:auto;">
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys,onChange: onSelectChange}"
@change="handleTableChange">
<!-- :locale="myLocale"-->
<!-- 字符串超长截取省略号显示-->
<span slot="name" slot-scope="text">
<j-ellipsis :value="text" :length="20" />
</span>
<span slot="describe" slot-scope="text">
<j-ellipsis :value="text" :length="20" />
</span>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">修改</a>
</span>
</a-table>
</div>
<!-- table区域-end -->
<!-- 表单区域 -->
<shipNumModal ref="modalForm" @ok="modalFormOk"></shipNumModal>
</a-card>
</template>
<script>
import shipNumModal from './modules/shipNumModal'
import { shipNumPageList } from '@/api/ship'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from "@/components/jeecg/JEllipsis";
export default {
name: "shiplist",
mixins:[JeecgListMixin],
components: {
shipNumModal,
JEllipsis,
VNodes: {
functional: true,
render: (h, ctx) => ctx.props.vnodes,
},
},
data () {
return {
description: 'JT舷号管理',
dataSources: [],
queryParam: {
pageNum :1,
pageSize:20
},
columns: [
{
title: '#',
dataIndex: '',
key:'id',
width:60,
align:"id",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '舷号名称',
align:"name",
dataIndex: 'name',
},
{
title: '型号名称',
align:"modelName",
dataIndex: 'modelName'
},
{
title: '说明',
align:"describe",
dataIndex: 'describe'
},
{
title: '创建时间',
align:"createTime",
width: 250,
dataIndex: 'createTime',
},
{
title: '操作',
dataIndex: 'action',
align:"center",
width:180,
scopedSlots: { customRender: 'action' },
}
]
}
},
computed: {
},
created () {
this.loadData();
},
methods: {
//筛选需要重写handleTableChange
handleTableChange(pagination, filters, sorter) {
//分页、排序、筛选变化时触发
//TODO 筛选
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field;
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
}
this.ipagination = pagination;
this.loadData();
},
loadData() {
shipNumPageList(this.queryParam).then((res) => {
if (res.success) {
this.dataSource = res.result.rows||res.result;
if(res.result.total)
{
this.ipagination.total = res.result.total;
}
} else {
this.$message.warning(res.message);
}
});
},
handleEdit: function (record) {
this.$refs.modalForm.edit(record);
this.$refs.modalForm.title = "编辑";
},
handleAdd() {
this.$refs.modalForm.add();
this.$refs.modalForm.title = "新增";
},
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>