Browse Source

工装代码

master_hella_20240701
ljlong_2630 5 months ago
parent
commit
3c1c84a3a7
  1. 21
      src/api/eam/toolAccounts/index.ts
  2. 64
      src/api/eam/toolEquipmentIn/index.ts
  3. 64
      src/api/eam/toolEquipmentOut/index.ts
  4. 5
      src/api/wms/process/index.ts
  5. 6
      src/api/wms/productionline/index.ts
  6. 6
      src/api/wms/workstation/index.ts
  7. 111
      src/components/Detail/src/DetailLedger.vue
  8. 5
      src/utils/dict.ts
  9. 248
      src/views/eam/equipmentAccounts/equipmentAccounts.data.ts
  10. 52
      src/views/eam/equipmentAccounts/index.vue
  11. 169
      src/views/eam/equipmentShutdown/equipmentShutdown.data.ts
  12. 125
      src/views/eam/equipmentSigning/equipmentSigning.data.ts
  13. 270
      src/views/eam/equipmentSigning/index.vue
  14. 349
      src/views/eam/equipmentTransferRecord/equipmentTransferRecord.data.ts
  15. 32
      src/views/eam/equipmentTransferRecord/index.vue
  16. 231
      src/views/eam/toolAccounts/index.vue
  17. 405
      src/views/eam/toolAccounts/toolAccounts.data.ts
  18. 290
      src/views/eam/toolEquipmentIn/index.vue
  19. 350
      src/views/eam/toolEquipmentIn/toolEquipmentIn.data.ts
  20. 253
      src/views/eam/toolEquipmentOut/index.vue
  21. 230
      src/views/eam/toolEquipmentOut/toolEquipmentOut.data.ts

21
src/api/eam/toolAccounts/index.ts

