Browse Source

EAM ——> 保养方案选择集 与 保养方案项 关联 前后端更新

master_hella_20240701
gaojs 6 months ago
parent
commit
feb58bf08a
  1. 20
      src/api/eam/documentTypeSelectSet/index.ts
  2. 18
      src/api/eam/inspectionItemSelectSet/index.ts
  3. 60
      src/api/eam/maintenanceItemSelectSet/index.ts
  4. 18
      src/api/eam/spotCheckSelectSet/index.ts
  5. 289
      src/views/eam/maintenanceItemSelectSet/index.vue
  6. 285
      src/views/eam/maintenanceItemSelectSet/itemSelectSetForm.vue
  7. 141
      src/views/eam/maintenanceItemSelectSet/maintenanceItemSelectSet.data.ts
  8. 18
      src/views/eam/spotCheckSelectSet/index.vue
  9. 2
      src/views/eam/spotCheckSelectSet/itemSelectSetForm.vue
  10. 0
      src/views/eam/spotCheckSelectSet/spotCheckSelectSet.data.ts

20
src/api/eam/documentTypeSelectSet/index.ts

@ -1,5 +1,5 @@
import request from '@/config/axios' import request from '@/config/axios'
import {BasicSpotCheckSelectSetVO} from "@/api/eam/basicSpotCheckSelectSet"; import {BasicSpotCheckSelectSetVO} from "@/api/eam/spotCheckSelectSet";
export interface DocumentTypeSelectSetVO { export interface DocumentTypeSelectSetVO {
id: number id: number
@ -19,43 +19,43 @@ export const getDocumentTypeSelectSetPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
delete params.isSearch delete params.isSearch
const data = {...params} const data = {...params}
return await request.post({ url: '/eam/document-type-select-set/senior', data }) return await request.post({ url: '/eam/basic/document-type-select-set/senior', data })
} else { } else {
return await request.get({ url: `/eam/document-type-select-set/page`, params }) return await request.get({ url: `/eam/basic/document-type-select-set/page`, params })
} }
} }
// 查询文档类型选择集详情 // 查询文档类型选择集详情
export const getDocumentTypeSelectSet = async (id: number) => { export const getDocumentTypeSelectSet = async (id: number) => {
return await request.get({ url: `/eam/document-type-select-set/get?id=` + id }) return await request.get({ url: `/eam/basic/document-type-select-set/get?id=` + id })
} }
// 新增文档类型选择集 // 新增文档类型选择集
export const createDocumentTypeSelectSet = async (data: DocumentTypeSelectSetVO) => { export const createDocumentTypeSelectSet = async (data: DocumentTypeSelectSetVO) => {
return await request.post({ url: `/eam/document-type-select-set/create`, data }) return await request.post({ url: `/eam/basic/document-type-select-set/create`, data })
} }
// 修改文档类型选择集 // 修改文档类型选择集
export const updateDocumentTypeSelectSet = async (data: DocumentTypeSelectSetVO) => { export const updateDocumentTypeSelectSet = async (data: DocumentTypeSelectSetVO) => {
return await request.put({ url: `/eam/document-type-select-set/update`, data }) return await request.put({ url: `/eam/basic/document-type-select-set/update`, data })
} }
// 删除文档类型选择集 // 删除文档类型选择集
export const deleteDocumentTypeSelectSet = async (id: number) => { export const deleteDocumentTypeSelectSet = async (id: number) => {
return await request.delete({ url: `/eam/document-type-select-set/delete?id=` + id }) return await request.delete({ url: `/eam/basic/document-type-select-set/delete?id=` + id })
} }
// 导出文档类型选择集 Excel // 导出文档类型选择集 Excel
export const exportDocumentTypeSelectSet = async (params) => { export const exportDocumentTypeSelectSet = async (params) => {
return await request.download({ url: `/eam/document-type-select-set/export-excel`, params }) return await request.download({ url: `/eam/basic/document-type-select-set/export-excel`, params })
} }
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/eam/document-type-select-set/get-import-template' }) return request.download({ url: '/eam/basic/document-type-select-set/get-import-template' })
} }
// 启用 / 禁用 // 启用 / 禁用
export const updateEnableCode = async (data: DocumentTypeSelectSetVO) => { export const updateEnableCode = async (data: DocumentTypeSelectSetVO) => {
return await request.post({ url: `/eam/document-type-select-set/ables` , data }) return await request.post({ url: `/eam/basic/document-type-select-set/ables` , data })
} }

