本地已经有page的值了不需要a-radio
时间: 2024-12-12 18:28:02 浏览: 6
A-PDF Page Cut 3.5
5星 · 资源好评率100%
根据您提供的代码段和需求,如果您已经在前端逻辑中维护了一个 `page` 的值,并且不希望使用 `a-radio` 组件来实现分页或类似功能,您可以考虑如下调整:
1. **移除与 `a-radio` 相关的部分**:
- 如果 `a-radio` 组件用于切换页面或其他类似的分页控制,您可以直接从模板和脚本部分移除相关代码。
### 示例调整后的代码
```html
<template>
<div class = "table-page-search-wrapper">
<div class = "table-operator">
<a-button @click="showDrawer" type="primary" icon="plus">批量导入</a-button>
<a-button @click="handleAdd" type="primary" icon="plus">批量操作</a-button>
</div>
<!-- 抽屉 -->
<a-drawer
title="导入资产"
:visible="visible"
@close="onClose"
width="950"
>
<a-form-item label="检定方式">
<j-search-select-tag
placeholder="请选择检定方式"
v-model="queryParam.productModelCode"
dict="biz_product_model,name,code,del_flag=0 and status=1 and level=2"
/>
</a-form-item>
<BizBatchImport></BizBatchImport>
</a-drawer>
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i>
已选择 <a style="font-weight: 600;">{{ selectedRowKeys.length }}</a> 项
<a style="margin-left: 24px;" @click="onClearSelected">清空</a>
<div style="float: right;">
<a-tooltip slot="actions">
<template slot="title">重新加载数据</template>
<a-icon type="redo" @click="refreshTable" style="margin-right: 10px; color: #1890ff"/>
</a-tooltip>
<a-tooltip slot="actions">
<template slot="title">表格行高度</template>
<a-dropdown>
<a class="ant-dropdown-link" style="margin-right: 10px;">
<a-icon type="column-height" />
</a>
<a-menu slot="overlay">
<a-menu-item><a @click="reHeight('default')">缺省</a></a-menu-item>
<a-menu-item><a @click="reHeight('small')">紧凑</a></a-menu-item>
<a-menu-item><a @click="reHeight('middle')">中等</a></a-menu-item>
<a-menu-item><a @click="reHeight('large')">稀疏</a></a-menu-item>
</a-menu>
</a-dropdown>
</a-tooltip>
<a-tooltip slot="actions">
<template slot="title">自定义列</template>
<a-popover title="自定义列" trigger="click" placement="leftBottom" :getPopupContainer="triggerNode => triggerNode.parentNode">
<template slot="content">
<a-checkbox-group @change="onColSettingsChangeDef" v-model="settingChecked" :defaultValue="settingChecked">
<a-row>
<draggable @end="onColSettingsDragEnd" :options="{animation: 300}" v-model="settingColumns" style="max-height: 400px; overflow-y: auto">
<div v-for="(item, index) in settingColumns" :key="item.dataIndex">
<div>
<a-icon type="bars" style="margin-right: 15px; cursor: move;" />
<a-checkbox style="display: inline-block;" :value="item.dataIndex">{{ item.title || item.titleOther }}</a-checkbox>
<a-icon
type="pushpin"
@click="onColSettingsPin(index)"
:class="item.fixed ? (item.fixed === 'left' ? 'column-adjust-pin-left' : 'column-adjust-pin-right') : 'column-adjust-pin-off'"
/>
</div>
</div>
</draggable>
</a-row>
</a-checkbox-group>
<div style="text-align: right; margin-top: 7px; margin-right: 5px;">
<a-checkbox @change="onSequenceColChange" style="display: inline-block; float: left">序号列</a-checkbox>
<a-button @click="onColSettingsReset" size="small" style="margin-bottom: 0; margin-right: 10px;">重置</a-button>
<a-button @click="onColSettingsSave" type="primary" size="small" style="margin-bottom: 0;">保存</a-button>
</div>
</template>
<a class="ant-alert-custom-column"><a-icon type="setting"/></a>
</a-popover>
</a-tooltip>
</div>
</div>
<a-table
ref="table"
:size="tableRowHeight"
:scroll="{ x: true }"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
class="j-table-force-nowrap"
@change="handleTableChange"
>
<span slot="action" slot-scope="text, record">
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>移除</a>
</a-popconfirm>
</span>
</a-table>
</div>
</div>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import draggable from 'vuedraggable'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import StockMeterBaseDrawer from '../modules/StockMeterBaseDrawer.vue'
import JSuperQuery from '@/components/jeecg/JSuperQuery.vue'
import { initColumnsMixin } from '@/mixins/publicInitColumnsMixinNew'
import BizBatchImport from '../modules/BizBatchImport.vue'
export default {
name: 'BizMeterEdit',
mixins: [JeecgListMixin, mixinDevice, initColumnsMixin],
components: {
StockMeterBaseDrawer,
JSuperQuery,
draggable,
BizBatchImport
},
data() {
return {
visible: false,
defColumns: [
{ title: '表具编号', align: 'center', dataIndex: 'meterNum' },
{ title: '表具类型', align: 'center', dataIndex: 'gmType2' },
{ title: '厂商', align: 'center', dataIndex: 'vendorCode' },
{ title: '批次', align: 'center', dataIndex: 'batch' },
{ title: '生产日期', align: 'center', dataIndex: 'productionDate', customRender: function(text) { return !text ? '' : text.length > 10 ? text.substr(0, 10) : text }},
{ title: '有效期(年)', align: 'center', dataIndex: 'validityYears' },
{ title: '表具状态', align: 'center', dataIndex: 'status_dictText' },
{ title: '表具ICCID', align: 'center', dataIndex: 'iccid' },
{ title: '表具IMEI', align: 'center', dataIndex: 'imei' },
{ title: '进气方向', align: 'center', dataIndex: 'intakeDirection' },
{ title: '规格型号', align: 'center', dataIndex: 'ware1house' },
{ title: '检定机构', align: 'center', dataIndex: 'depart' },
{ title: '检定日期', align: 'center', dataIndex: 'Date', customRender: function(text) { return !text ? '' : text.length > 10 ? text.substr(0, 10) : text }},
{ title: '口径', align: 'center', dataIndex: 'gauge' },
{ title: '最小流量(m³/h)', align: 'center', dataIndex: 'minFlow' },
{ title: '最大流量(m³/h)', align: 'center', dataIndex: 'maxFlow' },
{ title: '最大工作压力值', align: 'center', dataIndex: 'maxWorkPressure' },
{ title: '工作电压', align: 'center', dataIndex: 'workVoltage' },
{ title: '操作', dataIndex: 'action', align: 'center', fixed: 'right', width: 147, scopedSlots: { customRender: 'action' }}
],
url: {
list: '/stock/stockMeterBase/list',
delete: '/stock/stockMeterBase/delete',
deleteBatch: '/stock/stockMeterBase/deleteBatch',
changeStatusBatch: '/stock/stockMeterBase/changeStatusBatch',
exportXlsxUrl: '/stock/stockMeterBase/exportExcel',
importXlsxUrl: '/stock/stockMeterBase/importExcel',
exportXlsxTemplateUrl: '/stock/stockMeterBase/exportExcelTemplate'
},
dictOptions: {},
superFieldList: []
};
},
created() {
this.getSuperFieldList();
},
methods: {
showDrawer() {
this.visible = true;
},
onClose() {
this.visible = false;
},
getSuperFieldList() {
const fieldList = [
// 各个字段的信息保持不变
{ type: 'string', value: 'companyCode', text: '所属燃气公司编码' },
{ type: 'string', value: 'meterNum', text: '表具编号' },
{ type: 'string', value: 'householdNum', text: '户号' },
{ type: 'string', value: 'batch', text: '批次' },
{ type: 'int', value: 'warehouse', text: '所属仓库' },
{ type: 'int', value: 'storageStatus', text: '在库状态' },
{ type: 'date', value: 'storageDate', text: '入库日期' },
{ type: 'date', value: 'productionDate', text: '生产日期' },
{ type: 'int', value: 'validityYears', text: '有效期(年)' },
{ type: 'string', value: 'iccid', text: '表具ICCID' },
{ type: 'string', value: 'imei', text: '表具IMEI' },
{ type: 'string', value: 'intakeDirection', text: '进气方向' },
{ type: 'int', value: 'gmType', text: '使用场景(表具类型 1民用 2商用)' },
{ type: 'int', value: 'isAuto', text: '是否远传 0:否 ;1:是' },
{ type: 'string', value: 'licenceCode', text: '表具对应的协议编号' },
{ type: 'string', value: 'productModelCode', text: '表具产品品类code' },
{ type: 'string', value: 'vendorCode', text: '厂商' },
{ type: 'int', value: 'verifyStatus', text: '检定状态' },
{ type: 'int', value: 'maintenanceStatus', text: '保养状态' },
{ type: 'int', value: 'lifeStatus', text: '表具状态(生命周期)' },
{ type: 'int', value: 'status', text: '表具状态 0停用 1启用' },
{ type: 'date', value: 'verifyDate', text: '检定日期' },
{ type: 'int', value: 'verifyAgency', text: '检定机构' },
{ type: 'int', value: 'flowSpecification', text: '流量规格(字典)' },
{ type: 'int', value: 'measPrinciple', text: '测量原理' },
{ type: 'int', value: 'gauge', text: '口径' },
{ type: 'string', value: 'minFlow', text: '最小流量(m³/h)' },
{ type: 'string', value: 'maxFlow', text: '最大流量(m³/h)' },
{ type: 'string', value: 'maxWorkPressure', text: '最大工作压力值' },
{ type: 'string', value: 'workVoltage', text: '工作电压' },
{ type: 'string', value: 'remarks', text: '备注' },
{ type: 'int', value: 'maintenanceDays', text: '距离下次保养天数(定时任务计算)' },
{ type: 'string', value: 'householder', text: '户主名' },
{ type: 'int', value: 'userType', text: '用户类型:1-居民用户;2-商业用户;3-工业用户;4-公共服务用户 5:公福-学校和敬老院 6:其他' },
{ type: 'string', value: 'createBy', text: '创建人' },
{ type: 'date', value: 'createTime', text: '创建时间' },
{ type: 'string', value: 'updateBy', text: '更新人' },
{ type: 'date', value: 'updateTime', text: '更新日期' }
];
this.superFieldList = fieldList;
}
}
}
</script>
<style lang="less" scoped>
</style>
```
### 关键点总结
- **移除不必要的 `a-radio` 元素及其相关的事件处理函数**。
- **确保现有的分页逻辑和其他功能不受影响**。
通过以上调整,您可以完全去除不再需要的 `a-radio` 组件,并继续使用现有的 `page` 值进行逻辑控制。
阅读全文