songguoqiang
7 months ago
10 changed files with 1138 additions and 1 deletions
@ -0,0 +1,50 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface CdGasalarmVO { |
||||
|
icode: string |
||||
|
iname: string |
||||
|
ivalue: string |
||||
|
mcode: string |
||||
|
mname: string |
||||
|
} |
||||
|
|
||||
|
// 查询冷拔气体报警器列表
|
||||
|
export const getCdGasalarmPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/pszc/cd-gasalarm/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/pszc/cd-gasalarm/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询冷拔气体报警器详情
|
||||
|
export const getCdGasalarm = async (id: number) => { |
||||
|
return await request.get({ url: `/pszc/cd-gasalarm/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增冷拔气体报警器
|
||||
|
export const createCdGasalarm = async (data: CdGasalarmVO) => { |
||||
|
return await request.post({ url: `/pszc/cd-gasalarm/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改冷拔气体报警器
|
||||
|
export const updateCdGasalarm = async (data: CdGasalarmVO) => { |
||||
|
return await request.put({ url: `/pszc/cd-gasalarm/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除冷拔气体报警器
|
||||
|
export const deleteCdGasalarm = async (id: number) => { |
||||
|
return await request.delete({ url: `/pszc/cd-gasalarm/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出冷拔气体报警器 Excel
|
||||
|
export const exportCdGasalarm = async (params) => { |
||||
|
return await request.download({ url: `/pszc/cd-gasalarm/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/pszc/cd-gasalarm/get-import-template' }) |
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface HrGasalarmVO { |
||||
|
icode: string |
||||
|
iname: string |
||||
|
ivalue: string |
||||
|
mcode: string |
||||
|
mname: string |
||||
|
} |
||||
|
|
||||
|
// 查询热轧气体报警器列表
|
||||
|
export const getHrGasalarmPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/pszc/hr-gasalarm/senior', data }) |
||||
|
} else { |
||||
|
params.mcode="108_alarm_001" |
||||
|
return await request.get({ url: `/pszc/hr-gasalarm/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询热轧气体报警器详情
|
||||
|
export const getHrGasalarm = async (id: number) => { |
||||
|
return await request.get({ url: `/pszc/hr-gasalarm/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增热轧气体报警器
|
||||
|
export const createHrGasalarm = async (data: HrGasalarmVO) => { |
||||
|
return await request.post({ url: `/pszc/hr-gasalarm/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改热轧气体报警器
|
||||
|
export const updateHrGasalarm = async (data: HrGasalarmVO) => { |
||||
|
return await request.put({ url: `/pszc/hr-gasalarm/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除热轧气体报警器
|
||||
|
export const deleteHrGasalarm = async (id: number) => { |
||||
|
return await request.delete({ url: `/pszc/hr-gasalarm/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出热轧气体报警器 Excel
|
||||
|
export const exportHrGasalarm = async (params) => { |
||||
|
return await request.download({ url: `/pszc/hr-gasalarm/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/pszc/hr-gasalarm/get-import-template' }) |
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface HrGasalarmVO { |
||||
|
icode: string |
||||
|
iname: string |
||||
|
ivalue: string |
||||
|
mcode: string |
||||
|
mname: string |
||||
|
} |
||||
|
|
||||
|
// 查询热轧气体报警器列表
|
||||
|
export const getHrGasalarmPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/pszc/hr-gasalarm/senior', data }) |
||||
|
} else { |
||||
|
params.mcode="90_alarm_001" |
||||
|
return await request.get({ url: `/pszc/hr-gasalarm/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询热轧气体报警器详情
|
||||
|
export const getHrGasalarm = async (id: number) => { |
||||
|
return await request.get({ url: `/pszc/hr-gasalarm/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增热轧气体报警器
|
||||
|
export const createHrGasalarm = async (data: HrGasalarmVO) => { |
||||
|
return await request.post({ url: `/pszc/hr-gasalarm/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改热轧气体报警器
|
||||
|
export const updateHrGasalarm = async (data: HrGasalarmVO) => { |
||||
|
return await request.put({ url: `/pszc/hr-gasalarm/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除热轧气体报警器
|
||||
|
export const deleteHrGasalarm = async (id: number) => { |
||||
|
return await request.delete({ url: `/pszc/hr-gasalarm/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出热轧气体报警器 Excel
|
||||
|
export const exportHrGasalarm = async (params) => { |
||||
|
return await request.download({ url: `/pszc/hr-gasalarm/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/pszc/hr-gasalarm/get-import-template' }) |
||||
|
} |
@ -0,0 +1,114 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import * as PszcCommonApi from '@/api/pszc/pszccommon' |
||||
|
import { TableColumn } from '@/types/table' |
||||
|
// 数据点
|
||||
|
const sjdList = await PszcCommonApi.selectCdPros({flag: '10' , type: '1'}) |
||||
|
// 仪器仪表
|
||||
|
const yqbList = await PszcCommonApi.selectCdPros({flag: '10' , type: '2'}) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const CdGasalarmRules = reactive({ |
||||
|
}) |
||||
|
|
||||
|
export const CdGasalarm = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '数据点编号', |
||||
|
field: 'icode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '数据点名称', |
||||
|
field: 'icode', |
||||
|
isSearch:false, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
||||
|
return sjdList.find((obj) => obj.code === cellValue)?.label |
||||
|
}, |
||||
|
search: {//数据有重复暂时不需要查询
|
||||
|
show: false, |
||||
|
component: 'Select', |
||||
|
api: () => sjdList, |
||||
|
componentProps: { |
||||
|
optionsAlias: { |
||||
|
labelField: 'label', |
||||
|
valueField: 'code' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Select', |
||||
|
api: () => sjdList, |
||||
|
componentProps: { |
||||
|
optionsAlias: { |
||||
|
labelField: 'label', |
||||
|
valueField: 'code' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '采集值', |
||||
|
field: 'ivalue', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '仪表的编号', |
||||
|
field: 'mcode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '仪表的名称', |
||||
|
field: 'mcode', |
||||
|
isTable: true, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
||||
|
return yqbList.find((obj) => obj.code === cellValue)?.label |
||||
|
}, |
||||
|
search: { |
||||
|
show: true, |
||||
|
component: 'Select', |
||||
|
api: () => yqbList, |
||||
|
componentProps: { |
||||
|
optionsAlias: { |
||||
|
labelField: 'label', |
||||
|
valueField: 'code' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Select', |
||||
|
api: () => yqbList, |
||||
|
componentProps: { |
||||
|
optionsAlias: { |
||||
|
labelField: 'label', |
||||
|
valueField: 'code' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
isTable:false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,231 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="CdGasalarm.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="CdGasalarm.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="getList" |
||||
|
:rules="CdGasalarmRules" |
||||
|
:formAllSchemas="CdGasalarm.allSchemas" |
||||
|
:searchTableParams="searchTableParams" |
||||
|
:apiUpdate="CdGasalarmApi.updateCdGasalarm" |
||||
|
:apiCreate="CdGasalarmApi.createCdGasalarm" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="CdGasalarm.allSchemas" /> --> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<!-- <ImportForm ref="importFormRef" url="/pszc/cd-gasalarm/import" :importTemplateData="importTemplateData" @success="importSuccess" /> --> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { CdGasalarm,CdGasalarmRules } from './cdGasalarm.data' |
||||
|
import * as CdGasalarmApi from '@/api/pszc/cdgasalarm' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
// import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
// import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'CdGasalarm' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(CdGasalarm.allSchemas.tableColumns) |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 查询列表页面参数设置 |
||||
|
const searchTableParams = ref([ |
||||
|
//{ |
||||
|
// formField: 'productItemCode', |
||||
|
// searchTableTitle: '物料信息', |
||||
|
// searchTableAllSchemas: Itembasic.allSchemas, |
||||
|
// searchTablePage: ItembasicApi.getItembasicPage |
||||
|
//} |
||||
|
]) |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: CdGasalarmApi.getCdGasalarmPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:cdGasalarm:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:cdGasalarm:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:cdGasalarm:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
//defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'wms:cdGasalarm:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:cdGasalarm:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicCdGasalarm') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await CdGasalarmApi.deleteCdGasalarm(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const exportLoading = ref(false) // 导出的加载中 |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
exportLoading.value = true |
||||
|
const data = await CdGasalarmApi.exportCdGasalarm(setSearchParams) |
||||
|
download.excel(data, '冷拔气体报警器.xls') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '冷拔气体报警器导入模版.xls' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
//importTemplateData.templateUrl = await CdGasalarmApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,90 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import * as PszcCommonApi from '@/api/pszc/pszccommon' |
||||
|
import { TableColumn } from '@/types/table' |
||||
|
// 数据点
|
||||
|
const sjdList = await PszcCommonApi.selectCdPros({flag: '12' , type: '1'}) |
||||
|
// 仪器仪表
|
||||
|
const yqbList = await PszcCommonApi.selectCdPros({flag: '12' , type: '2'}) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const HrGasalarmRules = reactive({ |
||||
|
}) |
||||
|
|
||||
|
export const HrGasalarm = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '数据点编号', |
||||
|
field: 'icode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '数据点名称', |
||||
|
field: 'iname', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '采集值', |
||||
|
field: 'ivalue', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '仪表的编号', |
||||
|
field: 'mcode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '仪表的名称', |
||||
|
field: 'mcode', |
||||
|
isTable: true, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
||||
|
return yqbList.find((obj) => obj.code === cellValue)?.label |
||||
|
}, |
||||
|
search: { |
||||
|
show: true, |
||||
|
component: 'Select', |
||||
|
api: () => yqbList, |
||||
|
componentProps: { |
||||
|
optionsAlias: { |
||||
|
labelField: 'label', |
||||
|
valueField: 'code' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Select', |
||||
|
api: () => yqbList, |
||||
|
componentProps: { |
||||
|
optionsAlias: { |
||||
|
labelField: 'label', |
||||
|
valueField: 'code' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
isTable:false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,230 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="HrGasalarm.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="HrGasalarm.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="getList" |
||||
|
:rules="HrGasalarmRules" |
||||
|
:formAllSchemas="HrGasalarm.allSchemas" |
||||
|
:searchTableParams="searchTableParams" |
||||
|
:apiUpdate="HrGasalarmApi.updateHrGasalarm" |
||||
|
:apiCreate="HrGasalarmApi.createHrGasalarm" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="HrGasalarm.allSchemas" /> --> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<!-- <ImportForm ref="importFormRef" url="/pszc/hr-gasalarm/import" :importTemplateData="importTemplateData" @success="importSuccess" /> --> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { HrGasalarm,HrGasalarmRules } from './hrGasalarm.data' |
||||
|
import * as HrGasalarmApi from '@/api/pszc/hrgasalarm108' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
// import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
// import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'HrGasalarm108' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(HrGasalarm.allSchemas.tableColumns) |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 查询列表页面参数设置 |
||||
|
const searchTableParams = ref([ |
||||
|
//{ |
||||
|
// formField: 'productItemCode', |
||||
|
// searchTableTitle: '物料信息', |
||||
|
// searchTableAllSchemas: Itembasic.allSchemas, |
||||
|
// searchTablePage: ItembasicApi.getItembasicPage |
||||
|
//} |
||||
|
]) |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: HrGasalarmApi.getHrGasalarmPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:hrGasalarm:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:hrGasalarm:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:hrGasalarm:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'wms:hrGasalarm:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:hrGasalarm:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicHrGasalarm') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await HrGasalarmApi.deleteHrGasalarm(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const exportLoading = ref(false) // 导出的加载中 |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
exportLoading.value = true |
||||
|
const data = await HrGasalarmApi.exportHrGasalarm(setSearchParams) |
||||
|
download.excel(data, '热轧气体报警器.xls') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '热轧气体报警器导入模版.xls' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,90 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import * as PszcCommonApi from '@/api/pszc/pszccommon' |
||||
|
import { TableColumn } from '@/types/table' |
||||
|
// 数据点
|
||||
|
const sjdList = await PszcCommonApi.selectCdPros({flag: '11' , type: '1'}) |
||||
|
// 仪器仪表
|
||||
|
const yqbList = await PszcCommonApi.selectCdPros({flag: '11' , type: '2'}) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const HrGasalarmRules = reactive({ |
||||
|
}) |
||||
|
|
||||
|
export const HrGasalarm = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '数据点编号', |
||||
|
field: 'icode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '数据点名称', |
||||
|
field: 'iname', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '采集值', |
||||
|
field: 'ivalue', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '仪表的编号', |
||||
|
field: 'mcode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '仪表的名称', |
||||
|
field: 'mcode', |
||||
|
isTable: true, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
||||
|
return yqbList.find((obj) => obj.code === cellValue)?.label |
||||
|
}, |
||||
|
search: { |
||||
|
show: true, |
||||
|
component: 'Select', |
||||
|
api: () => yqbList, |
||||
|
componentProps: { |
||||
|
optionsAlias: { |
||||
|
labelField: 'label', |
||||
|
valueField: 'code' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Select', |
||||
|
api: () => yqbList, |
||||
|
componentProps: { |
||||
|
optionsAlias: { |
||||
|
labelField: 'label', |
||||
|
valueField: 'code' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
isTable:false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,230 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="HrGasalarm.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="HrGasalarm.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="getList" |
||||
|
:rules="HrGasalarmRules" |
||||
|
:formAllSchemas="HrGasalarm.allSchemas" |
||||
|
:searchTableParams="searchTableParams" |
||||
|
:apiUpdate="HrGasalarmApi.updateHrGasalarm" |
||||
|
:apiCreate="HrGasalarmApi.createHrGasalarm" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="HrGasalarm.allSchemas" /> --> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<!-- <ImportForm ref="importFormRef" url="/pszc/hr-gasalarm/import" :importTemplateData="importTemplateData" @success="importSuccess" /> --> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { HrGasalarm,HrGasalarmRules } from './hrGasalarm.data' |
||||
|
import * as HrGasalarmApi from '@/api/pszc/hrgasalarm90' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
// import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
// import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'HrGasalarm90' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(HrGasalarm.allSchemas.tableColumns) |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 查询列表页面参数设置 |
||||
|
const searchTableParams = ref([ |
||||
|
//{ |
||||
|
// formField: 'productItemCode', |
||||
|
// searchTableTitle: '物料信息', |
||||
|
// searchTableAllSchemas: Itembasic.allSchemas, |
||||
|
// searchTablePage: ItembasicApi.getItembasicPage |
||||
|
//} |
||||
|
]) |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: HrGasalarmApi.getHrGasalarmPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:hrGasalarm:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:hrGasalarm:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:hrGasalarm:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
//defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'wms:hrGasalarm:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:hrGasalarm:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicHrGasalarm') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await HrGasalarmApi.deleteHrGasalarm(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const exportLoading = ref(false) // 导出的加载中 |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
exportLoading.value = true |
||||
|
const data = await HrGasalarmApi.exportHrGasalarm(setSearchParams) |
||||
|
download.excel(data, '热轧气体报警器.xls') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '热轧气体报警器导入模版.xls' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
}) |
||||
|
|
||||
|
</script> |
Loading…
Reference in new issue