18
src/api/eam/inspectionItemSelectSet/index.ts

@ -18,43 +18,43 @@ export const getInspectionItemSelectSetPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
delete params.isSearch delete params.isSearch
const data = {...params} const data = {...params}
return await request.post({ url: '/eam/inspection-item-select-set/senior', data }) return await request.post({ url: '/eam/basic/inspection-item-select-set/senior', data })
} else { } else {
return await request.get({ url: `/eam/inspection-item-select-set/page`, params }) return await request.get({ url: `/eam/basic/inspection-item-select-set/page`, params })
} }
} }
// 查询巡检项选择集详情 // 查询巡检项选择集详情
export const getInspectionItemSelectSet = async (id: number) => { export const getInspectionItemSelectSet = async (id: number) => {
return await request.get({ url: `/eam/inspection-item-select-set/get?id=` + id }) return await request.get({ url: `/eam/basic/inspection-item-select-set/get?id=` + id })
} }
// 新增巡检项选择集 // 新增巡检项选择集
export const createInspectionItemSelectSet = async (data: InspectionItemSelectSetVO) => { export const createInspectionItemSelectSet = async (data: InspectionItemSelectSetVO) => {
return await request.post({ url: `/eam/inspection-item-select-set/create`, data }) return await request.post({ url: `/eam/basic/inspection-item-select-set/create`, data })
} }
// 修改巡检项选择集 // 修改巡检项选择集
export const updateInspectionItemSelectSet = async (data: InspectionItemSelectSetVO) => { export const updateInspectionItemSelectSet = async (data: InspectionItemSelectSetVO) => {
return await request.put({ url: `/eam/inspection-item-select-set/update`, data }) return await request.put({ url: `/eam/basic/inspection-item-select-set/update`, data })
} }
// 删除巡检项选择集 // 删除巡检项选择集
export const deleteInspectionItemSelectSet = async (id: number) => { export const deleteInspectionItemSelectSet = async (id: number) => {
return await request.delete({ url: `/eam/inspection-item-select-set/delete?id=` + id }) return await request.delete({ url: `/eam/basic/inspection-item-select-set/delete?id=` + id })
} }
// 导出巡检项选择集 Excel // 导出巡检项选择集 Excel
export const exportInspectionItemSelectSet = async (params) => { export const exportInspectionItemSelectSet = async (params) => {
return await request.download({ url: `/eam/inspection-item-select-set/export-excel`, params }) return await request.download({ url: `/eam/basic/inspection-item-select-set/export-excel`, params })
} }
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/eam/inspection-item-select-set/get-import-template' }) return request.download({ url: '/eam/basic/inspection-item-select-set/get-import-template' })
} }
// 启用 / 禁用 // 启用 / 禁用
export const updateEnableCode = async (data: InspectionItemSelectSetVO) => { export const updateEnableCode = async (data: InspectionItemSelectSetVO) => {
return await request.post({ url: `/eam/inspection-item-select-set/ables` , data }) return await request.post({ url: `/eam/basic/inspection-item-select-set/ables` , data })
} }

60
src/api/eam/maintenanceItemSelectSet/index.ts