@ -42,38 +42,43 @@ export const getToolAccountsPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/tool-accounts/senior', data })
return await request.post({ url: '/eam/tool/tool-accounts/senior', data })
} else {
return await request.get({ url: `/eam/tool-accounts/page`, params })
return await request.get({ url: `/eam/tool/tool-accounts/page`, params })
}
}
// 查询工装台账详情
export const getToolAccounts = async (id: number) => {
return await request.get({ url: `/eam/tool-accounts/get?id=` + id })
return await request.get({ url: `/eam/tool/tool-accounts/get?id=` + id })
}
// 新增工装台账
export const createToolAccounts = async (data: ToolAccountsVO) => {
return await request.post({ url: `/eam/tool-accounts/create`, data })
return await request.post({ url: `/eam/tool/tool-accounts/create`, data })
}
// 修改工装台账
export const updateToolAccounts = async (data: ToolAccountsVO) => {
return await request.put({ url: `/eam/tool-accounts/update`, data })
return await request.put({ url: `/eam/tool/tool-accounts/update`, data })
}
// 删除工装台账
export const deleteToolAccounts = async (id: number) => {
return await request.delete({ url: `/eam/tool-accounts/delete?id=` + id })
return await request.delete({ url: `/eam/tool/tool-accounts/delete?id=` + id })
}
// 导出工装台账 Excel
export const exportToolAccounts = async (params) => {
return await request.download({ url: `/eam/tool-accounts/export-excel`, params })
return await request.download({ url: `/eam/tool/tool-accounts/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/tool-accounts/get-import-template' })
return request.download({ url: '/eam/tool/tool-accounts/get-import-template' })
}
// 查询工装台账列表
export const getToolAccountsNoPage = async (params) => {
return await request.get({ url: `/eam/tool/tool-accounts/noPage`, params })
}

64
src/api/eam/toolEquipmentIn/index.ts

@ -0,0 +1,64 @@
import request from '@/config/axios'
export interface ToolEquipmentInVO {
id: number
describing: string
toolCode: string
status: string
approver: number
approveContent: string
approveTime: Date
factoryAreaCode: string
workshopCode: string
lineCode: string
processCode: string
workstationCode: string
departmentCode: string
remark: string
siteId: string
available: string
deletionTime: Date
deleterId: byte[]
concurrencyStamp: number
}
// 查询工装入库记录列表
export const getToolEquipmentInPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/tool/tool-equipment-in/senior', data })
} else {
return await request.get({ url: `/eam/tool/tool-equipment-in/page`, params })
}
}
// 查询工装入库记录详情
export const getToolEquipmentIn = async (id: number) => {
return await request.get({ url: `/eam/tool/tool-equipment-in/get?id=` + id })
}
// 新增工装入库记录
export const createToolEquipmentIn = async (data: ToolEquipmentInVO) => {
return await request.post({ url: `/eam/tool/tool-equipment-in/create`, data })
}
// 修改工装入库记录
export const updateToolEquipmentIn = async (data: ToolEquipmentInVO) => {
return await request.put({ url: `/eam/tool/tool-equipment-in/update`, data })
}
// 删除工装入库记录
export const deleteToolEquipmentIn = async (id: number) => {
return await request.delete({ url: `/eam/tool/tool-equipment-in/delete?id=` + id })
}
// 导出工装入库记录 Excel
export const exportToolEquipmentIn = async (params) => {
return await request.download({ url: `/eam/tool/tool-equipment-in/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/tool/tool-equipment-in/get-import-template' })
}

64
src/api/eam/toolEquipmentOut/index.ts

@ -0,0 +1,64 @@
import request from '@/config/axios'
export interface ToolEquipmentOutVO {
id: number
theme: string
toolCode: string
type: string
qty: number
status: string
applyer: string
approver: number
approveContent: string
approveTime: Date
autoExamine: string
autoAgree: string
departmentCode: string
remark: string
siteId: string
available: string
deletionTime: Date
deleterId: byte[]
concurrencyStamp: number
}
// 查询工装出库记录列表
export const getToolEquipmentOutPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/tool/tool-equipment-out/senior', data })
} else {
return await request.get({ url: `/eam/tool/tool-equipment-out/page`, params })
}
}
// 查询工装出库记录详情
export const getToolEquipmentOut = async (id: number) => {
return await request.get({ url: `/eam/tool/tool-equipment-out/get?id=` + id })
}
// 新增工装出库记录
export const createToolEquipmentOut = async (data: ToolEquipmentOutVO) => {
return await request.post({ url: `/eam/tool/tool-equipment-out/create`, data })
}
// 修改工装出库记录
export const updateToolEquipmentOut = async (data: ToolEquipmentOutVO) => {
return await request.put({ url: `/eam/tool/tool-equipment-out/update`, data })
}
// 删除工装出库记录
export const deleteToolEquipmentOut = async (id: number) => {
return await request.delete({ url: `/eam/tool/tool-equipment-out/delete?id=` + id })
}
// 导出工装出库记录 Excel
export const exportToolEquipmentOut = async (params) => {
return await request.download({ url: `/eam/tool/tool-equipment-out/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/tool/tool-equipment-out/get-import-template' })
}

5
src/api/wms/process/index.ts

@ -58,3 +58,8 @@ export const exportProcess = async (params) => {
export const importTemplate = () => {
return request.download({ url: '/wms/process/get-import-template' })
}
// 查询工序列表
export const getProcessNoPage = async (params) => {
return await request.get({ url: `/wms/process/noPage`, params })
}

6
src/api/wms/productionline/index.ts

@ -59,3 +59,9 @@ export const exportProductionline = async (params) => {
export const importTemplate = () => {
return request.download({ url: '/wms/productionline/get-import-template' })
}
// 查询生产线列表
export const getProductionlineNoPage = async (params) => {
return await request.get({ url: `/wms/productionline/noPage`, params })
}

6
src/api/wms/workstation/index.ts

@ -71,3 +71,9 @@ export const selectAreaTypeToLocation = async (params) => {
return await request.get({ url: `/wms/workstation/pageAreaToLocation`, params })
}
}
// 查询工位列表
export const getWorkstationNoPage = async (params) => {
return await request.get({ url: `/wms/workstation/noPage`, params })
}

111
src/components/Detail/src/DetailLedger.vue

@ -91,28 +91,16 @@
</template>
</DetailTable>
</ContentWrap>
<ContentWrap class="w-[100%]" v-show="tabsList[current].label==annexAlias.label" :style="{height:remarkHeight+'px'}">
<el-tabs class="demo-tabs" v-model="fileParmas.fileBusiType" @tab-change="handleTabsChange">
<el-tab-pane
v-for="item in subTabsList"
:key="item.value"
:label="item.label"
:name="item.value"
/>
<!-- 附件组件 -->
<ElScrollbar ref="scrollbar" :style="{height:(remarkHeight-40)+'px'}">
<AnnexLedger
:annexData="annexData"
:showDownload = "annexAlias.showDownload"
:hiddenDelete = "annexAlias.hiddenDelete"
@handleAnnexSuccess="handleAnnexSuccess"
@deleteAnnexSuccess="deleteAnnexSuccess"
:upData="remarksData.data"
:key="count"
@saveEdit="saveEdit"
/>
</ElScrollbar>
</el-tabs>
<ContentWrap class="w-[100%]" v-show="tabsList[current].label=='动态信息'" :style="{height:remarkHeight+'px'}">
<el-descriptions title="" :column="2">
<el-descriptions-item
v-for="(value, key) in dynamicInfo"
:key="key"
:label="key"
:span="1">
<el-tag>{{ value }}</el-tag>
</el-descriptions-item>
</el-descriptions>
</ContentWrap>
<ContentWrap class="w-[100%]" v-show="tabsList[current].label=='操作记录'" :style="{height:remarkHeight+'px'}">
<el-tabs class="demo-tabs" v-model="operationRecordType" @tab-change="handleOperationTabsChange">
@ -447,6 +435,11 @@ const props = defineProps({
required: false,
default: null
},
dynamicInfoFields: {
type: Object,
required: false,
default: null
}
//
})
const isShowDrawer = ref(false)
@ -457,6 +450,8 @@ const fileParmas = ref({
funcCode: props.funcCode,
fileBusiType: ''
})
const dynamicInfo = ref()
const dynamicInfoName = ref("")
const operationRecordType = ref()
const operationRecordList = ref(props.operationRecordList)
if (props.isBasic == true) {
@ -480,14 +475,15 @@ if (props.isBasic == true) {
const otherList = [...props.annexTable,
{
label: '动态信息',
prop: 'DynamicInfo'
},{
label: '拓展属性',
prop: 'ExpandProps'
},
{
},{
label: '操作记录',
prop: 'OperationRecord'
},
{
},{
label:props.annexAlias.label,
prop:'Annex'
},{
@ -521,6 +517,8 @@ const initialData = ref([])
const codeLabelPrefix = ref('属性编号')
const valueLabelPrefix = ref('属性值')
const expandPropsFormRef = ref();
const operate = ref(false)
const operationTabParam = ref({})
//
const remarkHeight = computed(() => {
const tab = unref(tabRef)
@ -646,9 +644,13 @@ const change = (item, index) => {
getExtendedPropsList()
}else if(item.prop == 'OperationRecord'){
if(props.operationRecordList){
operate.value = true
operationRecordType.value = props.operationRecordList[0]?.value
}
}
if(item.prop != 'OperationRecord'){
operate.value = false
}
}
//
@ -693,6 +695,9 @@ const titleValueRef = ref()
const count =ref(0)
const deviceNumber = ref('')
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => {
//
getDynamicInfo(row)
titleNameRef.value = titleName
titleValueRef.value = titleValue
deviceNumber.value = row.number?row.number:row.code
@ -771,6 +776,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
detailLoading.value = false
}
}
}
defineExpose({ openDetail, formRef }) // open
@ -1125,6 +1131,28 @@ const getExtendedPropsList = async () => {
}
const handleOperationTabsChange = async (val) => {
if(val == 'report'){
operationTabParam.value = {
'equipmentCode' : deviceNumber.value,
}
}else if(val == 'repair'){
operationTabParam.value = {
'equipmentCode' : deviceNumber.value,
}
}else if(val == 'maintenance'){
operationTabParam.value = {
'equipmentCode' : deviceNumber.value,
}
}else if(val == 'inspection'){
operationTabParam.value = {
'equipmentCode' : deviceNumber.value,
}
}else if(val == 'spot_check'){
operationTabParam.value = {
'equipmentCode' : deviceNumber.value,
}
}
tableObjectRef.value.loading = false
emit("handleOperationTabsChange",val)
}
@ -1140,7 +1168,6 @@ const dialogUploadNumber = ref()
const dialogUploadBusiCode = ref()
const dialogFormKey = ref(0)
const openDialog = async(row: any, titleName: any, titleValue: any) => {
debugger
const { tableObject, tableMethods } = useTable({
getListApi: props.dialogApiPage, //
defaultParams: getDialogParams(row)
@ -1172,7 +1199,8 @@ watch(
() => props.apiPage,
() => {
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
getListApi: props.apiPage, //
defaultParams: getSubTabParams()
})
tableObject.params.masterId = masterParmas.value.masterId
detailAllSchemasRef.value = props.detailAllSchemas
@ -1187,6 +1215,32 @@ watch(
getList()
}
)
const getSubTabParams = () => {
if(operate.value){
return operationTabParam.value
}
}
const getDynamicInfo = (row) => {
dynamicInfoName.value = row.name?row.name:""
// 使 reduce
dynamicInfo.value = Object.keys(row).reduce((acc, key) => {
let name = "";
let value = row[key];
if (props.dynamicInfoFields?.includes(key)) {
props.allSchemas?.tableColumns?.find((item) => {
if (item.field == key) {
name = item.label;
}
});
}
if (name) {
acc[name] = value!=undefined&&value!=null&&value!=""?value:'undefined'; // 使 item.label row[key]
}
return acc;
}, {});
}
</script>
<style lang="scss">
@ -1197,5 +1251,6 @@ watch(
::v-deep(.label-class-name) {
color: #dedede;
}
</style>
<style scoped lang="scss"></style>

5
src/utils/dict.ts

@ -354,5 +354,8 @@ export enum DICT_TYPE {
REPAIR_LEVEL = 'repair_level', //维修级别
IS_COMPLETED = 'is_completed', //是否完成
MAINTENANCE_CYCLE ='maintenance_cycle', // 保养周期
EAM_ORDER_STATUS = 'eam_order_status'
EAM_ORDER_STATUS = 'eam_order_status',// 工单状态
TOOL_CLASS = 'tool_class', //工装类型
TOOL_OUT_TYPE = 'tool_out_type', //工装出库类型
}

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

@ -9,10 +9,19 @@ import * as EquipmentSupplierApi from '@/api/eam/equipmentSupplier'
import { EquipmentManufacturer } from '@/views/eam/equipmentManufacturer/equipmentManufacturer.data'
import * as EquipmentManufacturerApi from '@/api/eam/equipmentManufacturer'
import * as ConfigApi from '@/api/infra/config'
import * as ProductionlineApi from '@/api/wms/productionline'
import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data'
import * as ProcessApi from '@/api/wms/process'
import { Process } from '@/views/wms/basicDataManage/factoryModeling/process/process.data'
import * as WorkStationApi from '@/api/wms/workstation'
import { Workstation } from '@/views/wms/basicDataManage/factoryModeling/workstation/workstation.data'
const workshopNoPage = await WorkshopApi.getWorkshopNoPage({})
const equipmentManufacturerNoPage = await EquipmentManufacturerApi.getEquipmentManufacturerNoPage({})
const equipmentSupplierNoPage = await EquipmentSupplierApi.getEquipmentSupplierNoPage({})
const productionlineNoPage = await ProductionlineApi.getProductionlineNoPage({});
const autoCodeSwitch = await ConfigApi.getConfigKey('deviceCodeAutoSwitch')
// ProductionlineApi.getProductionlinePage
const autoSwitch = ref(false)
if (autoCodeSwitch == 'TRUE') {
autoSwitch.value = true
@ -29,6 +38,7 @@ export const EquipmentAccountsRules = reactive({
power: [
{ validator:validateNum, message: '输入功率格式不正确', trigger: 'blur'}
],
workshopName: [required]
})
export const EquipmentAccounts = useCrudSchemas(reactive<CrudSchema[]>([
@ -164,7 +174,7 @@ export const EquipmentAccounts = useCrudSchemas(reactive<CrudSchema[]>([
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return equipmentSupplierNoPage.find((item) => item.number == cellValue)?.name
},
},
@ -173,6 +183,7 @@ export const EquipmentAccounts = useCrudSchemas(reactive<CrudSchema[]>([
field: 'supplierName',
sort: 'custom',
isSearch: false,
isTable: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
@ -265,7 +276,7 @@ export const EquipmentAccounts = useCrudSchemas(reactive<CrudSchema[]>([
}
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return equipmentManufacturerNoPage.find((item) => item.number == cellValue)?.name
},
},
@ -274,6 +285,7 @@ export const EquipmentAccounts = useCrudSchemas(reactive<CrudSchema[]>([
field: 'manufactureName',
sort: 'custom',
isSearch: false,
isTable: false,
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
@ -371,17 +383,243 @@ export const EquipmentAccounts = useCrudSchemas(reactive<CrudSchema[]>([
},
},
{
label: '工段编号',
field: 'workshopSectionCode',
label: '产线编号',
field: 'lineCode',
sort: 'custom',
isSearch: false
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: productionlineNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'code'
},
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return productionlineNoPage.find((item) => item.code == cellValue)?.name
},
},
{
label: '产线编号',
field: 'lineName',
sort: 'custom',
isSearch: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
multiple:true,
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '生产线信息', // 查询弹窗标题
searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
searchCondition: [{
key:'workshopCode',
value:'workshopCode',
message: '请填写车间代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
// {
// label: '工序编号',
// field: 'processCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true,
// searchListPlaceholder: '请选择工序代码',
// searchField: 'code',
// searchTitle: '工序信息',
// searchAllSchemas: Process.allSchemas,
// searchPage: ProcessApi.getProcessPage,
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key: 'available',
// value: 'TRUE',
// isMainValue: false
// }]
// }
// },
// },
// {
// label: '工位编号',
// field: 'workstationCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// searchListPlaceholder: '请选择工位', // 输入框占位文本
// searchField: 'code', // 查询弹窗赋值字段
// searchTitle: '工位信息', // 查询弹窗标题
// searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类
// searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key:'available',
// value:'TRUE',
// isMainValue: false
// }]
// }
// },
// },
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true
},
{
label: '平均故障间隔时间',
field: 'purchaseInterval',
sort: 'custom',
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: false,
},
{
label: '总运行时长',
field: 'totalRunningTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: 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: '保养运行时长',
field: 'maintenanceRunningTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: 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: '使用次数',
field: 'usageTimes',
sort: 'custom',
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: false,
},
{
label: '上一次检验日期',
field: 'lastInspectionDate',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: 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: '设备停机率',
field: 'outageRate',
sort: 'custom',
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: false,
},
{
label: '平均故障恢复时间',
field: 'breakdownRecover',
sort: 'custom',
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: false,
},
{
label: '操作',
field: 'action',

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

@ -62,14 +62,15 @@
:apiPage="apiPage"
:dialogApiPage="dialogApiPage"
:dialogAllSchemas="dialogAllSchemas"
funcCode="device_mould_picture"
:dynamicInfoFields="dynamicInfoFields"
funcCode="device_mould_file"
/>
<!-- 主要部件 -->
<SearchTable ref="searchTableRef" @searchTableSuccess="submitEquipmentMainPartRelation" />
<!-- 备件 -->
<SearchTable ref="searchSparePartTableRef" @searchTableSuccess="submitSparePartRelation" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/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">
@ -106,6 +107,10 @@ import { EquipmentMaintenanceRecordMain,EquipmentMaintenanceRecordMainRules } fr
import * as EquipmentMaintenanceRecordMainApi from '@/api/eam/equipmentMaintenanceRecordMain'
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' })
@ -129,6 +134,19 @@ const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
if(formField == 'workshopName'){
setV['workshopCode'] = val[0]['code']
setV['workshopName'] = val[0]['name']
}else if(formField == 'lineName'){
setV['lineCode'] = val[0]['code']
setV['lineName'] = val[0]['name']
}else if(formField == 'manufactureName'){
setV['manufactureCode'] = val[0]['number']
setV['manufactureName'] = val[0]['name']
}else if(formField == 'supplierName'){
setV['supplierCode'] = val[0]['number']
setV['supplierName'] = val[0]['name']
}
formRef.setValues(setV)
})
}
@ -142,6 +160,17 @@ const operationRecordList = ref([
])
const dynamicInfoFields = ref([
"totalRunningTime",
"maintenanceRunningTime",
"usageTimes",
"lastInspectionDate",
"outageRate",
"breakdownRecover",
"purchaseInterval"
]);
//
const updataTableColumns = (val) => {
tableColumns.value = val
@ -211,7 +240,17 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
const openForm = async (type: string, row?: any) => {
if(type == 'update'){
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
}
basicFormRef.value.open(type, row)
}
@ -242,7 +281,6 @@ const formsSuccess = async (formType,data) => {
/** 详情操作 */
const detailRef = ref()
const openDetail = async (row: any, titleName: any, titleValue: any) => {
// subTabList.value = await
detailRef.value.openDetail(row, titleName, titleValue, 'basicEquipmentAccounts')
}
@ -306,8 +344,8 @@ const searchTableSelections = ref([])
const searchTableSparePartSelections = ref([])
const syncData = async (row) => {
searchTableSparePartSelections.value = []
await RelationMainPartApi.getRelationMainPartNoPage({ equipmentCode: row.code }).then(async (res) => {
await EquipmentMainPartApi.getEquipmentMainPartNoPage({}).then(response => {
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 => {
@ -348,7 +386,7 @@ const openComponent = async (row : any) => {
true,
null,//type
row,
null,
{type: 'DEVICE'},
null,
null,
null,

169
src/views/eam/equipmentShutdown/equipmentShutdown.data.ts

@ -1,6 +1,24 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as UserApi from '@/api/system/user'
import { EquipmentAccounts,EquipmentAccountsRules } from '../equipmentAccounts/equipmentAccounts.data'
import * as EquipmentAccountsApi from '@/api/eam/equipmentAccounts'
import * as ProductionlineApi from '@/api/wms/productionline'
import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data'
import * as WorkshopApi from '@/api/wms/workshop'
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data'
import * as ProcessApi from '@/api/wms/process'
import { Process } from '@/views/wms/basicDataManage/factoryModeling/process/process.data'
import * as WorkStationApi from '@/api/wms/workstation'
import { Workstation } from '@/views/wms/basicDataManage/factoryModeling/workstation/workstation.data'
export interface User {
id: number,
nickname: string
}
const userList = ref<User[]>([])
userList.value = await UserApi.getSimpleUserList()
// 表单校验
export const EquipmentShutdownRules = reactive({
equipmentCode: [required],
@ -13,7 +31,23 @@ export const EquipmentShutdown = useCrudSchemas(reactive<CrudSchema[]>([
label: '设备编码',
field: 'equipmentCode',
sort: 'custom',
isSearch: true
isSearch: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择设备', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '设备信息', // 查询弹窗标题
searchAllSchemas: EquipmentAccounts.allSchemas, // 查询弹窗所需类
searchPage: EquipmentAccountsApi.getEquipmentAccountsPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '操作日期',
@ -41,7 +75,21 @@ export const EquipmentShutdown = useCrudSchemas(reactive<CrudSchema[]>([
label: '操作人',
field: 'operationer',
sort: 'custom',
isSearch: true
isSearch: true,
form: {
component: 'Select',
componentProps: { // 假设deptList是部门数据列表
options: userList.value,
optionsAlias: {
valueField: 'id',
labelField: 'nickname'
},
disabled: false,
placeholder: "请选择操作人",
filterable: true,
multiple: false,
}
}
},
// {
// label: '所属厂区编号',
@ -53,14 +101,114 @@ export const EquipmentShutdown = useCrudSchemas(reactive<CrudSchema[]>([
label: '车间编号',
field: 'workshopCode',
sort: 'custom',
isSearch: true
isSearch: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择车间代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '车间信息', // 查询弹窗标题
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '工段编号',
field: 'workshopSectionCode',
label: '产线编号',
field: 'lineCode',
sort: 'custom',
isSearch: false
isSearch: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
multiple:true,
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '生产线信息', // 查询弹窗标题
searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
searchCondition: [{
key:'workshopCode',
value:'workshopCode',
message: '请填写车间代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
// {
// label: '工序编号',
// field: 'processCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true,
// searchListPlaceholder: '请选择工序代码',
// searchField: 'code',
// searchTitle: '工序信息',
// searchAllSchemas: Process.allSchemas,
// searchPage: ProcessApi.getProcessPage,
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key: 'available',
// value: 'TRUE',
// isMainValue: false
// }]
// }
// },
// },
// {
// label: '工位编号',
// field: 'workstationCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// searchListPlaceholder: '请选择工位', // 输入框占位文本
// searchField: 'code', // 查询弹窗赋值字段
// searchTitle: '工位信息', // 查询弹窗标题
// searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类
// searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key:'available',
// value:'TRUE',
// isMainValue: false
// }]
// }
// },
// },
{
label: '是否停机',
field: 'status',
@ -76,7 +224,14 @@ export const EquipmentShutdown = useCrudSchemas(reactive<CrudSchema[]>([
label: '设备停机原因',
field: 'shutdownCause',
sort: 'custom',
isSearch: false
isSearch: false,
form: {
component: 'Input',
componentProps: {
type: 'textarea'
}
}
},
{
label: '备注',

125
src/views/eam/equipmentSigning/equipmentSigning.data.ts

@ -1,21 +1,28 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as WorkshopApi from '@/api/wms/workshop'
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data'
import { handleTreeToComponentOptions } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept'
import * as UserApi from '@/api/system/user'
import { EquipmentAccounts,EquipmentAccountsRules } from '../equipmentAccounts/equipmentAccounts.data'
import * as EquipmentAccountsApi from '@/api/eam/equipmentAccounts'
import * as ProductionlineApi from '@/api/wms/productionline'
import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data'
import * as WorkshopApi from '@/api/wms/workshop'
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data'
import * as ProcessApi from '@/api/wms/process'
import { Process } from '@/views/wms/basicDataManage/factoryModeling/process/process.data'
import * as WorkStationApi from '@/api/wms/workstation'
import { Workstation } from '@/views/wms/basicDataManage/factoryModeling/workstation/workstation.data'
export interface User {
id: number,
nickname: string
}
const allDeptList = await DeptApi.getSimpleDeptList()
const deptList = ref<Tree[]>([]) // 树形结构
const workshopNoPage = await WorkshopApi.getWorkshopNoPage({})
const userList = ref<User[]>([])
userList.value = await UserApi.getSimpleUserList()
// 加载部门树(默认格式)
deptList.value = handleTreeToComponentOptions(await DeptApi.getSimpleDeptList())
@ -28,7 +35,8 @@ export const EquipmentSigningRules = reactive({
supplierCode: [required],
status: [required],
storageLocation: [required],
concurrencyStamp: [required]
concurrencyStamp: [required],
workshopCode: [required]
})
export const EquipmentSigning = useCrudSchemas(reactive<CrudSchema[]>([
@ -81,10 +89,13 @@ export const EquipmentSigning = useCrudSchemas(reactive<CrudSchema[]>([
field: 'operationDept',
sort: 'custom',
isSearch: true,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return allDeptList.find((item) => item.id == cellValue)?.name
},
form: {
component: 'TreeSelect',
componentProps: { // 假设deptList是部门数据列表
data: deptList,
data: deptList.value,
disabled: false,
placeholder: "请选择部门",
filterable: true,
@ -97,10 +108,13 @@ export const EquipmentSigning = useCrudSchemas(reactive<CrudSchema[]>([
field: 'operationer',
sort: 'custom',
isSearch: true,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.value.find((item) => item.id == cellValue)?.nickname
},
form: {
component: 'Select',
componentProps: { // 假设deptList是部门数据列表
options: [],
options: userList.value,
optionsAlias: {
valueField: 'id',
labelField: 'nickname'
@ -288,27 +302,90 @@ export const EquipmentSigning = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
isSearch: true,
form: {
component: 'Select'
}
},
{
label: '工序编号',
field: 'processCode',
sort: 'custom',
isSearch: true,
form: {
component: 'Select'
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
multiple:true,
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '生产线信息', // 查询弹窗标题
searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
searchCondition: [{
key:'workshopCode',
value:'workshopCode',
message: '请填写车间代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
{
label: '工位编号',
field: 'workstationCode',
sort: 'custom',
isSearch: true,
form: {
component: 'Select'
}
},
// {
// label: '工序编号',
// field: 'processCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true,
// searchListPlaceholder: '请选择工序代码',
// searchField: 'code',
// searchTitle: '工序信息',
// searchAllSchemas: Process.allSchemas,
// searchPage: ProcessApi.getProcessPage,
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key: 'available',
// value: 'TRUE',
// isMainValue: false
// }]
// }
// },
// },
// {
// label: '工位编号',
// field: 'workstationCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// searchListPlaceholder: '请选择工位', // 输入框占位文本
// searchField: 'code', // 查询弹窗赋值字段
// searchTitle: '工位信息', // 查询弹窗标题
// searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类
// searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key:'available',
// value:'TRUE',
// isMainValue: false
// }]
// }
// },
// },
{
label: '备注',
field: 'remark',

270
src/views/eam/equipmentSigning/index.vue

@ -0,0 +1,270 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="EquipmentSigning.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="EquipmentSigning.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="EquipmentSigningRules"
:formAllSchemas="EquipmentSigning.allSchemas"
:apiUpdate="EquipmentSigningApi.updateEquipmentSigning"
:apiCreate="EquipmentSigningApi.createEquipmentSigning"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
@onChange="onChange"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="EquipmentSigning.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/equipment-signing/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { EquipmentSigning,EquipmentSigningRules } from './equipmentSigning.data'
import * as EquipmentSigningApi from '@/api/eam/equipmentSigning'
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 * as UserApi from '@/api/system/user'
defineOptions({ name: 'EquipmentSigning' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
export interface User {
id: number,
nickname: string
}
const userList = ref<User[]>([])
routeName.value = route.name
const tableColumns = ref(EquipmentSigning.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: EquipmentSigningApi.getEquipmentSigningPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:equipment-signing:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'eam:equipment-signing:import'}), //
// defaultButtons.defaultExportBtn({hasPermi:'eam:equipment-signing: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:'eam:equipment-signing:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipment-signing:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = async (type: string, row?: any) => {
userList.value = await UserApi.getSimpleUserList()
EquipmentSigning.allSchemas.formSchema.find(item => item.field == 'operationer').componentProps.options = userList.value
if(type == 'update'){
row.operationDept = Number(row.operationDept)
row.operationer = Number(row.operationer)
}
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =EquipmentSigning.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 EquipmentSigningApi.createEquipmentSigning(data)
message.success(t('common.createSuccess'))
} else {
await EquipmentSigningApi.updateEquipmentSigning(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, 'basicEquipmentSigning')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await EquipmentSigningApi.deleteEquipmentSigning(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 EquipmentSigningApi.exportEquipmentSigning(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 onChange = async (field, cur, formRef) => {
if(field == 'operationDept'){
userList.value = await UserApi.getUserListByDeptIds([cur])
EquipmentSigning.allSchemas.formSchema.find(item => item.field == 'operationer').componentProps.options = userList.value
let setV = {}
setV['operationer'] = ''
formRef.value.setValues(setV)
}
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await EquipmentSigningApi.importTemplate()
})
</script>

349
src/views/eam/equipmentTransferRecord/equipmentTransferRecord.data.ts

@ -1,6 +1,24 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as UserApi from '@/api/system/user'
import { EquipmentAccounts,EquipmentAccountsRules } from '../equipmentAccounts/equipmentAccounts.data'
import * as EquipmentAccountsApi from '@/api/eam/equipmentAccounts'
import * as ProductionlineApi from '@/api/wms/productionline'
import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data'
import * as WorkshopApi from '@/api/wms/workshop'
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data'
import * as ProcessApi from '@/api/wms/process'
import { Process } from '@/views/wms/basicDataManage/factoryModeling/process/process.data'
import * as WorkStationApi from '@/api/wms/workstation'
import { Workstation } from '@/views/wms/basicDataManage/factoryModeling/workstation/workstation.data'
export interface User {
id: number,
nickname: string
}
const userList = ref<User[]>([])
userList.value = await UserApi.getSimpleUserList()
// 表单校验
export const EquipmentTransferRecordRules = reactive({
equipmentCode: [required],
@ -12,48 +30,51 @@ export const EquipmentTransferRecord = useCrudSchemas(reactive<CrudSchema[]>([
label: '设备编码',
field: 'equipmentCode',
sort: 'custom',
isSearch: true
},
{
label: '设备类型枚举',
field: 'type',
sort: 'custom',
dictType: DICT_TYPE.DEVICE_TYPE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: false,
isSearch: true,
form: {
component: 'Select'
}
colProps: {
span: 24
},
{
label: '操作日期',
field: 'operationDate',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
search: {
component: 'DatePicker',
// labelMessage: '信息提示说明!!!',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择设备', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '设备信息', // 查询弹窗标题
searchAllSchemas: EquipmentAccounts.allSchemas, // 查询弹窗所需类
searchPage: EquipmentAccountsApi.getEquipmentAccountsPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
}
},
{
label: '操作人',
field: 'operationer',
sort: 'custom',
isSearch: false
},
// {
// label: '操作人',
// field: 'operationer',
// sort: 'custom',
// isSearch: true,
// formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
// return userList.value.find((item) => item.id == cellValue)?.nickname
// },
// form: {
// component: 'Select',
// componentProps: { // 假设deptList是部门数据列表
// options: userList.value,
// optionsAlias: {
// valueField: 'id',
// labelField: 'nickname'
// },
// disabled: false,
// placeholder: "请选择操作人",
// filterable: true,
// multiple: false,
// }
// }
// },
// {
// label: '原所属厂区编号',
// field: 'beforeFactoryAreaCode',
// sort: 'custom',
@ -66,42 +87,260 @@ export const EquipmentTransferRecord = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true
},
{
label: '原车间编号',
field: 'beforeWorkshopCode',
label: '新地点',
field: 'nowLocation',
sort: 'custom',
isSearch: true
},
{
label: '原工段编号',
field: 'beforeWorkshopSectionCode',
label: '原车间编号',
field: 'beforeWorkshopCode',
sort: 'custom',
isSearch: false
isSearch: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择车间代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '车间信息', // 查询弹窗标题
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '现地点',
field: 'nowLocation',
label: '新车间编号',
field: 'workshopCode',
sort: 'custom',
isSearch: true
isSearch: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择车间代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '车间信息', // 查询弹窗标题
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
// {
// label: '所属厂区编号',
// field: 'factoryAreaCode',
// sort: 'custom',
// isSearch: true
// },
{
label: '车间编号',
field: 'workshopCode',
label: '原产线编号',
field: 'beforeLineCode',
sort: 'custom',
isSearch: true
isSearch: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
multiple:true,
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '生产线信息', // 查询弹窗标题
searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
searchCondition: [{
key:'workshopCode',
value:'beforeWorkshopCode',
message: '请填写车间代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
{
label: '工段编号',
field: 'workshopSectionCode',
label: '新产线编号',
field: 'lineCode',
sort: 'custom',
isSearch: false
isSearch: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
multiple:true,
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '生产线信息', // 查询弹窗标题
searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
searchCondition: [{
key:'workshopCode',
value:'workshopCode',
message: '请填写车间代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
// {
// label: '操作日期',
// field: 'operationDate',
// sort: 'custom',
// formatter: dateFormatter,
// isSearch: 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: '原工序编号',
// field: 'beforeProcessCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true,
// searchListPlaceholder: '请选择工序代码',
// searchField: 'code',
// searchTitle: '工序信息',
// searchAllSchemas: Process.allSchemas,
// searchPage: ProcessApi.getProcessPage,
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key: 'available',
// value: 'TRUE',
// isMainValue: false
// }]
// }
// },
// },
// {
// label: '新工序编号',
// field: 'processCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true,
// searchListPlaceholder: '请选择工序代码',
// searchField: 'code',
// searchTitle: '工序信息',
// searchAllSchemas: Process.allSchemas,
// searchPage: ProcessApi.getProcessPage,
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key: 'available',
// value: 'TRUE',
// isMainValue: false
// }]
// }
// },
// },
// {
// label: '原工位编号',
// field: 'beforeWorkstationCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// searchListPlaceholder: '请选择工位', // 输入框占位文本
// searchField: 'code', // 查询弹窗赋值字段
// searchTitle: '工位信息', // 查询弹窗标题
// searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类
// searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key:'available',
// value:'TRUE',
// isMainValue: false
// }]
// }
// },
// },
// {
// label: '新工位编号',
// field: 'workstationCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// searchListPlaceholder: '请选择工位', // 输入框占位文本
// searchField: 'code', // 查询弹窗赋值字段
// searchTitle: '工位信息', // 查询弹窗标题
// searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类
// searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key:'available',
// value:'TRUE',
// isMainValue: false
// }]
// }
// },
// },
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',

32
src/views/eam/equipmentTransferRecord/index.vue

@ -48,6 +48,7 @@
:apiCreate="EquipmentTransferRecordApi.createEquipmentTransferRecord"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
@onEnter="onEnter"
/>
<!-- 详情 -->
@ -59,19 +60,25 @@
<script setup lang="ts">
import download from '@/utils/download'
import { EquipmentSigning,EquipmentSigningRules } from '../equipmentSigning/equipmentSigning.data'
import { EquipmentTransferRecord,EquipmentTransferRecordRules } from './equipmentTransferRecord.data'
import * as EquipmentTransferRecordApi from '@/api/eam/equipmentTransferRecord'
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 * as UserApi from '@/api/system/user'
defineOptions({ name: 'EquipmentTransferRecord' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
export interface User {
id: number,
nickname: string
}
const userList = ref<User[]>([])
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(EquipmentTransferRecord.allSchemas.tableColumns)
@ -81,6 +88,14 @@ const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
if(formField == 'equipmentCode'){
debugger
setV['beforeStorageLocation'] = val[0]['storageLocation']
setV['beforeWorkshopCode'] = val[0]['workshopCode']
setV['beforeLineCode'] = val[0]['lineCode']
setV['beforeProcessCode'] = val[0]['processCode']
setV['beforeWorkstationCode'] = val[0]['workstationCode']
}
formRef.setValues(setV)
})
}
@ -100,8 +115,8 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:equipment-transfer-record:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:equipment-transfer-record:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:equipment-transfer-record:export'}), //
// defaultButtons.defaultImportBtn({hasPermi:'eam:equipment-transfer-record:import'}), //
// defaultButtons.defaultExportBtn({hasPermi:'eam:equipment-transfer-record:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
@ -148,7 +163,12 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
const openForm = async (type: string, row?: any) => {
userList.value = await UserApi.getSimpleUserList()
EquipmentSigning.allSchemas.formSchema.find(item => item.field == 'operationer').componentProps.options = userList.value
if(type == 'update'){
row.operationer = Number(row.operationer)
}
basicFormRef.value.open(type, row)
}
@ -235,6 +255,10 @@ const searchFormClick = (searchData) => {
getList() //
}
const onEnter = (a,b,c,d) =>{
debugger
}
/** 初始化 **/
onMounted(async () => {
getList()

231
src/views/eam/toolAccounts/index.vue

@ -51,10 +51,27 @@
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="ToolAccounts.allSchemas" />
<DetailLedger
ref="detailRef"
:isBasic="true"
:allSchemas="ToolAccounts.allSchemas"
:subTabs="subTabList"
:operationRecordList="operationRecordList"
@handleOperationTabsChange="handleOperationTabsChange"
:detailAllSchemas="detailAllSchemas"
:apiPage="apiPage"
:dialogApiPage="dialogApiPage"
:dialogAllSchemas="dialogAllSchemas"
:dynamicInfoFields="dynamicInfoFields"
funcCode="tool_mould_file"
/>
<!-- 主要部件 -->
<SearchTable ref="searchTableRef" @searchTableSuccess="submitEquipmentMainPartRelation" />
<!-- 备件 -->
<SearchTable ref="searchSparePartTableRef" @searchTableSuccess="submitSparePartRelation" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/tool-accounts/import" :importTemplateData="importTemplateData" @success="importSuccess" />
<ImportForm ref="importFormRef" url="/eam/tool/tool-accounts/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
@ -65,6 +82,34 @@ 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 * as RelationMainPartApi from '@/api/eam/relationMainPart'
import { EquipmentMainPart,EquipmentMainPartRules } from '../equipmentMainPart/equipmentMainPart.data'
import * as EquipmentMainPartApi from '@/api/eam/equipmentMainPart'
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 * as EquipmentReportRepairRequestApi from '@/api/eam/equipmentReportRepairRequest'
import { EquipmentSpotCheckRecordMain,EquipmentSpotCheckRecordMainRules } from '../equipmentSpotCheckRecordMain/equipmentSpotCheckRecordMain.data'
import * as EquipmentSpotCheckRecordMainApi from '@/api/eam/equipmentSpotCheckRecordMain'
import { EquipmentSpotCheckRecordDetail,EquipmentSpotCheckRecordDetailRules } from '../equipmentSpotCheckRecordDetail/equipmentSpotCheckRecordDetail.data'
import * as EquipmentSpotCheckRecordDetailApi from '@/api/eam/equipmentSpotCheckRecordDetail'
import { EquipmentInspectionRecordMain,EquipmentInspectionRecordMainRules } from '../equipmentInspectionRecordMain/equipmentInspectionRecordMain.data'
import * as EquipmentInspectionRecordMainApi from '@/api/eam/equipmentInspectionRecordMain'
import { EquipmentInspectionRecordDetail,EquipmentInspectionRecordDetailRules } from '../equipmentInspectionRecordDetail/equipmentInspectionRecordDetail.data'
import * as EquipmentInspectionRecordDetailApi from '@/api/eam/equipmentInspectionRecordDetail'
import { EquipmentRepairRecordMain,EquipmentRepairRecordMainRules } from '../equipmentRepairRecordMain/equipmentRepairRecordMain.data'
import * as EquipmentRepairRecordMainApi from '@/api/eam/equipmentRepairRecordMain'
import { EquipmentRepairRecordDetail,EquipmentRepairRecordDetailRules } from '../equipmentRepairRecordDetail/equipmentRepairRecordDetail.data'
import * as EquipmentRepairRecordDetailApi from '@/api/eam/equipmentRepairRecordDetail'
import { EquipmentMaintenanceRecordMain,EquipmentMaintenanceRecordMainRules } from '../equipmentMaintenanceRecordMain/equipmentMaintenanceRecordMain.data'
import * as EquipmentMaintenanceRecordMainApi from '@/api/eam/equipmentMaintenanceRecordMain'
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: 'ToolAccounts' })
@ -75,12 +120,38 @@ const route = useRoute() // 路由信息
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(ToolAccounts.allSchemas.tableColumns)
const tabs = ref<{ label: string; prop: string; }[]>([])
const subTabList = ref([]);
const detailAllSchemas = ref()
const apiPage = ref()
const dialogApiPage = ref()
const dialogAllSchemas = ref()
const operationRecordList = ref([
{label:'报修记录',value:'report'},
{label:'维修记录',value:'repair'},
{label:'保养记录',value:'maintenance'},
{label:'巡检记录',value:'inspection'},
{label:'点检记录',value:'spot_check'},
])
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
if(formField == 'workshopName'){
setV['workshopCode'] = val[0]['code']
setV['workshopName'] = val[0]['name']
}else if(formField == 'lineName'){
setV['lineCode'] = val[0]['code']
setV['lineName'] = val[0]['name']
}else if(formField == 'manufactureName'){
setV['manufactureCode'] = val[0]['number']
setV['manufactureName'] = val[0]['name']
}else if(formField == 'supplierName'){
setV['supplierCode'] = val[0]['number']
setV['supplierName'] = val[0]['name']
}
formRef.setValues(setV)
})
}
@ -134,7 +205,9 @@ const buttonBaseClick = (val, item) => {
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:tool-accounts:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:tool-accounts:delete'}), //
defaultButtons.componentBtn({hasPermi:'eam:tool-accounts:component'}), //
defaultButtons.sparePartBtn({hasPermi:'eam:tool-accounts:item'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:tool-accounts:delete'}), //
]
// -
@ -143,12 +216,26 @@ const buttonTableClick = async (val, row) => {
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'component') { //
openComponent(row)
} else if (val == 'sparePart') { //
openSparePart(row)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
const openForm = async (type: string, row?: any) => {
if(type == 'update'){
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
}
basicFormRef.value.open(type, row)
}
@ -178,6 +265,16 @@ const formsSuccess = async (formType,data) => {
/** 详情操作 */
const detailRef = ref()
const dynamicInfoFields = ref([
"totalRunningTime",
"maintenanceRunningTime",
"usageTimes",
"lastInspectionDate",
"outageRate",
"breakdownRecover",
"purchaseInterval"
]);
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicToolAccounts')
}
@ -235,6 +332,132 @@ const searchFormClick = (searchData) => {
getList() //
}
const handleOperationTabsChange = (val) => {
if(val == 'report'){
apiPage.value = EquipmentReportRepairRequestApi.getEquipmentReportRepairRequestPage
detailAllSchemas.value = EquipmentReportRepairRequest.allSchemas
}else if(val == 'repair'){
apiPage.value = EquipmentRepairRecordMainApi.getEquipmentRepairRecordMainPage
detailAllSchemas.value = EquipmentRepairRecordMain.allSchemas
dialogApiPage.value = EquipmentRepairRecordDetailApi.getEquipmentRepairRecordDetailPage
dialogAllSchemas.value = EquipmentRepairRecordDetail.allSchemas
}else if(val == 'maintenance'){
apiPage.value = EquipmentMaintenanceRecordMainApi.getEquipmentMaintenanceRecordMainPage
detailAllSchemas.value = EquipmentMaintenanceRecordMain.allSchemas
dialogApiPage.value = EquipmentMaintenanceRecordDetailApi.getEquipmentMaintenanceRecordDetailPage
dialogAllSchemas.value = EquipmentMaintenanceRecordDetail.allSchemas
}else if(val == 'inspection'){
apiPage.value = EquipmentInspectionRecordMainApi.getEquipmentInspectionRecordMainPage
detailAllSchemas.value = EquipmentInspectionRecordMain.allSchemas
dialogApiPage.value = EquipmentInspectionRecordDetailApi.getEquipmentInspectionRecordDetailPage
dialogAllSchemas.value = EquipmentInspectionRecordDetail.allSchemas
}else if(val == 'spot_check'){
apiPage.value = EquipmentSpotCheckRecordMainApi.getEquipmentSpotCheckRecordMainPage
detailAllSchemas.value = EquipmentSpotCheckRecordMain.allSchemas
dialogApiPage.value = EquipmentSpotCheckRecordDetailApi.getEquipmentSpotCheckRecordDetailPage
dialogAllSchemas.value = EquipmentSpotCheckRecordDetail.allSchemas
}
}
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: 'EQUIPMENT' }).then(async (res) => {
await EquipmentMainPartApi.getEquipmentMainPartNoPage({type: 'EQUIPMENT'}).then(response => {
searchTableSelections.value = response.filter(element => {
let flag = false;
res.forEach(item => {
if (element.code == item.mainPartCode) {
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 => {
if (element.code == item.sparePartCode) {
flag = true;
}
});
return flag;
});
});
});
};
/** 绑定备件操作 */
const openComponent = async (row : any) => {
await syncData(row)
searchTableRef.value.open(
'选择部件',
EquipmentMainPart.allSchemas,
EquipmentMainPartApi.getEquipmentMainPartPage,
'equipmentMainPart',
EquipmentMainPart.allSchemas.searchSchema,
true,
null,//type
row,
{type: 'EQUIPMENT'},
null,
null,
null,
searchTableSelections.value
)
}
const openSparePart = async (row : any) => {
await syncSparePartData(row)
searchSparePartTableRef.value.open(
'选择备件',
SparePart.allSchemas,
SparePartApi.getSparePartPage,
'sparePartPart',
SparePart.allSchemas.searchSchema,
true,
null,//type
row,
null,
null,
null,
null,
searchTableSparePartSelections.value
)
}
const submitEquipmentMainPartRelation = (formField, searchField, val, formRef, rowRef) => {
const deviceMainPartRelList = val.map((element) => ({
mainPartCode: element.code,
equipmentCode: rowRef.code,
type: 'EQUIPMENT'
}))
RelationMainPartApi.createRelationMainPartBatch(deviceMainPartRelList).then(res => {
message.success(t('common.createSuccess'))
getList()
})
}
const submitSparePartRelation = (formField, searchField, val, formRef, rowRef) => {
const equipmentToolSparePartRelList = val.map((element) => ({
sparePartCode: element.code,
equipmentToolCode: rowRef.code,
type: 'EQUIPMENT'
}))
EquipmentToolSparePartApi.createEquipmentToolSparePartBatch(equipmentToolSparePartRelList).then(res => {
message.success(t('common.createSuccess'))
getList()
})
}
/** 初始化 **/
onMounted(async () => {
getList()

405
src/views/eam/toolAccounts/toolAccounts.data.ts

@ -1,6 +1,27 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as ConfigApi from '@/api/infra/config'
import * as WorkshopApi from '@/api/wms/workshop'
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data'
import * as EquipmentSupplierApi from '@/api/eam/equipmentSupplier'
import { EquipmentSupplier } from '@/views/eam/equipmentSupplier/equipmentSupplier.data'
import * as EquipmentManufacturerApi from '@/api/eam/equipmentManufacturer'
import { EquipmentManufacturer } from '@/views/eam/equipmentManufacturer/equipmentManufacturer.data'
import * as ProductionlineApi from '@/api/wms/productionline'
import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data'
const workshopNoPage = await WorkshopApi.getWorkshopNoPage({})
const equipmentManufacturerNoPage = await EquipmentManufacturerApi.getEquipmentManufacturerNoPage({})
const equipmentSupplierNoPage = await EquipmentSupplierApi.getEquipmentSupplierNoPage({})
const productionlineNoPage = await ProductionlineApi.getProductionlineNoPage({});
const autoCodeSwitch = await ConfigApi.getConfigKey('deviceCodeAutoSwitch')
// ProductionlineApi.getProductionlinePage
const autoSwitch = ref(false)
if (autoCodeSwitch == 'TRUE') {
autoSwitch.value = true
}
// 表单校验
export const ToolAccountsRules = reactive({
code: [required],
@ -14,7 +35,8 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
field: 'code',
sort: 'custom',
isSearch: true,
isForm: false,
isForm: !autoSwitch.value,
fixed: 'left'
},
{
label: '名称',
@ -33,6 +55,8 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
field: 'type',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.TOOL_CLASS,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'Select'
}
@ -54,12 +78,14 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
field: 'isCustomerAptitude',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.INFRA_BOOLEAN_STRING,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'Switch'
component: 'Radio'
}
},
{
label: '客户id',
label: '客户',
field: 'customerId',
sort: 'custom',
isSearch: false
@ -94,7 +120,7 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
isSearch: false,
form: {
component: 'Switch'
component: 'Select'
}
},
{
@ -120,10 +146,51 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: '供应商编号',
label: '供应商',
field: 'supplierCode',
sort: 'custom',
isSearch: false
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: equipmentSupplierNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return equipmentSupplierNoPage.find((item) => item.number == cellValue)?.name
},
},
{
label: '供应商',
field: 'supplierName',
sort: 'custom',
isSearch: false,
isTable: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择供应商', // 输入框占位文本
searchField: 'number', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: EquipmentSupplier.allSchemas, // 查询弹窗所需类
searchPage: EquipmentSupplierApi.getEquipmentSupplierPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '采购时间',
@ -182,10 +249,49 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: '生产厂商编码',
label: '生产厂商',
field: 'manufactureCode',
sort: 'custom',
isSearch: false
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: equipmentManufacturerNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'number'
}
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return equipmentManufacturerNoPage.find((item) => item.number == cellValue)?.name
},
},
{
label: '生产厂商',
field: 'manufactureName',
sort: 'custom',
isSearch: false,
isTable: false,
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择厂商', // 输入框占位文本
searchField: 'number', // 查询弹窗赋值字段
searchTitle: '生产厂商', // 查询弹窗标题
searchAllSchemas: EquipmentManufacturer.allSchemas, // 查询弹窗所需类
searchPage: EquipmentManufacturerApi.getEquipmentManufacturerPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '设备使用寿命',
@ -221,24 +327,173 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
isSearch: false
},
// {
// label: '所属厂区编号',
// field: 'factoryAreaCode',
// sort: 'custom',
// isSearch: true
// },
{
label: '所属厂区编号',
field: 'factoryAreaCode',
label: '车间编号',
field: 'workshopCode',
sort: 'custom',
isSearch: true
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: workshopNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'code'
},
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return workshopNoPage.find((item) => item.code == cellValue)?.name
},
},
{
label: '车间编号',
field: 'workshopCode',
field: 'workshopName',
sort: 'custom',
isSearch: true
isTable: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择车间代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '车间信息', // 查询弹窗标题
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
disable:true,
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '工段编号',
field: 'workshopSectionCode',
label: '产线编号',
field: 'lineCode',
sort: 'custom',
isSearch: true
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: productionlineNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'code'
},
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return productionlineNoPage.find((item) => item.code == cellValue)?.name
},
},
{
label: '产线编号',
field: 'lineName',
sort: 'custom',
isSearch: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
multiple:true,
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '生产线信息', // 查询弹窗标题
searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
searchCondition: [{
key:'workshopCode',
value:'workshopCode',
message: '请填写车间代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
// {
// label: '工序编号',
// field: 'processCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true,
// searchListPlaceholder: '请选择工序代码',
// searchField: 'code',
// searchTitle: '工序信息',
// searchAllSchemas: Process.allSchemas,
// searchPage: ProcessApi.getProcessPage,
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key: 'available',
// value: 'TRUE',
// isMainValue: false
// }]
// }
// },
// },
// {
// label: '工位编号',
// field: 'workstationCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// searchListPlaceholder: '请选择工位', // 输入框占位文本
// searchField: 'code', // 查询弹窗赋值字段
// searchTitle: '工位信息', // 查询弹窗标题
// searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类
// searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key:'available',
// value:'TRUE',
// isMainValue: false
// }]
// }
// },
// },
{
label: '部门',
field: 'departmentCode',
@ -267,6 +522,124 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
// }
// }
// },
{
label: '平均故障间隔时间',
field: 'purchaseInterval',
sort: 'custom',
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: false,
},
{
label: '总运行时长',
field: 'totalRunningTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: 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: '保养运行时长',
field: 'maintenanceRunningTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: 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: '使用次数',
field: 'usageTimes',
sort: 'custom',
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: false,
},
{
label: '上一次检验日期',
field: 'lastInspectionDate',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: 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: '设备停机率',
field: 'outageRate',
sort: 'custom',
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: false,
},
{
label: '平均故障恢复时间',
field: 'breakdownRecover',
sort: 'custom',
isSearch: false,
isDetail: false,
isTable: true,
isForm: false,
isTableForm: false,
},
{
label: '操作',
field: 'action',

290
src/views/eam/toolEquipmentIn/index.vue

@ -0,0 +1,290 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ToolEquipmentIn.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ToolEquipmentIn.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="ToolEquipmentInRules"
:formAllSchemas="ToolEquipmentIn.allSchemas"
:apiUpdate="ToolEquipmentInApi.updateToolEquipmentIn"
:apiCreate="ToolEquipmentInApi.createToolEquipmentIn"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="ToolEquipmentIn.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/tool/tool-equipment-in/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { ToolEquipmentIn,ToolEquipmentInRules } from './toolEquipmentIn.data'
import * as ToolEquipmentInApi from '@/api/eam/toolEquipmentIn'
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 * as RelationMainPartApi from '@/api/eam/relationMainPart'
import * as EquipmentMainPartApi from '@/api/eam/equipmentMainPart'
import * as SparePartApi from '@/api/eam/sparePart'
import * as EquipmentToolSparePartApi from '@/api/eam/equipmentToolSparePart'
import * as EquipmentReportRepairRequestApi from '@/api/eam/equipmentReportRepairRequest'
import * as EquipmentSpotCheckRecordMainApi from '@/api/eam/equipmentSpotCheckRecordMain'
import * as EquipmentSpotCheckRecordDetailApi from '@/api/eam/equipmentSpotCheckRecordDetail'
import * as EquipmentInspectionRecordMainApi from '@/api/eam/equipmentInspectionRecordMain'
import * as EquipmentInspectionRecordDetailApi from '@/api/eam/equipmentInspectionRecordDetail'
import * as EquipmentRepairRecordMainApi from '@/api/eam/equipmentRepairRecordMain'
import * as EquipmentRepairRecordDetailApi from '@/api/eam/equipmentRepairRecordDetail'
import * as EquipmentMaintenanceRecordMainApi from '@/api/eam/equipmentMaintenanceRecordMain'
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'
import * as ToolAccountsApi from '@/api/eam/toolAccounts'
defineOptions({ name: 'ToolEquipmentIn' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(ToolEquipmentIn.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
if(formField == 'workshopName'){
setV['workshopCode'] = val[0]['code']
setV['workshopName'] = val[0]['name']
}else if(formField == 'lineName'){
setV['lineCode'] = val[0]['code']
setV['lineName'] = val[0]['name']
}else if(formField == 'manufactureName'){
setV['manufactureCode'] = val[0]['number']
setV['manufactureName'] = val[0]['name']
}else if(formField == 'supplierName'){
setV['supplierCode'] = val[0]['number']
setV['supplierName'] = val[0]['name']
}else if(formField == 'toolName'){
setV['toolCode'] = val[0]['code']
setV['toolName'] = val[0]['name']
}
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: ToolEquipmentInApi.getToolEquipmentInPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:tool-equipment-in:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:tool-equipment-in:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:tool-equipment-in: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:'eam:tool-equipment-in:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:tool-equipment-in:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = async (type: string, row?: any) => {
if(type == 'update'){
const equipmentManufacturerNoPage = await EquipmentManufacturerApi.getEquipmentManufacturerNoPage({})
const equipmentSupplierNoPage = await EquipmentSupplierApi.getEquipmentSupplierNoPage({})
const workshopNoPage = await WorkshopApi.getWorkshopNoPage({})
const productionlineNoPage = await ProductionlineApi.getProductionlineNoPage({});
const toolAccountsListNoPage = await ToolAccountsApi.getToolAccountsNoPage({});
row.toolName = toolAccountsListNoPage?.find(item=>item.code == row.workshopCode)?.name
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
}
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =ToolEquipmentIn.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 ToolEquipmentInApi.createToolEquipmentIn(data)
message.success(t('common.createSuccess'))
} else {
await ToolEquipmentInApi.updateToolEquipmentIn(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, 'basicToolEquipmentIn')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ToolEquipmentInApi.deleteToolEquipmentIn(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 ToolEquipmentInApi.exportToolEquipmentIn(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 ToolEquipmentInApi.importTemplate()
})
</script>

350
src/views/eam/toolEquipmentIn/toolEquipmentIn.data.ts

@ -0,0 +1,350 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as WorkshopApi from '@/api/wms/workshop'
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data'
import * as ProductionlineApi from '@/api/wms/productionline'
import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data'
import { ToolAccounts} from '../toolAccounts/toolAccounts.data'
import * as ToolAccountsApi from '@/api/eam/toolAccounts'
const workshopNoPage = await WorkshopApi.getWorkshopNoPage({})
const productionlineNoPage = await ProductionlineApi.getProductionlineNoPage({});
const toolAccountsListNoPage = await ToolAccountsApi.getToolAccountsNoPage({});
// 表单校验
export const ToolEquipmentInRules = reactive({
toolCode: [required],
status: [required]
})
export const ToolEquipmentIn = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '工装',
field: 'toolCode',
sort: 'custom',
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: toolAccountsListNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'code'
},
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return toolAccountsListNoPage.find((item) => item.code == cellValue)?.name
},
},
{
label: '工装',
field: 'toolName',
sort: 'custom',
isSearch: false,
isDetail: false,
isForm: true,
isTable: false,
isTableForm: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择工装', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '工装信息', // 查询弹窗标题
searchAllSchemas: ToolAccounts.allSchemas, // 查询弹窗所需类
searchPage: ToolAccountsApi.getToolAccountsPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '入库信息描述',
field: 'describing',
sort: 'custom',
isSearch: true,
form: {
component: 'Input',
componentProps: {
type: 'textarea',
}
}
},
{
label: '入库审核状态',
field: 'status',
sort: 'custom',
dictType: DICT_TYPE.JOB_STATUS,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'Select'
}
},
{
label: '审核人',
field: 'approver',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '审核内容',
field: 'approveContent',
sort: 'custom',
isSearch: false,
form: {
component: 'Input',
componentProps: {
type: 'textarea',
}
}
},
{
label: '审核时间',
field: 'approveTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: 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: '所属厂区编号',
// field: 'factoryAreaCode',
// sort: 'custom',
// isSearch: true
// },
{
label: '车间编号',
field: 'workshopCode',
sort: 'custom',
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: workshopNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'code'
},
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return workshopNoPage.find((item) => item.code == cellValue)?.name
},
},
{
label: '车间编号',
field: 'workshopName',
sort: 'custom',
isSearch: false,
isDetail: false,
isForm: true,
isTable: false,
isTableForm: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择车间代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '车间信息', // 查询弹窗标题
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
disable:true,
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '产线编号',
field: 'lineCode',
sort: 'custom',
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: productionlineNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'code'
},
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return productionlineNoPage.find((item) => item.code == cellValue)?.name
},
},
{
label: '产线编号',
field: 'lineName',
sort: 'custom',
isSearch: false,
isDetail: false,
isForm: true,
isTable: false,
isTableForm: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
multiple:true,
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '生产线信息', // 查询弹窗标题
searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
searchCondition: [{
key:'workshopCode',
value:'workshopCode',
message: '请填写车间代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
// {
// label: '工序编号',
// field: 'processCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true,
// searchListPlaceholder: '请选择工序代码',
// searchField: 'code',
// searchTitle: '工序信息',
// searchAllSchemas: Process.allSchemas,
// searchPage: ProcessApi.getProcessPage,
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key: 'available',
// value: 'TRUE',
// isMainValue: false
// }]
// }
// },
// },
// {
// label: '工位编号',
// field: 'workstationCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// searchListPlaceholder: '请选择工位', // 输入框占位文本
// searchField: 'code', // 查询弹窗赋值字段
// searchTitle: '工位信息', // 查询弹窗标题
// searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类
// searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key:'available',
// value:'TRUE',
// isMainValue: false
// }]
// }
// },
// },
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false,
form: {
component: 'Input',
componentProps: {
type: 'textarea',
}
}
},
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
// isSearch: false,
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// }
// },
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

253
src/views/eam/toolEquipmentOut/index.vue

@ -0,0 +1,253 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ToolEquipmentOut.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ToolEquipmentOut.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="ToolEquipmentOutRules"
:formAllSchemas="ToolEquipmentOut.allSchemas"
:apiUpdate="ToolEquipmentOutApi.updateToolEquipmentOut"
:apiCreate="ToolEquipmentOutApi.createToolEquipmentOut"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="ToolEquipmentOut.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/tool/tool-equipment-out/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { ToolEquipmentOut,ToolEquipmentOutRules } from './toolEquipmentOut.data'
import * as ToolEquipmentOutApi from '@/api/eam/toolEquipmentOut'
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 * as ToolAccountsApi from '@/api/eam/toolAccounts'
defineOptions({ name: 'ToolEquipmentOut' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(ToolEquipmentOut.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
if(formField == 'toolName'){
setV['toolCode'] = val[0]['code']
setV['toolName'] = val[0]['name']
}
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: ToolEquipmentOutApi.getToolEquipmentOutPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:tool-equipment-out:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:tool-equipment-out:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:tool-equipment-out: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:'eam:tool-equipment-out:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:tool-equipment-out:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = async (type: string, row?: any) => {
if(type == 'update'){
const toolAccountsListNoPage = await ToolAccountsApi.getToolAccountsNoPage({});
row.toolName = toolAccountsListNoPage?.find(item=>item.code == row.toolCode)?.name
}
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =ToolEquipmentOut.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 ToolEquipmentOutApi.createToolEquipmentOut(data)
message.success(t('common.createSuccess'))
} else {
await ToolEquipmentOutApi.updateToolEquipmentOut(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, 'basicToolEquipmentOut')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ToolEquipmentOutApi.deleteToolEquipmentOut(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 ToolEquipmentOutApi.exportToolEquipmentOut(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 ToolEquipmentOutApi.importTemplate()
})
</script>

230
src/views/eam/toolEquipmentOut/toolEquipmentOut.data.ts

@ -0,0 +1,230 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { ToolAccounts} from '../toolAccounts/toolAccounts.data'
import * as ToolAccountsApi from '@/api/eam/toolAccounts'
import * as UserApi from '@/api/system/user'
const toolAccountsListNoPage = await ToolAccountsApi.getToolAccountsNoPage({});
const userListNoPage = await UserApi.getSimpleUserList();
// 表单校验
export const ToolEquipmentOutRules = reactive({
theme: [required],
toolCode: [required],
type: [required],
qty: [required],
status: [required],
applyer: [required],
concurrencyStamp: [required]
})
export const ToolEquipmentOut = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '工装',
field: 'toolCode',
sort: 'custom',
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: toolAccountsListNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'code'
},
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return toolAccountsListNoPage.find((item) => item.code == cellValue)?.name
},
},
{
label: '工装',
field: 'toolName',
sort: 'custom',
isSearch: false,
isDetail: false,
isForm: true,
isTable: false,
isTableForm: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择工装', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '工装信息', // 查询弹窗标题
searchAllSchemas: ToolAccounts.allSchemas, // 查询弹窗所需类
searchPage: ToolAccountsApi.getToolAccountsPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '出库主题',
field: 'theme',
sort: 'custom',
isSearch: true
},
{
label: '出库类型',
field: 'type',
sort: 'custom',
dictType: DICT_TYPE.TOOL_OUT_TYPE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'Select'
}
},
{
label: '数量',
field: 'qty',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '流程状态',
field: 'status',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.JOB_STATUS,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'Select',
}
},
{
label: '出库申请人',
field: 'applyer',
sort: 'custom',
isSearch: true,
form: {
component: 'Select',
componentProps: {
options: userListNoPage,
optionsAlias: {
labelField: 'nickname',
valueField: 'id'
}
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userListNoPage.find((item) => item.id == cellValue)?.nickname
},
},
{
label: '审核人',
field: 'approver',
sort: 'custom',
isSearch: true,
form: {
component: 'Select',
componentProps: {
options: userListNoPage,
optionsAlias: {
labelField: 'nickname',
valueField: 'id'
}
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userListNoPage.find((item) => item.id == cellValue)?.nickname
},
},
{
label: '审核内容',
field: 'approveContent',
sort: 'custom',
isSearch: false,
form: {
component: 'Input',
componentProps: {
type: 'textarea',
}
}
},
{
label: '审核时间',
field: 'approveTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: 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: '自动审核',
field: 'autoExamine',
sort: 'custom',
isForm: false,
},
{
label: '自动通过',
field: 'autoAgree',
sort: 'custom',
isForm: false,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false,
form: {
component: 'Input',
componentProps: {
type: 'textarea',
}
}
},
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
// isSearch: false,
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// }
// },
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
Loading…
Cancel
Save