Browse Source

完成巡检点检项

master_hella_20240701
ljlong_2630 7 months ago
parent
commit
95aafa5c69
  1. 57
      src/api/eam/inspectionItem/index.ts
  2. 56
      src/api/eam/spotCheckItem/index.ts
  3. 4
      src/utils/dict.ts
  4. 2
      src/utils/disposition/defaultButtons.ts
  5. 28
      src/views/eam/equipmentManufacturer/equipmentManufacturer.data.ts
  6. 28
      src/views/eam/equipmentSupplier/equipmentSupplier.data.ts
  7. 272
      src/views/eam/inspectionItem/index.vue
  8. 110
      src/views/eam/inspectionItem/inspectionItem.data.ts
  9. 268
      src/views/eam/spotCheckItem/index.vue
  10. 104
      src/views/eam/spotCheckItem/spotCheckItem.data.ts

57
src/api/eam/inspectionItem/index.ts

@ -0,0 +1,57 @@
import request from '@/config/axios'
export interface InspectionItemVO {
id: number
content: string
equipmentParts: string
serialNumber: number
category: string
departmentCode: string
remark: string
siteId: string
available: string
deletionTime: Date
deleterId: byte[]
concurrencyStamp: number
}
// 查询巡检项列表
export const getInspectionItemPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/basic/inspection-item/senior', data })
} else {
return await request.get({ url: `/eam/basic/inspection-item/page`, params })
}
}
// 查询巡检项详情
export const getInspectionItem = async (id: number) => {
return await request.get({ url: `/eam/basic/inspection-item/get?id=` + id })
}
// 新增巡检项
export const createInspectionItem = async (data: InspectionItemVO) => {
return await request.post({ url: `/eam/basic/inspection-item/create`, data })
}
// 修改巡检项
export const updateInspectionItem = async (data: InspectionItemVO) => {
return await request.put({ url: `/eam/basic/inspection-item/update`, data })
}
// 删除巡检项
export const deleteInspectionItem = async (id: number) => {
return await request.delete({ url: `/eam/basic/inspection-item/delete?id=` + id })
}
// 导出巡检项 Excel
export const exportInspectionItem = async (params) => {
return await request.download({ url: `/eam/basic/inspection-item/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/basic/inspection-item/get-import-template' })
}

56
src/api/eam/spotCheckItem/index.ts

@ -0,0 +1,56 @@
import request from '@/config/axios'
export interface SpotCheckItemVO {
id: number
content: string
equipmentParts: string
serialNumber: number
departmentCode: string
remark: string
siteId: string
available: string
deletionTime: Date
deleterId: byte[]
concurrencyStamp: number
}
// 查询点检项列表
export const getSpotCheckItemPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/basic/spot-check-item/senior', data })
} else {
return await request.get({ url: `/eam/basic/spot-check-item/page`, params })
}
}
// 查询点检项详情
export const getSpotCheckItem = async (id: number) => {
return await request.get({ url: `/eam/basic/spot-check-item/get?id=` + id })
}
// 新增点检项
export const createSpotCheckItem = async (data: SpotCheckItemVO) => {
return await request.post({ url: `/eam/basic/spot-check-item/create`, data })
}
// 修改点检项
export const updateSpotCheckItem = async (data: SpotCheckItemVO) => {
return await request.put({ url: `/eam/basic/spot-check-item/update`, data })
}
// 删除点检项
export const deleteSpotCheckItem = async (id: number) => {
return await request.delete({ url: `/eam/basic/spot-check-item/delete?id=` + id })
}
// 导出点检项 Excel
export const exportSpotCheckItem = async (params) => {
return await request.download({ url: `/eam/basic/spot-check-item/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/basic/spot-check-item/get-import-template' })
}

4
src/utils/dict.ts

@ -337,4 +337,8 @@ export enum DICT_TYPE {
INTERFACE_STATUS = 'interfaceStatus', // 接口调用信息 接口状态 INTERFACE_STATUS = 'interfaceStatus', // 接口调用信息 接口状态
SYSTEM_DAY = 'system_day', // 系统天数 SYSTEM_DAY = 'system_day', // 系统天数
PURCHASE_INVOICE_ORDER_TYPE = 'purchase_invoice_order_type', // 发票采购订单类型 PURCHASE_INVOICE_ORDER_TYPE = 'purchase_invoice_order_type', // 发票采购订单类型
// ========== eam - 业务 - ==========
DEVICE_TYPE = 'device_type', // 设备类型
} }

2
src/utils/disposition/defaultButtons.ts

@ -269,7 +269,7 @@ export function mainListEnableBtn(option:any) {
label: t(`ts.启用`).replace('ts.', ''), label: t(`ts.启用`).replace('ts.', ''),
name: 'enable', name: 'enable',
hide: false, hide: false,
type: 'danger', type: 'success',
color: '', color: '',
link: true, // 文本展现按钮 link: true, // 文本展现按钮
hasPermi: '' hasPermi: ''

28
src/views/eam/equipmentManufacturer/equipmentManufacturer.data.ts

@ -82,7 +82,10 @@ export const EquipmentManufacturer = useCrudSchemas(reactive<CrudSchema[]>([
label: '部门', label: '部门',
field: 'departmentCode', field: 'departmentCode',
sort: 'custom', sort: 'custom',
isSearch: true, isTable: false,
isDetail: false,
isSearch: false,
isTableForm: false,
form: { form: {
component: 'TreeSelect', component: 'TreeSelect',
componentProps: { // 假设deptList是部门数据列表 componentProps: { // 假设deptList是部门数据列表
@ -105,28 +108,7 @@ export const EquipmentManufacturer = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
}, },
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
search: {
component: 'Select',
},
table: {
width: 110
}
},
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',

28
src/views/eam/equipmentSupplier/equipmentSupplier.data.ts

@ -88,7 +88,10 @@ export const EquipmentSupplier = useCrudSchemas(reactive<CrudSchema[]>([
label: '部门', label: '部门',
field: 'departmentCode', field: 'departmentCode',
sort: 'custom', sort: 'custom',
isSearch: true, isTable: false,
isDetail: false,
isSearch: false,
isTableForm: false,
form: { form: {
component: 'TreeSelect', component: 'TreeSelect',
componentProps: { // 假设deptList是部门数据列表 componentProps: { // 假设deptList是部门数据列表
@ -111,28 +114,7 @@ export const EquipmentSupplier = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
}, },
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
search: {
component: 'Select',
},
table: {
width: 110
}
},
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',

272
src/views/eam/inspectionItem/index.vue

@ -0,0 +1,272 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="InspectionItem.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="InspectionItem.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(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="InspectionItemRules"
:formAllSchemas="InspectionItem.allSchemas"
:apiUpdate="InspectionItemApi.updateInspectionItem"
:apiCreate="InspectionItemApi.createInspectionItem"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="InspectionItem.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/basic/inspection-item/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { InspectionItem,InspectionItemRules } from './inspectionItem.data'
import * as InspectionItemApi from '@/api/eam/inspectionItem'
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: 'InspectionItem' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(InspectionItem.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const judgeStatus = (row) =>{
if(row.available === 'TRUE'){
return true
}else{
return false
}
}
const { tableObject, tableMethods } = useTable({
getListApi: InspectionItemApi.getInspectionItemPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:inspection-item:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:inspection-item:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:inspection-item: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 = (row) => {
return [
defaultButtons.mainListEditBtn({hasPermi:'eam:inspection-item:update'}), //
defaultButtons.mainListEnableBtn({hasPermi:'eam:inspection-item:enable',hide: judgeStatus(row)}), //
defaultButtons.mainListDisableBtn({hasPermi:'eam:inspection-item:disable',hide: !judgeStatus(row)}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:inspection-item:delete'}), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'enable') { //
handleEnable(row,'TRUE')
}else if (val == 'disable') {//
handleEnable(row,'FALSE')
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =InspectionItem.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await InspectionItemApi.createInspectionItem(data)
message.success(t('common.createSuccess'))
} else {
await InspectionItemApi.updateInspectionItem(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicInspectionItem')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await InspectionItemApi.deleteInspectionItem(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 InspectionItemApi.exportInspectionItem(tableObject.params)
download.excel(data, '巡检项.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '巡检项导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
const handleEnable = (row,enable) =>{
row.available = enable
InspectionItemApi.updateInspectionItem(row).then(res => {
message.success(t('common.updateSuccess'))
getList()
})
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await InspectionItemApi.importTemplate()
})
</script>

110
src/views/eam/inspectionItem/inspectionItem.data.ts

@ -0,0 +1,110 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { handleTreeToComponentOptions } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept'
const deptList = ref<Tree[]>([]) // 树形结构
// 加载部门树(默认格式)
deptList.value = handleTreeToComponentOptions(await DeptApi.getSimpleDeptList())
// 表单校验
export const InspectionItemRules = reactive({
content: [required],
serialNumber: [required],
concurrencyStamp: [required],
type: [required],
})
export const InspectionItem = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '巡检内容',
field: 'content',
sort: 'custom',
isSearch: true,
form: {
component: 'Input',
componentProps: {
type: 'textarea'
}
}
},
{
label: '保养部位',
field: 'equipmentParts',
sort: 'custom',
isSearch: true
},
{
label: '类别',
field: 'category',
sort: 'custom',
isSearch: true
},
{
label: '序号',
field: 'serialNumber',
sort: 'custom',
isSearch: true,
fixed: 'left',
form: {
component:'InputNumber'
},
},
{
label: '来源于类型配置',
field: 'type',
sort: 'custom',
dictType: DICT_TYPE.DEVICE_TYPE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'Select'
}
},
{
label: '部门',
field: 'departmentCode',
sort: 'custom',
isTable: false,
isDetail: false,
isSearch: false,
isTableForm: false,
form: {
component: 'TreeSelect',
componentProps: { // 假设deptList是部门数据列表
data: deptList,
placeholder: "请选择部门",
filterable: true,
// multiple: true,
}
}
},
{
label: '是否启用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isTable: true,
isDetail: false,
isSearch: false,
isTableForm: false,
isForm: false,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

268
src/views/eam/spotCheckItem/index.vue

@ -0,0 +1,268 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="SpotCheckItem.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="SpotCheckItem.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(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="SpotCheckItemRules"
:formAllSchemas="SpotCheckItem.allSchemas"
:apiUpdate="SpotCheckItemApi.updateSpotCheckItem"
:apiCreate="SpotCheckItemApi.createSpotCheckItem"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="SpotCheckItem.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/basic/spot-check-item/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { SpotCheckItem,SpotCheckItemRules } from './spotCheckItem.data'
import * as SpotCheckItemApi from '@/api/eam/spotCheckItem'
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: 'SpotCheckItem' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(SpotCheckItem.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const judgeStatus = (row) =>{
if(row.available === 'TRUE'){
return true
}else{
return false
}
}
const { tableObject, tableMethods } = useTable({
getListApi: SpotCheckItemApi.getSpotCheckItemPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:spot-check-item:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:spot-check-item:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:spot-check-item: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 = (row) => {
return [
defaultButtons.mainListEditBtn({hasPermi:'eam:spot-check-item:update'}), //
defaultButtons.mainListEnableBtn({hasPermi:'eam:spot-check-item:enable',hide: judgeStatus(row)}), //
defaultButtons.mainListDisableBtn({hasPermi:'eam:spot-check-item:disable',hide: !judgeStatus(row)}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:spot-check-item:delete'}), //
]}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'enable') { //
handleEnable(row,'TRUE')
}else if (val == 'disable') {//
handleEnable(row,'FALSE')
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =SpotCheckItem.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await SpotCheckItemApi.createSpotCheckItem(data)
message.success(t('common.createSuccess'))
} else {
await SpotCheckItemApi.updateSpotCheckItem(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicSpotCheckItem')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await SpotCheckItemApi.deleteSpotCheckItem(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 SpotCheckItemApi.exportSpotCheckItem(tableObject.params)
download.excel(data, '点检项.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '点检项导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
const handleEnable = (row,enable) =>{
row.available = enable
SpotCheckItemApi.updateSpotCheckItem(row).then(res => {
message.success(t('common.updateSuccess'))
getList()
})
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await SpotCheckItemApi.importTemplate()
})
</script>

104
src/views/eam/spotCheckItem/spotCheckItem.data.ts

@ -0,0 +1,104 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { handleTreeToComponentOptions } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept'
const deptList = ref<Tree[]>([]) // 树形结构
// 加载部门树(默认格式)
deptList.value = handleTreeToComponentOptions(await DeptApi.getSimpleDeptList())
// 表单校验
export const SpotCheckItemRules = reactive({
content: [required],
serialNumber: [required],
concurrencyStamp: [required],
type: [required],
})
export const SpotCheckItem = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '点检内容',
field: 'content',
sort: 'custom',
isSearch: true,
form: {
component: 'Input',
componentProps: {
type: 'textarea'
}
}
},
{
label: '点检部位',
field: 'equipmentParts',
sort: 'custom',
isSearch: true
},
{
label: '序号',
field: 'serialNumber',
sort: 'custom',
isSearch: true,
fixed: 'left',
form: {
component:'InputNumber'
},
},
{
label: '来源于类型配置',
field: 'type',
sort: 'custom',
dictType: DICT_TYPE.DEVICE_TYPE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'Select'
}
},
{
label: '部门',
field: 'departmentCode',
sort: 'custom',
isTable: false,
isDetail: false,
isSearch: false,
isTableForm: false,
form: {
component: 'TreeSelect',
componentProps: { // 假设deptList是部门数据列表
data: deptList,
placeholder: "请选择部门",
filterable: true,
// multiple: true,
}
}
},
{
label: '是否启用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isTable: true,
isDetail: false,
isSearch: false,
isTableForm: false,
isForm: false,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
Loading…
Cancel
Save