@ -0,0 +1,60 @@
import request from '@/config/axios'
export interface MaintenanceItemSelectSetVO {
id: number
name: string
itemCode: string
departmentCode: string
remark: string
siteId: string
available: string
deletionTime: Date
deleterId: byte[]
concurrencyStamp: number
}
// 查询保养项选择集列表
export const getBasicMaintenanceItemSelectSetPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/basic/maintenance-item-select-set/senior', data })
} else {
return await request.get({ url: `/eam/basic/maintenance-item-select-set/page`, params })
}
}
// 查询保养项选择集详情
export const getBasicMaintenanceItemSelectSet = async (id: number) => {
return await request.get({ url: `/eam/basic/maintenance-item-select-set/get?id=` + id })
}
// 新增保养项选择集
export const createBasicMaintenanceItemSelectSet = async (data: MaintenanceItemSelectSetVO) => {
return await request.post({ url: `/eam/basic/maintenance-item-select-set/create`, data })
}
// 修改保养项选择集
export const updateBasicMaintenanceItemSelectSet = async (data: MaintenanceItemSelectSetVO) => {
return await request.put({ url: `/eam/basic/maintenance-item-select-set/update`, data })
}
// 删除保养项选择集
export const deleteBasicMaintenanceItemSelectSet = async (id: number) => {
return await request.delete({ url: `/eam/basic/maintenance-item-select-set/delete?id=` + id })
}
// 导出保养项选择集 Excel
export const exportBasicMaintenanceItemSelectSet = async (params) => {
return await request.download({ url: `/eam/basic/maintenance-item-select-set/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/basic/maintenance-item-select-set/get-import-template' })
}
// 启用 / 禁用
export const updateEnableCode = async (data: MaintenanceItemSelectSetVO) => {
return await request.post({ url: `/eam/basic/inspection-item-select-set/ables` , data })
}

18
src/api/eam/basicSpotCheckSelectSet/index.ts → src/api/eam/spotCheckSelectSet/index.ts

@ -19,43 +19,43 @@ export const getBasicSpotCheckSelectSetPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
delete params.isSearch delete params.isSearch
const data = {...params} const data = {...params}
return await request.post({ url: '/eam/basic-spot-check-select-set/senior', data }) return await request.post({ url: '/eam/basic/spot-check-select-set/senior', data })
} else { } else {
return await request.get({ url: `/eam/basic-spot-check-select-set/page`, params }) return await request.get({ url: `/eam/basic/spot-check-select-set/page`, params })
} }
} }
// 查询点检选择集维护详情 // 查询点检选择集维护详情
export const getBasicSpotCheckSelectSet = async (id: number) => { export const getBasicSpotCheckSelectSet = async (id: number) => {
return await request.get({ url: `/eam/basic-spot-check-select-set/get?id=` + id }) return await request.get({ url: `/eam/basic/spot-check-select-set/get?id=` + id })
} }
// 新增点检选择集维护 // 新增点检选择集维护
export const createBasicSpotCheckSelectSet = async (data: BasicSpotCheckSelectSetVO) => { export const createBasicSpotCheckSelectSet = async (data: BasicSpotCheckSelectSetVO) => {
return await request.post({ url: `/eam/basic-spot-check-select-set/create`, data }) return await request.post({ url: `/eam/basic/spot-check-select-set/create`, data })
} }
// 修改点检选择集维护 // 修改点检选择集维护
export const updateBasicSpotCheckSelectSet = async (data: BasicSpotCheckSelectSetVO) => { export const updateBasicSpotCheckSelectSet = async (data: BasicSpotCheckSelectSetVO) => {
return await request.put({ url: `/eam/basic-spot-check-select-set/update`, data }) return await request.put({ url: `/eam/basic/spot-check-select-set/update`, data })
} }
// 删除点检选择集维护 // 删除点检选择集维护
export const deleteBasicSpotCheckSelectSet = async (id: number) => { export const deleteBasicSpotCheckSelectSet = async (id: number) => {
return await request.delete({ url: `/eam/basic-spot-check-select-set/delete?id=` + id }) return await request.delete({ url: `/eam/basic/spot-check-select-set/delete?id=` + id })
} }
// 导出点检选择集维护 Excel // 导出点检选择集维护 Excel
export const exportBasicSpotCheckSelectSet = async (params) => { export const exportBasicSpotCheckSelectSet = async (params) => {
return await request.download({ url: `/eam/basic-spot-check-select-set/export-excel`, params }) return await request.download({ url: `/eam/basic/spot-check-select-set/export-excel`, params })
} }
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/eam/basic-spot-check-select-set/get-import-template' }) return request.download({ url: '/eam/basic/spot-check-select-set/get-import-template' })
} }
// 启用 / 禁用 // 启用 / 禁用
export const updateEnableCode = async (data: BasicSpotCheckSelectSetVO) => { export const updateEnableCode = async (data: BasicSpotCheckSelectSetVO) => {
return await request.post({ url: `/eam/basic-spot-check-select-set/ables` , data }) return await request.post({ url: `/eam/basic/spot-check-select-set/ables` , data })
} }

289
src/views/eam/maintenanceItemSelectSet/index.vue

@ -0,0 +1,289 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="BasicMaintenanceItemSelectSet.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="BasicMaintenanceItemSelectSet.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 #name="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.name)">
<span>{{ row.name }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<ItemForm ref="basicFormRef" @success="getData"/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="BasicMaintenanceItemSelectSet.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/basic-maintenance-item-select-set/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { BasicMaintenanceItemSelectSet,BasicMaintenanceItemSelectSetRules } from './maintenanceItemSelectSet.data'
import * as BasicMaintenanceItemSelectSetApi from '@/api/eam/maintenanceItemSelectSet'
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'
import ItemForm from "@/views/eam/maintenanceItemSelectSet/itemSelectSetForm.vue";
import * as InspectionItemSelectSetApi from "@/api/eam/inspectionItemSelectSet";
defineOptions({ name: 'BasicMaintenanceItemSelectSet' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(BasicMaintenanceItemSelectSet.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: BasicMaintenanceItemSelectSetApi.getBasicMaintenanceItemSelectSetPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:maintenanceItemSelectSet:create'}), //
//defaultButtons.defaultImportBtn({hasPermi:'eam:basicMaintenanceItemSelectSet:import'}), //
//defaultButtons.defaultExportBtn({hasPermi:'eam:basicMaintenanceItemSelectSet: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 isShowMainButton = (row,val) => {
if (val.indexOf(row.available) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = (row) => {
return [
defaultButtons.mainListEditBtn({hasPermi:'eam:maintenanceItemSelectSet:update'}), //
//defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentMainPart:delete'}), //
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:maintenanceItemSelectSet:update'}),
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:maintenanceItemSelectSet:update'}),
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'enable') {
handleEnable(row.id)
} else if (val == 'disable') {
handleDisable(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =BasicMaintenanceItemSelectSet.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 BasicMaintenanceItemSelectSetApi.createBasicMaintenanceItemSelectSet(data)
message.success(t('common.createSuccess'))
} else {
await BasicMaintenanceItemSelectSetApi.updateBasicMaintenanceItemSelectSet(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
//
const getData = async() => {
getList();
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicBasicMaintenanceItemSelectSet')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await BasicMaintenanceItemSelectSetApi.deleteBasicMaintenanceItemSelectSet(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 启用 */
const handleEnable = async (id: number) => {
try {
const params = ref({
id: '',
available:'',
})
params.value.id = id
params.value.available = 'TRUE'
await BasicMaintenanceItemSelectSetApi.updateEnableCode(params.value)
message.success(t('common.updateSuccess'))
//
await getList()
} catch {}
}
/** 禁用 */
const handleDisable = async (id: number) => {
try {
const params = ref({
id: '',
available:'',
})
params.value.id = id
params.value.available = 'FALSE'
await BasicMaintenanceItemSelectSetApi.updateEnableCode(params.value)
message.success(t('common.updateSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await BasicMaintenanceItemSelectSetApi.exportBasicMaintenanceItemSelectSet(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 BasicMaintenanceItemSelectSetApi.importTemplate()
})
</script>

285
src/views/eam/maintenanceItemSelectSet/itemSelectSetForm.vue

@ -0,0 +1,285 @@
<template>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<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="name">
<el-input v-model="formData.name" placeholder="选择集名称" :disabled="isDisabled"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注名称" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="保养项" prop="items">
<div class="tag-container flex gap-2">
<el-tag v-for="ent in tags" :key="ent.content" closable :disable-transitions="false" @close="handleClose(ent.id)">
{{ ent.content}}
</el-tag>
<el-input v-if="inputVisible" ref="InputRef" v-model="inputValue" class="w-20" size="small"/>
<el-button v-else class="button-new-tag" size="small" @click="addItem">
添加保养项 +
</el-button>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button :disabled="formLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
<!--添加保养项弹窗-->
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" />
</template>
<script lang="ts" setup>
import * as SelectSetApi from '@/api/eam/MaintenanceItemSelectSet'
import request from "@/config/axios";
import { SearchTable } from '@/components/SearchTable'
import { MaintenanceItem} from "@/views/eam/maintenanceItem/maintenanceItem.data";
import * as maintenanceItemApi from "@/api/eam/maintenanceItem";
import {ElInput} from "element-plus";
import {getMaintenanceItemPage} from "@/api/eam/maintenanceItem";
import {
createBasicMaintenanceItemSelectSet,
MaintenanceItemSelectSetVO, updateBasicMaintenanceItemSelectSet
} from "@/api/eam/MaintenanceItemSelectSet";
defineOptions({ name: 'TeamForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
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 itemData = ref({
id: '',
content: ''
})
const formData = ref({
id: '',
name: '',
itemCode: '',
available: 'TRUE',
remark: '',
createTime: ''
})
const formRules = reactive({
name: [
{ required: true, message: '选择集名称不能为空', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
})
const basicFormRef = ref() // Ref
/** 删除保养项 */
const handleClose = (id: string) => {
const index = tags.value.findIndex(tag => tag.id === id);
if (index !== -1) {
tags.value.splice(index, 1);
}
}
/** 弹窗相关参数 */
const searchTableRef = ref();
const _searchTableTitle = ref();
const _searchTableAllSchemas = ref();
const _searchTablePage = ref();
const _formField = ref();
const _searchField = ref();
const _multiple = ref();
const _type = ref();
const _row = ref();
const _searchCondition = ref({})
const addItem = () =>{
addItemCommon(true,'baoYangItem')
}
/** 选择保养项弹窗 */
const addItemCommon = (multiple,field) => {
_searchCondition.value = {}
const filters: any[] = []
filters.push({
action: "==",
column: 'available',
value: 'TRUE'
})
//
_searchCondition.value.isSearch = true
_searchCondition.value.filters = filters
_searchTableTitle.value = '选择保养项'
_multiple.value = multiple
_formField.value = field
_searchField.value = field
_searchTablePage.value = maintenanceItemApi.getMaintenanceItemPage
_searchTableAllSchemas.value = MaintenanceItem.allSchemas
openCommon()
}
/** 弹窗选择之后 回调函数 添加选择集 */
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
nextTick?.(() => {
if (formField === 'baoYangItem') {
val.forEach(item => {
const isExist = tags.value.some(tag => tag.content === item.content);
if (!isExist){
const newItem = {};
newItem['content'] = item.content;
newItem['id'] = item.id;
tags.value.push(newItem);
}
});
}
})
}
/*打开弹窗*/
const openCommon = () => {
searchTableRef.value.open(
_searchTableTitle.value,
_searchTableAllSchemas.value,
_searchTablePage.value,
_formField.value,
_searchField.value,
_multiple.value,
_type.value,
_row.value,
_searchCondition.value
)
}
/** 初始化弹窗 */
const open = async (type: string, row?: object) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
//
if (row) {
tags.value=[];
isDisabled.value = true;
formLoading.value = true
formData.value = row;
let item = (row.itemCode).split(",")
try {
for (var i = 0; i < item.length; i++) {
itemData.value = await request.get({ url: `/eam/basic/maintenance-item/get?id=` + item[i] });
tags.value.push(itemData.value);
}
} finally {
formLoading.value = false
}
}
//
else {
resetForm()
isDisabled.value = false;
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
if (!basicFormRef) return
const valid = await basicFormRef.value.validate()
if (!valid) return
if (tags.value.length > 10 ){
message.warning('保养项最多10个');
return
}
let result = '';
for (var i = 0; i < tags.value.length; i++) {
result += tags.value[i].id + ',';
}
if(result.endsWith(',')){
result = result.substring(0,result.length -1)
}
formData.value.itemCode = result
//
formLoading.value = true
//formData.value.members = JSON.stringify(tags.value)
try {
const data = formData.value as unknown as SelectSetApi.MaintenanceItemSelectSetVO
if (formType.value === 'create') {
await SelectSetApi.createBasicMaintenanceItemSelectSet(data)
message.success(t('common.createSuccess'))
} else {
await SelectSetApi.updateBasicMaintenanceItemSelectSet(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: '',
name: '',
itemCode: '',
available: 'TRUE',
remark: '',
createTime: ''
}
tags.value=[];
basicFormRef.value?.resetFields()
}
</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>

141
src/views/eam/maintenanceItemSelectSet/maintenanceItemSelectSet.data.ts

@ -0,0 +1,141 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const BasicMaintenanceItemSelectSetRules = reactive({
name: [required],
itemCode: [required],
concurrencyStamp: [required],
})
export const BasicMaintenanceItemSelectSet = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '选择集名称',
field: 'name',
sort: 'custom',
isSearch: true,
},
{
label: '项编号',
field: 'itemCode',
sort: 'custom',
isSearch: true,
},
{
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: true,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
isDetail:false,
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isTable: true,
isDetail: false,
isSearch: true,
isTableForm: false,
isForm: 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'
}
}
]))

18
src/views/eam/basicSpotCheckSelectSet/index.vue → src/views/eam/spotCheckSelectSet/index.vue

@ -50,13 +50,13 @@
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { BasicSpotCheckSelectSet,BasicSpotCheckSelectSetRules } from './basicSpotCheckSelectSet.data' import { BasicSpotCheckSelectSet,BasicSpotCheckSelectSetRules } from './spotCheckSelectSet.data'
import * as BasicSpotCheckSelectSetApi from '@/api/eam/basicSpotCheckSelectSet' import * as BasicSpotCheckSelectSetApi from '@/api/eam/spotCheckSelectSet'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue' import Detail from '@/components/Detail/src/Detail.vue'
import ItemForm from "@/views/eam/basicSpotCheckSelectSet/itemSelectSetForm.vue"; import ItemForm from "@/views/eam/spotCheckSelectSet/itemSelectSetForm.vue";
defineOptions({ name: 'BasicSpotCheckSelectSet' }) defineOptions({ name: 'BasicSpotCheckSelectSet' })
@ -91,9 +91,9 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:basicSpotCheckSelectSet:create'}), // defaultButtons.defaultAddBtn({hasPermi:'eam:spotCheckSelectSet:create'}), //
//defaultButtons.defaultImportBtn({hasPermi:'eam:basicSpotCheckSelectSet:import'}), // //defaultButtons.defaultImportBtn({hasPermi:'eam:spotCheckSelectSet:import'}), //
//defaultButtons.defaultExportBtn({hasPermi:'eam:basicSpotCheckSelectSet:export'}), // //defaultButtons.defaultExportBtn({hasPermi:'eam:spotCheckSelectSet:export'}), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -134,10 +134,10 @@ const isShowMainButton = (row,val) => {
// - // -
const butttondata = (row) => { const butttondata = (row) => {
return [ return [
defaultButtons.mainListEditBtn({hasPermi:'eam:basicSpotCheckSelectSet:update'}), // defaultButtons.mainListEditBtn({hasPermi:'eam:spotCheckSelectSet:update'}), //
//defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentMainPart:delete'}), // //defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentMainPart:delete'}), //
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:basicSpotCheckSelectSet:update'}), defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:spotCheckSelectSet:update'}),
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:basicSpotCheckSelectSet:update'}), defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:spotCheckSelectSet:update'}),
] ]
} }

2
src/views/eam/basicSpotCheckSelectSet/itemSelectSetForm.vue → src/views/eam/spotCheckSelectSet/itemSelectSetForm.vue

@ -52,7 +52,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import * as SelectSetApi from '@/api/eam/basicSpotCheckSelectSet' import * as SelectSetApi from '@/api/eam/spotCheckSelectSet'
import request from "@/config/axios"; import request from "@/config/axios";
import { SearchTable } from '@/components/SearchTable' import { SearchTable } from '@/components/SearchTable'
import { InspectionItem} from "@/views/eam/inspectionItem/inspectionItem.data"; import { InspectionItem} from "@/views/eam/inspectionItem/inspectionItem.data";

0
src/views/eam/basicSpotCheckSelectSet/basicSpotCheckSelectSet.data.ts → src/views/eam/spotCheckSelectSet/spotCheckSelectSet.data.ts

Loading…
Cancel
Save