Browse Source

气体检测报警管理模块提交

master
songguoqiang 7 months ago
parent
commit
2451b2a8f2
  1. 50
      src/api/pszc/cdgasalarm/index.ts
  2. 51
      src/api/pszc/hrgasalarm108/index.ts
  3. 51
      src/api/pszc/hrgasalarm90/index.ts
  4. 2
      src/api/pszc/pszccommon/index.ts
  5. 114
      src/views/pszc/cdgasalarm/cdGasalarm.data.ts
  6. 231
      src/views/pszc/cdgasalarm/index.vue
  7. 90
      src/views/pszc/hrgasalarm108/hrGasalarm.data.ts
  8. 230
      src/views/pszc/hrgasalarm108/index.vue
  9. 90
      src/views/pszc/hrgasalarm90/hrGasalarm.data.ts
  10. 230
      src/views/pszc/hrgasalarm90/index.vue

50
src/api/pszc/cdgasalarm/index.ts

@ -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' })
}

51
src/api/pszc/hrgasalarm108/index.ts

@ -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' })
}

51
src/api/pszc/hrgasalarm90/index.ts

@ -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' })
}

2
src/api/pszc/pszccommon/index.ts

@ -1,7 +1,7 @@
import request from '@/config/axios'
// 动态获取下拉数据
// flag 1 冷拔-步进炉 ;2 冷拔-固熔炉 ; 3 冷拔-缝式炉 ; 4 冷拔-水表 ; 5 冷拔-智能电表 ; 6 冷拔-穿孔机 ; 7 冷拔-天然气总量8 冷拔-拔机9冷拔-退火炉
// flag 1 冷拔-步进炉 ;2 冷拔-固熔炉 ; 3 冷拔-缝式炉 ; 4 冷拔-水表 ; 5 冷拔-智能电表 ; 6 冷拔-穿孔机 ; 7 冷拔-天然气总量8 冷拔-拔机9冷拔-退火炉10冷拔-气体检测报警管理
// type 1 数据点数据 ; 2 仪表数据
export const selectCdPros = async (params) => {
return await request.get({ url: `/pszccommon/selectCdPros`, params })

114
src/views/pszc/cdgasalarm/cdGasalarm.data.ts

@ -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'
}
}
]))

231
src/views/pszc/cdgasalarm/index.vue

@ -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>

90
src/views/pszc/hrgasalarm108/hrGasalarm.data.ts

@ -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'
}
}
]))

230
src/views/pszc/hrgasalarm108/index.vue

@ -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>

90
src/views/pszc/hrgasalarm90/hrGasalarm.data.ts

@ -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'
}
}
]))

230
src/views/pszc/hrgasalarm90/index.vue

@ -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…
Cancel
Save