Browse Source

EAM ——> 设备台账 增加正常/停役

hella_online_20240829
gaojs 5 months ago
parent
commit
dfe78de358
  1. 6
      src/api/eam/equipmentAccounts/index.ts
  2. 2
      src/views/eam/equipmentAccounts/equipmentAccounts.data.ts
  3. 300
      src/views/eam/equipmentAccounts/index.vue

6
src/api/eam/equipmentAccounts/index.ts

@ -15,6 +15,7 @@ export interface EquipmentAccountsVO {
principal: string
principalTelephone: string
status: string
changeReason: string
startDate: Date
supplierCode: string
purchaseTime: Date
@ -82,3 +83,8 @@ export const importTemplate = () => {
export const getEquipmentAccountsNoPage = async (params) => {
return await request.get({ url: `/eam/device/equipment-accounts/noPage`, params })
}
//停用启用
export const ableEquipmentAccountsMain = async (data: EquipmentAccountsVO) => {
return await request.post({ url: `/eam/device/equipment-accounts/ables`, data })
}

2
src/views/eam/equipmentAccounts/equipmentAccounts.data.ts

@ -631,7 +631,7 @@ export const EquipmentAccounts = useCrudSchemas(reactive<CrudSchema[]>([
field: 'action',
isForm: false,
table: {
width: 200,
width: 250,
fixed: 'right'
}
}

300
src/views/eam/equipmentAccounts/index.vue

@ -1,11 +1,7 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search
:schema="EquipmentAccounts.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
<Search :schema="EquipmentAccounts.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
@ -37,7 +33,7 @@
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" />
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)"/>
</template>
</Table>
</ContentWrap>
@ -54,6 +50,8 @@
:isBusiness="false"
/>
<AblesForm ref="ablesFormRef" @success="getData" @close="getClosed"/>
<!-- 详情 -->
<DetailLedger
ref="detailRef"
@ -74,12 +72,7 @@
<!-- 备件 -->
<SearchTable ref="searchSparePartTableRef" @searchTableSuccess="submitSparePartRelation" />
<!-- 导入 -->
<ImportForm
ref="importFormRef"
url="/eam/device/equipment-accounts/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
<ImportForm ref="importFormRef" url="/eam/device/equipment-accounts/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
@ -89,71 +82,38 @@ import * as EquipmentAccountsApi from '@/api/eam/equipmentAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import AblesForm from '@/views/eam/equipmentAccounts/ablesForm.vue'
import DetailLedger from '@/components/Detail/src/DetailLedger.vue'
import { RelationMainPart, RelationMainPartRules } from '../relationMainPart/relationMainPart.data'
import * as RelationMainPartApi from '@/api/eam/relationMainPart'
import {
EquipmentMainPart,
EquipmentMainPartRules
} from '../equipmentMainPart/equipmentMainPart.data'
import { EquipmentMainPart,EquipmentMainPartRules } from '../equipmentMainPart/equipmentMainPart.data'
import * as EquipmentMainPartApi from '@/api/eam/equipmentMainPart'
import { Item, ItemRules } from '../item/item.data'
import * as ItemApi from '@/api/eam/item'
import {
EquipmentToolSparePart,
EquipmentToolSparePartRules
} from '../equipmentToolSparePart/equipmentToolSparePart.data'
import { SparePart,SparePartRules } from '../sparePart/sparePart.data'
import * as SparePartApi from '@/api/eam/sparePart'
import * as EquipmentToolSparePartApi from '@/api/eam/equipmentToolSparePart'
import {
EquipmentReportRepairRequest,
EquipmentReportRepairRequestRules
} from '../equipmentReportRepairRequest/equipmentReportRepairRequest.data'
import { EquipmentReportRepairRequest,EquipmentReportRepairRequestRules } from '../equipmentReportRepairRequest/equipmentReportRepairRequest.data'
import * as EquipmentReportRepairRequestApi from '@/api/eam/equipmentReportRepairRequest'
import {
EquipmentSpotCheckRecordMain,
EquipmentSpotCheckRecordMainRules
} from '../equipmentSpotCheckRecordMain/equipmentSpotCheckRecordMain.data'
import { EquipmentSpotCheckRecordMain,EquipmentSpotCheckRecordMainRules } from '../equipmentSpotCheckRecordMain/equipmentSpotCheckRecordMain.data'
import * as EquipmentSpotCheckRecordMainApi from '@/api/eam/equipmentSpotCheckRecordMain'
import {
EquipmentSpotCheckRecordDetail,
EquipmentSpotCheckRecordDetailRules
} from '../equipmentSpotCheckRecordDetail/equipmentSpotCheckRecordDetail.data'
import { EquipmentSpotCheckRecordDetail,EquipmentSpotCheckRecordDetailRules } from '../equipmentSpotCheckRecordDetail/equipmentSpotCheckRecordDetail.data'
import * as EquipmentSpotCheckRecordDetailApi from '@/api/eam/equipmentSpotCheckRecordDetail'
import {
EquipmentInspectionRecordMain,
EquipmentInspectionRecordMainRules
} from '../equipmentInspectionRecordMain/equipmentInspectionRecordMain.data'
import { EquipmentInspectionRecordMain,EquipmentInspectionRecordMainRules } from '../equipmentInspectionRecordMain/equipmentInspectionRecordMain.data'
import * as EquipmentInspectionRecordMainApi from '@/api/eam/equipmentInspectionRecordMain'
import {
EquipmentInspectionRecordDetail,
EquipmentInspectionRecordDetailRules
} from '../equipmentInspectionRecordDetail/equipmentInspectionRecordDetail.data'
import { EquipmentInspectionRecordDetail,EquipmentInspectionRecordDetailRules } from '../equipmentInspectionRecordDetail/equipmentInspectionRecordDetail.data'
import * as EquipmentInspectionRecordDetailApi from '@/api/eam/equipmentInspectionRecordDetail'
import {
EquipmentRepairRecordMain,
EquipmentRepairRecordMainRules
} from '../equipmentRepairRecordMain/equipmentRepairRecordMain.data'
import { EquipmentRepairRecordMain,EquipmentRepairRecordMainRules } from '../equipmentRepairRecordMain/equipmentRepairRecordMain.data'
import * as EquipmentRepairRecordMainApi from '@/api/eam/equipmentRepairRecordMain'
import {
EquipmentRepairRecordDetail,
EquipmentRepairRecordDetailRules
} from '../equipmentRepairRecordDetail/equipmentRepairRecordDetail.data'
import { EquipmentRepairRecordDetail,EquipmentRepairRecordDetailRules } from '../equipmentRepairRecordDetail/equipmentRepairRecordDetail.data'
import * as EquipmentRepairRecordDetailApi from '@/api/eam/equipmentRepairRecordDetail'
import {
EquipmentMaintenanceRecordMain,
EquipmentMaintenanceRecordMainRules
} from '../equipmentMaintenanceRecordMain/equipmentMaintenanceRecordMain.data'
import { EquipmentMaintenanceRecordMain,EquipmentMaintenanceRecordMainRules } from '../equipmentMaintenanceRecordMain/equipmentMaintenanceRecordMain.data'
import * as EquipmentMaintenanceRecordMainApi from '@/api/eam/equipmentMaintenanceRecordMain'
import {
EquipmentMaintenanceRecordDetail,
EquipmentMaintenanceRecordDetailRules
} from '../equipmentMaintenanceRecordDetail/equipmentMaintenanceRecordDetail.data'
import { EquipmentMaintenanceRecordDetail,EquipmentMaintenanceRecordDetailRules } from '../equipmentMaintenanceRecordDetail/equipmentMaintenanceRecordDetail.data'
import * as EquipmentMaintenanceRecordDetailApi from '@/api/eam/equipmentMaintenanceRecordDetail'
import * as WorkshopApi from '@/api/wms/workshop'
import * as ProductionlineApi from '@/api/wms/productionline'
import * as EquipmentSupplierApi from '@/api/eam/equipmentSupplier'
import * as EquipmentManufacturerApi from '@/api/eam/equipmentManufacturer'
defineOptions({ name: 'EquipmentAccounts' })
const message = useMessage() //
@ -164,12 +124,13 @@ const routeName = ref()
const deviceNumber = ref()
routeName.value = route.name
const tableColumns = ref(EquipmentAccounts.allSchemas.tableColumns)
const tabs = ref<{ label: string; prop: string }[]>([])
const subTabList = ref([])
const tabs = ref<{ label: string; prop: string; }[]>([])
const subTabList = ref([]);
const detailAllSchemas = ref()
const apiPage = ref()
const dialogApiPage = ref()
const dialogAllSchemas = ref()
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
@ -197,18 +158,20 @@ const operationRecordList = ref([
{label:'维修记录',value:'repair'},
{label:'保养记录',value:'maintenance'},
{label:'巡检记录',value:'inspection'},
{ label: '点检记录', value: 'spot_check' }
{label:'点检记录',value:'spot_check'},
])
const dynamicInfoFields = ref([
'totalRunningTime',
'maintenanceRunningTime',
'usageTimes',
'lastInspectionDate',
'outageRate',
'breakdownRecover',
'purchaseInterval'
])
"totalRunningTime",
"maintenanceRunningTime",
"usageTimes",
"lastInspectionDate",
"outageRate",
"breakdownRecover",
"purchaseInterval"
]);
//
const updataTableColumns = (val) => {
@ -229,7 +192,7 @@ const HeadButttondata = [
defaultButtons.defaultExportBtn({hasPermi:'eam:equipment-accounts:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null) //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
@ -242,48 +205,59 @@ const HeadButttondata = [
//
const buttonBaseClick = (val, item) => {
if (val == 'add') {
//
if (val == 'add') { //
openForm('create')
} else if (val == 'import') {
//
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') {
//
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') {
//
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') {
//
} else {
//
} 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 = [
const butttondata = (row) => {
return [
defaultButtons.mainListEditBtn({hasPermi:'eam:equipment-accounts:update'}), //
defaultButtons.componentBtn({hasPermi:'eam:equipment-accounts:component'}), //
defaultButtons.sparePartBtn({ hasPermi: 'eam:equipment-accounts:item' }) //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipment-accounts:delete'}), //
defaultButtons.sparePartBtn({hasPermi:'eam:equipment-accounts:item'}), //
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:basicFaultType:update'}),
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:basicFaultType:update'}),
]
}
//
const ablesFormRef = ref()
function openables(row, val) {
ablesFormRef.value.open(val,row);
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') {
//
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'component') {
//
} else if (val == 'component') { //
openComponent(row)
} else if (val == 'sparePart') {
//
} else if (val == 'sparePart') { //
openSparePart(row)
} else if (val == 'enable') { // /
openables(row,val)
} else if (val == 'disable') { // /
openables(row,val)
}
}
@ -291,19 +265,28 @@ const buttonTableClick = async (val, row) => {
const basicFormRef = ref()
const openForm = async (type: string, row?: any) => {
if(type == 'update'){
const equipmentManufacturerNoPage =
await EquipmentManufacturerApi.getEquipmentManufacturerNoPage({})
const equipmentManufacturerNoPage = await EquipmentManufacturerApi.getEquipmentManufacturerNoPage({})
const equipmentSupplierNoPage = await EquipmentSupplierApi.getEquipmentSupplierNoPage({})
const workshopNoPage = await WorkshopApi.getWorkshopNoPage({})
const productionlineNoPage = await ProductionlineApi.getProductionlineNoPage({})
row.workshopName = workshopNoPage?.find((item) => item.code == row.workshopCode)?.name
row.lineName = productionlineNoPage?.find((item) => item.code == row.lineCode)?.name
row.manufactureName = equipmentManufacturerNoPage?.find(
(item) => item.number == row.manufactureCode
)?.name
row.supplierName = equipmentSupplierNoPage?.find(
(item) => item.number == row.supplierCode
)?.name
const productionlineNoPage = await ProductionlineApi.getProductionlineNoPage({});
row.workshopName = workshopNoPage?.find(item=>item.code == row.workshopCode)?.name
row.lineName = productionlineNoPage?.find(item=>item.code == row.lineCode)?.name
row.manufactureName = equipmentManufacturerNoPage?.find(item=>item.number == row.manufactureCode)?.name
row.supplierName = equipmentSupplierNoPage?.find(item=>item.number == row.supplierCode)?.name
EquipmentAccounts.allSchemas.formSchema.forEach((item) => {
if (item.field == 'status') {
item.componentProps.disabled = false
}
})
}else{
EquipmentAccounts.allSchemas.formSchema.forEach((item) => {
if (item.field == 'status') {
item.componentProps.disabled = true
item.value = 'TOACCEPT'
}
})
}
basicFormRef.value.open(type, row)
}
@ -311,16 +294,16 @@ const openForm = async (type: string, row?: any) => {
// form
const formsSuccess = async (formType,data) => {
var isHave =EquipmentAccounts.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime'
})
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return
return;
}
}
if (data.activeTime == 0) data.activeTime = null
if (data.expireTime == 0) data.expireTime = null
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await EquipmentAccountsApi.createEquipmentAccounts(data)
message.success(t('common.createSuccess'))
@ -391,47 +374,58 @@ const searchFormClick = (searchData) => {
getList() //
}
//ablesForm
const getData=(val)=> {
nextTick?.(async () => {
await getList()
})
}
//ablesForm
const getClosed=(val)=> {
nextTick?.(() => {
console.log(val)
getList()
})
}
const searchTableRef = ref()
const searchSparePartTableRef = ref()
const searchTableSelections = ref([])
const searchTableSparePartSelections = ref([])
const syncData = async (row) => {
searchTableSparePartSelections.value = []
await RelationMainPartApi.getRelationMainPartNoPage({
equipmentCode: row.code,
type: 'DEVICE'
}).then(async (res) => {
await EquipmentMainPartApi.getEquipmentMainPartNoPage({ type: 'DEVICE' }).then((response) => {
searchTableSelections.value = response.filter((element) => {
let flag = false
res.forEach((item) => {
await RelationMainPartApi.getRelationMainPartNoPage({ equipmentCode: row.code,type: 'DEVICE' }).then(async (res) => {
await EquipmentMainPartApi.getEquipmentMainPartNoPage({type: 'DEVICE' }).then(response => {
searchTableSelections.value = response.filter(element => {
let flag = false;
res.forEach(item => {
if (element.code == item.mainPartCode) {
flag = true
}
})
return flag
})
})
})
}
flag = true;
}
});
return flag;
});
});
});
};
const syncSparePartData = async (row) => {
searchTableSparePartSelections.value = []
await EquipmentToolSparePartApi.getEquipmentToolSparePartNoPage({
equipmentToolCode: row.code
}).then(async (res) => {
await SparePartApi.getSparePartNoPage({}).then((response) => {
searchTableSparePartSelections.value = response.filter((element) => {
let flag = false
res.forEach((item) => {
await EquipmentToolSparePartApi.getEquipmentToolSparePartNoPage({ equipmentToolCode: row.code}).then(async (res) => {
await SparePartApi.getSparePartNoPage({}).then(response => {
searchTableSparePartSelections.value = response.filter(element => {
let flag = false;
res.forEach(item => {
if (element.code == item.sparePartCode) {
flag = true
}
})
return flag
})
})
})
}
flag = true;
}
});
return flag;
});
});
});
};
/** 绑定备件操作 */
const openComponent = async (row : any) => {
await syncData(row)
@ -456,10 +450,10 @@ const openSparePart = async (row: any) => {
await syncSparePartData(row)
searchSparePartTableRef.value.open(
'选择备件',
Item.allSchemas,
ItemApi.getItemPage,
'item',
Item.allSchemas.searchSchema,
SparePart.allSchemas,
SparePartApi.getSparePartPage,
'sparePartPart',
SparePart.allSchemas.searchSchema,
true,
null,//type
row,
@ -473,11 +467,11 @@ const openSparePart = async (row: any) => {
const submitEquipmentMainPartRelation = (formField, searchField, val, formRef, rowRef) => {
const deviceMainPartRelList = val.map((element) => ({
mainPartCode: element.number,
mainPartCode: element.code,
equipmentCode: rowRef.code,
type: 'DEVICE'
}))
RelationMainPartApi.createRelationMainPartBatch(deviceMainPartRelList).then((res) => {
RelationMainPartApi.createRelationMainPartBatch(deviceMainPartRelList).then(res => {
message.success(t('common.createSuccess'))
getList()
})
@ -494,8 +488,7 @@ const handleOperationTabsChange = (val) => {
}else if(val == 'maintenance'){
apiPage.value = EquipmentMaintenanceRecordMainApi.getEquipmentMaintenanceRecordMainPage
detailAllSchemas.value = EquipmentMaintenanceRecordMain.allSchemas
dialogApiPage.value =
EquipmentMaintenanceRecordDetailApi.getEquipmentMaintenanceRecordDetailPage
dialogApiPage.value = EquipmentMaintenanceRecordDetailApi.getEquipmentMaintenanceRecordDetailPage
dialogAllSchemas.value = EquipmentMaintenanceRecordDetail.allSchemas
}else if(val == 'inspection'){
apiPage.value = EquipmentInspectionRecordMainApi.getEquipmentInspectionRecordMainPage
@ -512,16 +505,14 @@ const handleOperationTabsChange = (val) => {
const submitSparePartRelation = (formField, searchField, val, formRef, rowRef) => {
const equipmentToolSparePartRelList = val.map((element) => ({
sparePartCode: element.number,
sparePartCode: element.code,
equipmentToolCode: rowRef.code,
type: 'DEVICE'
}))
EquipmentToolSparePartApi.createEquipmentToolSparePartBatch(equipmentToolSparePartRelList).then(
(res) => {
EquipmentToolSparePartApi.createEquipmentToolSparePartBatch(equipmentToolSparePartRelList).then(res => {
message.success(t('common.createSuccess'))
getList()
}
)
})
}
/** 初始化 **/
@ -529,4 +520,5 @@ onMounted(async () => {
getList()
importTemplateData.templateUrl = await EquipmentAccountsApi.importTemplate()
})
</script>

Loading…
Cancel
Save