gaojs
6 months ago
15 changed files with 2460 additions and 23 deletions
@ -0,0 +1,60 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface EquipmentInspectionDetailVO { |
|||
id: number |
|||
number: string |
|||
masterId: number |
|||
completionTime: Date |
|||
uncompletedCause: string |
|||
result: string |
|||
name: string |
|||
content: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询巡检工单子列表
|
|||
export const getEquipmentInspectionDetailPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/equipment-inspection-detail/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/equipment-inspection-detail/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询巡检工单子详情
|
|||
export const getEquipmentInspectionDetail = async (id: number) => { |
|||
return await request.get({ url: `/eam/equipment-inspection-detail/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增巡检工单子
|
|||
export const createEquipmentInspectionDetail = async (data: EquipmentInspectionDetailVO) => { |
|||
return await request.post({ url: `/eam/equipment-inspection-detail/create`, data }) |
|||
} |
|||
|
|||
// 修改巡检工单子
|
|||
export const updateEquipmentInspectionDetail = async (data: EquipmentInspectionDetailVO) => { |
|||
return await request.put({ url: `/eam/equipment-inspection-detail/update`, data }) |
|||
} |
|||
|
|||
// 删除巡检工单子
|
|||
export const deleteEquipmentInspectionDetail = async (id: number) => { |
|||
return await request.delete({ url: `/eam/equipment-inspection-detail/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出巡检工单子 Excel
|
|||
export const exportEquipmentInspectionDetail = async (params) => { |
|||
return await request.download({ url: `/eam/equipment-inspection-detail/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/equipment-inspection-detail/get-import-template' }) |
|||
} |
@ -0,0 +1,57 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface RelationInspectionPlanItemVO { |
|||
id: number |
|||
planNumber: string |
|||
itemCode: string |
|||
itemName: string |
|||
isSelectd: boolean |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询巡检计划和巡检项关系列表
|
|||
export const getRelationInspectionPlanItemPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/relation-inspection-plan-item/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/relation-inspection-plan-item/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询巡检计划和巡检项关系详情
|
|||
export const getRelationInspectionPlanItem = async (id: number) => { |
|||
return await request.get({ url: `/eam/relation-inspection-plan-item/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增巡检计划和巡检项关系
|
|||
export const createRelationInspectionPlanItem = async (data: RelationInspectionPlanItemVO) => { |
|||
return await request.post({ url: `/eam/relation-inspection-plan-item/create`, data }) |
|||
} |
|||
|
|||
// 修改巡检计划和巡检项关系
|
|||
export const updateRelationInspectionPlanItem = async (data: RelationInspectionPlanItemVO) => { |
|||
return await request.put({ url: `/eam/relation-inspection-plan-item/update`, data }) |
|||
} |
|||
|
|||
// 删除巡检计划和巡检项关系
|
|||
export const deleteRelationInspectionPlanItem = async (id: number) => { |
|||
return await request.delete({ url: `/eam/relation-inspection-plan-item/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出巡检计划和巡检项关系 Excel
|
|||
export const exportRelationInspectionPlanItem = async (params) => { |
|||
return await request.download({ url: `/eam/relation-inspection-plan-item/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/relation-inspection-plan-item/get-import-template' }) |
|||
} |
@ -0,0 +1,232 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
import * as ItemApi from "@/api/eam/relationInspectionPlanItem"; |
|||
import { |
|||
RelationInspectionPlanItem |
|||
} from "@/views/eam/equipmentInspectionMain/equipmentInspectionMain.data"; |
|||
|
|||
// 表单校验
|
|||
export const EquipmentInspectionDetailRules = reactive({ |
|||
number: [required], |
|||
masterId: [required], |
|||
name: [required], |
|||
uncompletedCause:[{ |
|||
required:false , |
|||
message:'该项为必填项', |
|||
tagger:['blur','change'] |
|||
}], |
|||
result: [ |
|||
{ |
|||
required:false , |
|||
message:'该项为必填项', |
|||
tagger:['blur'] |
|||
}], |
|||
}) |
|||
|
|||
export const EquipmentInspectionDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '巡检工单号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form:{ |
|||
componentProps: { |
|||
disabled: true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '主表id', |
|||
field: 'masterId', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form:{ |
|||
componentProps: { |
|||
disabled: true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '完成时间', |
|||
field: 'completionTime', |
|||
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')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '未完成原因', |
|||
field: 'uncompletedCause', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '结果枚举', |
|||
field: 'result', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
dictType: DICT_TYPE.IS_COMPLETED, |
|||
dictClass: 'string', |
|||
}, |
|||
{ |
|||
label: '巡检项名称', |
|||
field: 'name', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: true, |
|||
form: { |
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择 非必选巡检项', |
|||
searchTitle: '非必选巡检项信息', // 查询弹窗标题
|
|||
searchAllSchemas: RelationInspectionPlanItem.allSchemas, // 查询弹窗所需类
|
|||
searchField: 'itemName', // 查询弹窗赋值字段
|
|||
searchPage: ItemApi.getRelationInspectionPlanItemPage, // 查询弹窗所需分页方法
|
|||
searchCondition: [] |
|||
} |
|||
} |
|||
}, |
|||
// {
|
|||
// label: '巡检内容',
|
|||
// field: 'content',
|
|||
// sort: 'custom',
|
|||
// isSearch: true,
|
|||
// form: {
|
|||
// componentProps: {
|
|||
// type:"textarea",
|
|||
// maxlength:"100"
|
|||
// }
|
|||
// }
|
|||
// },
|
|||
{ |
|||
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: '部门id', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '是否可用默认TRUE', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '删除时间', |
|||
field: 'deletionTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
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')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '删除人id', |
|||
field: 'deleterId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="EquipmentInspectionDetail.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="EquipmentInspectionDetail.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="formsSuccess" |
|||
:rules="EquipmentInspectionDetailRules" |
|||
:formAllSchemas="EquipmentInspectionDetail.allSchemas" |
|||
:apiUpdate="EquipmentInspectionDetailApi.updateEquipmentInspectionDetail" |
|||
:apiCreate="EquipmentInspectionDetailApi.createEquipmentInspectionDetail" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="EquipmentInspectionDetail.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/equipment-inspection-detail/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { EquipmentInspectionDetail,EquipmentInspectionDetailRules } from './equipmentInspectionDetail.data' |
|||
import * as EquipmentInspectionDetailApi from '@/api/eam/equipmentInspectionDetail' |
|||
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: 'EquipmentInspectionDetail' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(EquipmentInspectionDetail.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 { tableObject, tableMethods } = useTable({ |
|||
getListApi: EquipmentInspectionDetailApi.getEquipmentInspectionDetailPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'wms:equipmentInspectionDetail:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'wms:equipmentInspectionDetail:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'wms:equipmentInspectionDetail: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:equipmentInspectionDetail:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'wms:equipmentInspectionDetail: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) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =EquipmentInspectionDetail.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 EquipmentInspectionDetailApi.createEquipmentInspectionDetail(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await EquipmentInspectionDetailApi.updateEquipmentInspectionDetail(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, 'basicEquipmentInspectionDetail') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await EquipmentInspectionDetailApi.deleteEquipmentInspectionDetail(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 EquipmentInspectionDetailApi.exportEquipmentInspectionDetail(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() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await EquipmentInspectionDetailApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
File diff suppressed because it is too large
@ -0,0 +1,143 @@ |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="dialogTitle" :close-on-click-modal="false"> |
|||
<el-form ref="basicFormRef" v-loading="formLoading" :model="formData" :rules="formRules" label-width="100px"> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="验证人" prop="verifyer"> |
|||
<el-input v-model="formData.verifyer" placeholder="请输入验证人" :disabled="isDisabled"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="验证内容" prop="verifyContent"> |
|||
<el-input v-model="formData.verifyContent" type="textarea" :input-style="{height:'100px'}" maxlength="300" placeholder="请输入验证内容" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="验证时间" prop="verifyTime"> |
|||
<el-date-picker |
|||
v-model="formData.verifyTime" |
|||
type="datetime" |
|||
value-format="x" |
|||
placeholder="选择验证时间"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<template #footer> |
|||
<el-button :disabled="formLoading" type="primary" @click="submitForm('success')">确 定</el-button> |
|||
<el-button @click="handleClose('close')">取 消</el-button> |
|||
</template> |
|||
</Dialog> |
|||
|
|||
<!--添加巡检项弹窗--> |
|||
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> |
|||
|
|||
</template> |
|||
<script lang="ts" setup> |
|||
import * as EquipmentMaintenanceMainApi from '@/api/eam/equipmentMaintenanceMain' |
|||
import * as EquipmentInspectionMainApi from '@/api/eam/equipmentInspectionMain' |
|||
import { SearchTable } from '@/components/SearchTable' |
|||
import {ElInput} from "element-plus"; |
|||
|
|||
defineOptions({ name: 'TeamForm' }) |
|||
|
|||
const { t } = useI18n() // 国际化 |
|||
const message = useMessage() // 消息弹窗 |
|||
|
|||
const dialogVisible = ref(false) // 弹窗的是否展示 |
|||
const dialogTitle = ref('') // 弹窗的标题 |
|||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
|||
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
|||
const tags=ref([]) |
|||
|
|||
const inputValue = ref('') |
|||
const inputVisible = ref(false) |
|||
const isDisabled = ref(false) |
|||
const InputRef = ref<InstanceType<typeof ElInput>>() |
|||
|
|||
|
|||
const formData = ref({ |
|||
id:'', |
|||
number:'', |
|||
verifyer: '', |
|||
verifyContent: '', |
|||
verifyTime: '', |
|||
}) |
|||
const formRules = reactive({ |
|||
verifyer: [ |
|||
{ required: true, message: '验证人不能为空', trigger: 'blur' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
verifyContent: [ |
|||
{ required: true, message: '验证内容不能为空', trigger: 'blur' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
verifyTime: [ |
|||
{ required: true, message: '验证时间不能为空', trigger: 'blur' }, |
|||
], |
|||
}) |
|||
const basicFormRef = ref() // 表单 Ref |
|||
|
|||
|
|||
/** 初始化弹窗 */ |
|||
const open = async (type: string, row?: object) => { |
|||
dialogVisible.value = true |
|||
dialogTitle.value = t('action.' + type) |
|||
formType.value = type |
|||
//初始化数据 |
|||
formData.value.id = row.id |
|||
formData.value.number = row.planNumber |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 提交表单 */ |
|||
const submitForm = async (val) => { |
|||
|
|||
// 校验表单 |
|||
if (!basicFormRef) return |
|||
const valid = await basicFormRef.value.validate() |
|||
if (!valid) return |
|||
|
|||
//发送数据 |
|||
await EquipmentInspectionMainApi.updateEquipmentInspectionMain(formData.value) |
|||
//把success函数传递到父页面 |
|||
emit('success',formData.value.id) |
|||
dialogVisible.value = false |
|||
} |
|||
|
|||
const handleClose=(val)=>{ |
|||
dialogVisible.value = false |
|||
emit('close',val) |
|||
} |
|||
|
|||
// 传递给父类 |
|||
const emit = defineEmits(['close','success']) |
|||
|
|||
</script> |
|||
|
|||
<style scoped> |
|||
.tag-container { |
|||
margin-top: 10px; /* 可根据需要调整标签容器与表单项之间的间距 */ |
|||
border: 1px solid #ccc; /* 添加边框样式 */ |
|||
padding: 10px; /* 可根据需要调整容器内边距 */ |
|||
width: 950px; /* 设置固定宽度为 950px */ |
|||
overflow-y: auto; /* 当内容溢出容器高度时显示滚动条 */ |
|||
word-wrap: break-word; /* 使用 word-wrap 属性实现超出范围换行 */ |
|||
overflow-wrap: break-word; /* 兼容性更好的写法 */ |
|||
flex-wrap: wrap; |
|||
} |
|||
.input-with-button { |
|||
display: flex; |
|||
align-items: center; |
|||
width: 100%; |
|||
} |
|||
|
|||
.input-with-button > .el-input { |
|||
flex: 1; |
|||
/*margin-right: 10px;*/ |
|||
} |
|||
|
|||
</style> |
@ -0,0 +1,150 @@ |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="dialogTitle" :close-on-click-modal="false"> |
|||
<el-form ref="basicFormRef" v-loading="formLoading" :model="formData" :rules="formRules" label-width="100px"> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="巡检人ID" prop="maintenancer"> |
|||
<el-input v-model="formData.maintenancer" placeholder="请输入巡检人" :disabled="isDisabled"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="巡检人电话" prop="maintenancePhone"> |
|||
<el-input v-model="formData.maintenancePhone" placeholder="请输入巡检人电话" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="巡检开始时间" prop="startTime"> |
|||
<el-date-picker |
|||
v-model="formData.startTime" |
|||
type="datetime" |
|||
value-format="x" |
|||
placeholder="选择巡检开始时间"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="巡检结束时间" prop="endTime"> |
|||
<el-date-picker |
|||
v-model="formData.endTime" |
|||
type="datetime" |
|||
value-format="x" |
|||
placeholder="巡检结束时间"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<template #footer> |
|||
<el-button :disabled="formLoading" type="primary" @click="submitForm('success')">确 定</el-button> |
|||
<el-button @click="handleClose('close')">取 消</el-button> |
|||
</template> |
|||
</Dialog> |
|||
|
|||
<!--添加巡检项弹窗--> |
|||
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> |
|||
|
|||
</template> |
|||
<script lang="ts" setup> |
|||
import * as EquipmentInspectionMainApi from '@/api/eam/equipmentInspectionMain' |
|||
import { SearchTable } from '@/components/SearchTable' |
|||
import {ElInput} from "element-plus"; |
|||
|
|||
defineOptions({ name: 'TeamForm' }) |
|||
|
|||
const { t } = useI18n() // 国际化 |
|||
const message = useMessage() // 消息弹窗 |
|||
|
|||
const dialogVisible = ref(false) // 弹窗的是否展示 |
|||
const dialogTitle = ref('') // 弹窗的标题 |
|||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
|||
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
|||
const tags=ref([]) |
|||
|
|||
const inputValue = ref('') |
|||
const inputVisible = ref(false) |
|||
const isDisabled = ref(false) |
|||
const InputRef = ref<InstanceType<typeof ElInput>>() |
|||
|
|||
|
|||
const formData = ref({ |
|||
id:'', |
|||
number:'', |
|||
maintenancer: '', |
|||
maintenancePhone: '', |
|||
startTime:'', |
|||
endTime:'', |
|||
}) |
|||
const formRules = reactive({ |
|||
maintenancer: [ |
|||
{ required: true, message: '巡检人ID不能为空', trigger: 'blur' }, |
|||
], |
|||
maintenancePhone: [ |
|||
{ required: true, message: '巡检人电话不能为空', trigger: 'blur' }, |
|||
], |
|||
}) |
|||
const basicFormRef = ref() // 表单 Ref |
|||
|
|||
|
|||
/** 初始化弹窗 */ |
|||
const open = async (type: string, row?: object) => { |
|||
dialogVisible.value = true |
|||
dialogTitle.value = t('action.' + type) |
|||
formType.value = type |
|||
//初始化数据 |
|||
formData.value.id = row.id |
|||
formData.value.number = row.planNumber |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 提交表单 */ |
|||
const submitForm = async (val) => { |
|||
|
|||
|
|||
// 校验表单 |
|||
if (!basicFormRef) return |
|||
const valid = await basicFormRef.value.validate() |
|||
if (!valid) return |
|||
|
|||
//发送数据 |
|||
await EquipmentInspectionMainApi.updateEquipmentInspection(formData.value); |
|||
|
|||
//把success函数传递到父页面 |
|||
emit('success',formData.value.id) |
|||
dialogVisible.value = false |
|||
} |
|||
|
|||
const handleClose=(val)=>{ |
|||
dialogVisible.value = false |
|||
emit('close',val) |
|||
} |
|||
|
|||
// 传递给父类 |
|||
const emit = defineEmits(['close','success']) |
|||
|
|||
</script> |
|||
|
|||
<style scoped> |
|||
.tag-container { |
|||
margin-top: 10px; /* 可根据需要调整标签容器与表单项之间的间距 */ |
|||
border: 1px solid #ccc; /* 添加边框样式 */ |
|||
padding: 10px; /* 可根据需要调整容器内边距 */ |
|||
width: 950px; /* 设置固定宽度为 950px */ |
|||
overflow-y: auto; /* 当内容溢出容器高度时显示滚动条 */ |
|||
word-wrap: break-word; /* 使用 word-wrap 属性实现超出范围换行 */ |
|||
overflow-wrap: break-word; /* 兼容性更好的写法 */ |
|||
flex-wrap: wrap; |
|||
} |
|||
.input-with-button { |
|||
display: flex; |
|||
align-items: center; |
|||
width: 100%; |
|||
} |
|||
|
|||
.input-with-button > .el-input { |
|||
flex: 1; |
|||
/*margin-right: 10px;*/ |
|||
} |
|||
|
|||
</style> |
Loading…
Reference in new issue