123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <template>
- <div class="table_item">
- <s-table ref="tableRef" :columns="columns" :data="loadData" :row-key="(record) => record.id">
- <template #operator>
- <!-- 搜索区域 -->
- <div class="table-search">
- <div class="table-search-form">
- <a-row :gutter="10">
- <a-form
- ref="searchFormRef"
- name="advanced_search"
- layout="inline"
- :label-col="{ style: { width: '70px', justifyContent: 'end' } }"
- :model="searchFormState"
- class="ant-advanced-search-form"
- >
- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8"
- ><a-form-item label="点位名称" name="name">
- <a-input v-model:value="searchFormState.name" placeholder="请输入点位名称" /> </a-form-item
- ></a-col>
- </a-form>
- </a-row>
- </div>
- <div class="table-search-buttons">
- <a-button type="primary" @click="tableRef.refresh(true)">查询</a-button>
- <a-button class="xn-mg08" @click="reset">重置</a-button>
- </div>
- </div>
- <!-- 其他操作区域 -->
- <div class="table-head-btn">
- <div class="btn-left">
- <a-button type="primary" @click="formRef.onOpen()">
- <template #icon><plus-outlined /></template>新增
- </a-button>
- </div>
- <div class="btn-right">
- <a-button>
- <template #icon><download-outlined /></template>导出
- </a-button>
- </div>
- </div>
- </template>
- <template #bodyCell="{ column, record }">
- <template v-if="column.dataIndex === 'modelName'">
- {{ $TOOL.dictTypeData('COIDCHAIN', record.modelName) }}
- </template>
- <template v-if="column.dataIndex === 'action'">
- <a-button type="link" size="small" @click="formRef.onOpen(record)">编辑</a-button>
- <a-popconfirm title="确定要删除吗?" @confirm="deleteData(record)">
- <a-button type="link" danger size="small">删除</a-button>
- </a-popconfirm>
- </template>
- </template>
- </s-table>
- <Form ref="formRef" @successful="tableRef.refresh(true)" />
- </div>
- </template>
- <script setup>
- import tool from '@/utils/tool'
- import locationApi from '@/api/basicset/locationApi.js'
- import Form from './form.vue'
- const formRef = ref()
- const searchFormRef = ref()
- const searchFormState = ref({})
- const tableRef = ref()
- const columns = [
- {
- title: '区域名称',
- dataIndex: 'name',
- align: 'center',
- ellipsis: true
- },
- {
- title: '监控对象',
- dataIndex: 'targetName',
- align: 'center',
- ellipsis: true
- },
- {
- title: '监控设备',
- dataIndex: 'modelName',
- align: 'center',
- ellipsis: true
- },
- {
- title: '传感器编号',
- dataIndex: 'sensorCode',
- align: 'center',
- ellipsis: true
- },
- {
- title: '传感器类型',
- dataIndex: 'sensorType',
- align: 'center',
- ellipsis: true
- },
- {
- title: '传感器路数',
- dataIndex: 'sensorRoute',
- align: 'center',
- ellipsis: true
- },
- {
- title: '报警上限',
- dataIndex: 'limitUp',
- align: 'center',
- ellipsis: true
- },
- {
- title: '报警下限',
- dataIndex: 'limitDown',
- align: 'center',
- ellipsis: true
- },
- {
- title: '操作',
- dataIndex: 'action',
- align: 'center',
- width: 150
- }
- ]
- const loadData = () => {
- return locationApi.locationPage(Object.assign(searchFormState.value)).then((res) => {
- if (res) {
- return res
- }
- return []
- })
- }
- // 重置
- const reset = () => {
- searchFormRef.value.resetFields()
- tableRef.value.refresh(true)
- }
- // 删除
- const deleteData = (record) => {
- let params = [
- {
- id: record.id
- }
- ]
- locationApi.locationDelete(params).then(() => {
- tableRef.value.refresh(true)
- reset()
- })
- }
- </script>
- <style lang="less" scoped>
- .table_item {
- padding: 15px 20px;
- background-color: #ffffff;
- :deep(.ant-table-pagination-right) {
- justify-content: center !important;
- }
- }
- </style>
|