陈薪名
4 months ago
76 changed files with 6166 additions and 2070 deletions
@ -0,0 +1,67 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface RepairSparePartsRecordVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
sparePartsCode: string |
||||
|
qty: number |
||||
|
areaCode: string |
||||
|
locationCode: string |
||||
|
status: string |
||||
|
result: string |
||||
|
applyer: string |
||||
|
approver: number |
||||
|
approveContent: string |
||||
|
approveTime: Date |
||||
|
autoExamine: string |
||||
|
autoAgree: string |
||||
|
directCreateRecord: string |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询备件维修申请列表
|
||||
|
export const getRepairSparePartsRecordPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/repair-spare-parts-record/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/repair-spare-parts-record/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询备件维修申请详情
|
||||
|
export const getRepairSparePartsRecord = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/repair-spare-parts-record/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增备件维修申请
|
||||
|
export const createRepairSparePartsRecord = async (data: RepairSparePartsRecordVO) => { |
||||
|
return await request.post({ url: `/eam/repair-spare-parts-record/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改备件维修申请
|
||||
|
export const updateRepairSparePartsRecord = async (data: RepairSparePartsRecordVO) => { |
||||
|
return await request.put({ url: `/eam/repair-spare-parts-record/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除备件维修申请
|
||||
|
export const deleteRepairSparePartsRecord = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/repair-spare-parts-record/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出备件维修申请 Excel
|
||||
|
export const exportRepairSparePartsRecord = async (params) => { |
||||
|
return await request.download({ url: `/eam/repair-spare-parts-record/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/repair-spare-parts-record/get-import-template' }) |
||||
|
} |
@ -0,0 +1,68 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface RepairSparePartsRequestVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
sparePartsCode: string |
||||
|
qty: number |
||||
|
areaCode: string |
||||
|
locationCode: string |
||||
|
status: string |
||||
|
result: string |
||||
|
applyer: string |
||||
|
approver: number |
||||
|
approveContent: string |
||||
|
approveTime: Date |
||||
|
autoExamine: string |
||||
|
autoAgree: string |
||||
|
directCreateRecord: string |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
repairCause: string |
||||
|
} |
||||
|
|
||||
|
// 查询备件维修申请列表
|
||||
|
export const getRepairSparePartsRequestPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/repair-spare-parts-request/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/repair-spare-parts-request/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询备件维修申请详情
|
||||
|
export const getRepairSparePartsRequest = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/repair-spare-parts-request/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增备件维修申请
|
||||
|
export const createRepairSparePartsRequest = async (data: RepairSparePartsRequestVO) => { |
||||
|
return await request.post({ url: `/eam/repair-spare-parts-request/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改备件维修申请
|
||||
|
export const updateRepairSparePartsRequest = async (data: RepairSparePartsRequestVO) => { |
||||
|
return await request.put({ url: `/eam/repair-spare-parts-request/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除备件维修申请
|
||||
|
export const deleteRepairSparePartsRequest = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/repair-spare-parts-request/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出备件维修申请 Excel
|
||||
|
export const exportRepairSparePartsRequest = async (params) => { |
||||
|
return await request.download({ url: `/eam/repair-spare-parts-request/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/repair-spare-parts-request/get-import-template' }) |
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface ToolChangedRecordVO { |
||||
|
id: number |
||||
|
code: string |
||||
|
name: string |
||||
|
statusBefore: string |
||||
|
statusAfter: string |
||||
|
operator: number |
||||
|
operateTime: Date |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询设备变更记录列表
|
||||
|
export const getToolChangedRecordPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/tool-changed-record/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/tool-changed-record/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询设备变更记录详情
|
||||
|
export const getToolChangedRecord = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/tool-changed-record/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增设备变更记录
|
||||
|
export const createToolChangedRecord = async (data: ToolChangedRecordVO) => { |
||||
|
return await request.post({ url: `/eam/tool-changed-record/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改设备变更记录
|
||||
|
export const updateToolChangedRecord = async (data: ToolChangedRecordVO) => { |
||||
|
return await request.put({ url: `/eam/tool-changed-record/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除设备变更记录
|
||||
|
export const deleteToolChangedRecord = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/tool-changed-record/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出设备变更记录 Excel
|
||||
|
export const exportToolChangedRecord = async (params) => { |
||||
|
return await request.download({ url: `/eam/tool-changed-record/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/tool-changed-record/get-import-template' }) |
||||
|
} |
@ -0,0 +1,79 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface ToolSigningVO { |
||||
|
id: number |
||||
|
toolCode: string |
||||
|
operationDate: Date |
||||
|
operationer: string |
||||
|
operationDept: string |
||||
|
telephone: string |
||||
|
supplierCode: string |
||||
|
supplierPeople: string |
||||
|
supplierTelephone: string |
||||
|
status: string |
||||
|
approver: number |
||||
|
approveContent: string |
||||
|
approveTime: Date |
||||
|
autoExamine: string |
||||
|
autoAgree: string |
||||
|
directCreateRecord: string |
||||
|
storageLocation: string |
||||
|
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 getToolSigningPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/tool-signing/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/tool-signing/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询工装到货签收记录详情
|
||||
|
export const getToolSigning = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/tool-signing/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增工装到货签收记录
|
||||
|
export const createToolSigning = async (data: ToolSigningVO) => { |
||||
|
return await request.post({ url: `/eam/tool-signing/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 新增工装到货签收记录
|
||||
|
export const createToolSigningNew = async (data: ToolSigningVO) => { |
||||
|
return await request.post({ url: `/eam/tool-signing/createNew`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改工装到货签收记录
|
||||
|
export const updateToolSigning = async (data: ToolSigningVO) => { |
||||
|
return await request.put({ url: `/eam/tool-signing/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除工装到货签收记录
|
||||
|
export const deleteToolSigning = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/tool-signing/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出工装到货签收记录 Excel
|
||||
|
export const exportToolSigning = async (params) => { |
||||
|
return await request.download({ url: `/eam/tool-signing/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/tool-signing/get-import-template' }) |
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface ProductionitemcodeSpareitemcodeVO { |
||||
|
id: number |
||||
|
productionItemCode: string |
||||
|
spareItemCode: string |
||||
|
available: string |
||||
|
remark: string |
||||
|
} |
||||
|
|
||||
|
// 查询量产件备件关系列表
|
||||
|
export const getProductionitemcodeSpareitemcodePage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/productionitemcode-spareitemcode/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/productionitemcode-spareitemcode/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询量产件备件关系详情
|
||||
|
export const getProductionitemcodeSpareitemcode = async (id: number) => { |
||||
|
return await request.get({ url: `/wms/productionitemcode-spareitemcode/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增量产件备件关系
|
||||
|
export const createProductionitemcodeSpareitemcode = async (data: ProductionitemcodeSpareitemcodeVO) => { |
||||
|
return await request.post({ url: `/wms/productionitemcode-spareitemcode/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改量产件备件关系
|
||||
|
export const updateProductionitemcodeSpareitemcode = async (data: ProductionitemcodeSpareitemcodeVO) => { |
||||
|
return await request.put({ url: `/wms/productionitemcode-spareitemcode/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除量产件备件关系
|
||||
|
export const deleteProductionitemcodeSpareitemcode = async (id: number) => { |
||||
|
return await request.delete({ url: `/wms/productionitemcode-spareitemcode/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出量产件备件关系 Excel
|
||||
|
export const exportProductionitemcodeSpareitemcode = async (params) => { |
||||
|
return await request.download({ url: `/wms/productionitemcode-spareitemcode/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/wms/productionitemcode-spareitemcode/get-import-template' }) |
||||
|
} |
@ -0,0 +1,3 @@ |
|||||
|
import TableFormAdjustment from './src/TableFormAdjustment.vue' |
||||
|
|
||||
|
export { TableFormAdjustment } |
@ -0,0 +1,63 @@ |
|||||
|
<template> |
||||
|
<Dialog |
||||
|
title="询证函调节表" |
||||
|
:width="960" |
||||
|
v-model="dialogVisible" |
||||
|
:close-on-click-modal="false" |
||||
|
> |
||||
|
<TableFormAdjustment ref="tableFormAdjustment" :rowData="rowData" :isDetail="false" @updateList="updateList"/> |
||||
|
<template #footer> |
||||
|
<slot name="foorter"></slot> |
||||
|
<ButtonBase :Butttondata="[ |
||||
|
defaultButtons.formSaveBtn(null), // 保存 |
||||
|
defaultButtons.formCloseBtn(null) // 关闭 |
||||
|
]" @button-base-click="buttonBaseClick" /> |
||||
|
</template> |
||||
|
|
||||
|
</Dialog> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableFormAdjustment from './TableFormAdjustment.vue' |
||||
|
|
||||
|
|
||||
|
|
||||
|
const dialogVisible = ref(false) |
||||
|
const rowData = ref({}) |
||||
|
const open = (row)=>{ |
||||
|
dialogVisible.value = true |
||||
|
nextTick(()=>{ |
||||
|
rowData.value = row |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
const tableFormAdjustment = ref() |
||||
|
/** 按钮事件 */ |
||||
|
const buttonBaseClick = (val) => { |
||||
|
if (val == 'save') { |
||||
|
// 保存 |
||||
|
tableFormAdjustment.value.saveData() |
||||
|
} else if (val == 'close') { |
||||
|
// 关闭 |
||||
|
dialogVisible.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
const updateList = ()=>{ |
||||
|
dialogVisible.value = false |
||||
|
emit('updateList') |
||||
|
} |
||||
|
// 传递给父类 |
||||
|
const emit = defineEmits([ |
||||
|
'updateList', |
||||
|
]) |
||||
|
defineExpose({open}) |
||||
|
</script> |
||||
|
<style lang="scss" scoped> |
||||
|
.top{ |
||||
|
margin-bottom: 20px |
||||
|
} |
||||
|
|
||||
|
|
||||
|
</style> |
@ -0,0 +1,455 @@ |
|||||
|
<template> |
||||
|
<!-- <Dialog |
||||
|
title="询证函调节表" |
||||
|
:width="960" |
||||
|
v-model="dialogVisible" |
||||
|
:close-on-click-modal="false" |
||||
|
> --> |
||||
|
<div style="overflow-x: auto;"> |
||||
|
<!-- 顶部 --> |
||||
|
<div class="top" style="display: flex; flex-direction: row;"> |
||||
|
<div style="margin-right:5px"> |
||||
|
<el-table border class="top-table" :data="topTableData"> |
||||
|
<el-table-column |
||||
|
:label="headerItem.label" |
||||
|
:prop="headerItem.field" |
||||
|
:width="headerItem.width" |
||||
|
align="center" |
||||
|
v-for="headerItem in topHeader" |
||||
|
/> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
<div> |
||||
|
<el-table border class="top-table" :data="topTableData"> |
||||
|
<el-table-column |
||||
|
:label="headerItem.label" |
||||
|
:prop="headerItem.field" |
||||
|
:width="headerItem.width" |
||||
|
align="center" |
||||
|
v-for="headerItem in topHeader" |
||||
|
/> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 底部 --> |
||||
|
<div class="bottom" style="display: flex; flex-direction: row;"> |
||||
|
<!-- 下-左 --> |
||||
|
<div style="margin-right:5px"> |
||||
|
<el-button type="info" link>调整事项(减项以负数列示):</el-button> |
||||
|
<el-table border class="top-table" :data="[...bottomLeftTableData,...bottomLeftSumTableData]"> |
||||
|
<el-table-column |
||||
|
:label="headerItem.label" |
||||
|
:prop="headerItem.field" |
||||
|
:width="headerItem.width" |
||||
|
align="center" |
||||
|
v-for="headerItem in bottomLeftHeader" |
||||
|
> |
||||
|
<template #default="scope"> |
||||
|
<el-input :disabled="isDetail" v-if="!scope.row.isSum&&headerItem.type=='input'" v-model="scope.row[headerItem.field]" :placeholder="`请输入${headerItem.label}`"/> |
||||
|
<el-input-number :disabled="isDetail" v-else-if="!scope.row.disabled&&headerItem.type=='inputnumber'" v-model="scope.row[headerItem.field]" :placeholder="`请输入${headerItem.label}`"/> |
||||
|
|
||||
|
<span v-else>{{ scope.row[headerItem.field] }}</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
<el-form style="margin-top:20px;width:460px" :model="leftForm" :label-width="300" > |
||||
|
<el-form-item label="经办人"> |
||||
|
<el-input :disabled="isDetail" v-model="leftForm.name" placeholder="请输入经办人"/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对账日期"> |
||||
|
<el-date-picker :disabled="isDetail" value-format="YYYY-MM-DD HH:mm:ss" |
||||
|
v-model="leftForm.date" |
||||
|
type="datetime" |
||||
|
placeholder="请选择对账日期" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
</div> |
||||
|
<!-- 下-右 --> |
||||
|
<div> |
||||
|
<el-button type="info" link>调整事项(减项以负数列示):</el-button> |
||||
|
<el-table border class="top-table" :data="[...bottomRightTableData,...bottomRightSumTableData]"> |
||||
|
<el-table-column |
||||
|
:label="headerItem.label" |
||||
|
:prop="headerItem.field" |
||||
|
:width="headerItem.width" |
||||
|
align="center" |
||||
|
v-for="headerItem in bottomRightHeader" |
||||
|
> |
||||
|
<template #default="scope"> |
||||
|
<el-input :disabled="isDetail" v-if="!scope.row.isSum&&headerItem.type=='input'" v-model="scope.row[headerItem.field]" :placeholder="`请输入${headerItem.label}`"/> |
||||
|
<el-input-number :disabled="isDetail" v-else-if="!scope.row.disabled&&headerItem.type=='inputnumber'" v-model="scope.row[headerItem.field]" :placeholder="`请输入${headerItem.label}`"/> |
||||
|
|
||||
|
<span v-else>{{ scope.row[headerItem.field] }}</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
<el-form style="margin-top:20px;width:460px" :model="rightForm" :label-width="300" > |
||||
|
<el-form-item label="经办人"> |
||||
|
<el-input :disabled="isDetail" v-model="rightForm.name" placeholder="请输入经办人"/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对账日期"> |
||||
|
<el-date-picker :disabled="isDetail" value-format="YYYY-MM-DD HH:mm:ss" |
||||
|
v-model="rightForm.date" |
||||
|
type="datetime" |
||||
|
placeholder="请选择对账日期" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<!-- <template #footer> |
||||
|
<slot name="foorter"></slot> |
||||
|
<ButtonBase :Butttondata="[ |
||||
|
defaultButtons.formSaveBtn(null), // 保存 |
||||
|
defaultButtons.formCloseBtn(null) // 关闭 |
||||
|
]" @button-base-click="buttonBaseClick" /> |
||||
|
</template> |
||||
|
|
||||
|
</Dialog> --> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import * as SupplierApbalanceMainApi from '@/api/wms/supplierApbalanceMain' |
||||
|
import dayjs from 'dayjs' |
||||
|
|
||||
|
// import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
rowData: { |
||||
|
type: Object, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
adjustmentData: { |
||||
|
type: Object, |
||||
|
required: true, |
||||
|
default: null |
||||
|
}, |
||||
|
isDetail: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
} |
||||
|
}) |
||||
|
onMounted(()=>{ |
||||
|
console.log('rowData',props.rowData) |
||||
|
nextTick(()=>{ |
||||
|
setTopHeaderData() |
||||
|
}) |
||||
|
|
||||
|
}) |
||||
|
watch( |
||||
|
() => props.rowData, |
||||
|
() => { |
||||
|
console.log('rowData',props.rowData) |
||||
|
nextTick(()=>{ |
||||
|
setTopHeaderData() |
||||
|
}) |
||||
|
}, |
||||
|
{ |
||||
|
deep: true |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
// 顶部单位名称 |
||||
|
const topHeader = ref<any>([]) |
||||
|
const topTableData = ref<any>([]) |
||||
|
|
||||
|
const setTopHeaderData = ()=>{ |
||||
|
let myData = unref(props.rowData) |
||||
|
console.log('myData',myData) |
||||
|
topHeader.value = [{ |
||||
|
label:`单位名称:${myData?.ttSupplierName}`, |
||||
|
field:'name1', |
||||
|
width:260 |
||||
|
},{ |
||||
|
label:'金额', |
||||
|
field:'price1', |
||||
|
width:100 |
||||
|
},{ |
||||
|
label:'备注', |
||||
|
field:'remark1', |
||||
|
width:100 |
||||
|
}] |
||||
|
|
||||
|
let year = dayjs(myData?.ttGenerateTime).year() |
||||
|
let month = dayjs(myData?.ttGenerateTime).month()+1 |
||||
|
let day = new Date(year,month,0).getDate() |
||||
|
topTableData.value = [{ |
||||
|
name1:`截止${year}年${month}月${day}日账面金额如下`, |
||||
|
price1:Number(myData?.ttAccountAp)+Number(myData?.ttAccountOthap), |
||||
|
remark1:myData?.remark, |
||||
|
name2:'截止年月日账面金额如下', |
||||
|
price2:Number(myData?.ttAccountAp)+Number(myData?.ttAccountOthap), |
||||
|
remark2:myData?.remark, |
||||
|
}] |
||||
|
|
||||
|
if(props.isDetail){ |
||||
|
//详情数据 |
||||
|
setDetailData() |
||||
|
} |
||||
|
} |
||||
|
const setDetailData = ()=>{ |
||||
|
// 摘要表格数据 |
||||
|
let adjustmentData = unref(props.adjustmentData) |
||||
|
if(adjustmentData?.subList){ |
||||
|
bottomLeftTableData.value = adjustmentData?.subList?.map((item,index) => ({ |
||||
|
index:index+1, |
||||
|
ttAbstractLeft:item?.ttAbstractLeft, |
||||
|
ttBalanceLeft:item?.ttBalanceLeft, |
||||
|
remark:item?.remark |
||||
|
})); |
||||
|
bottomRightTableData.value = adjustmentData?.subList?.map((item,index) => ({ |
||||
|
index:index+1, |
||||
|
ttAbstractRight:item?.ttAbstractRight, |
||||
|
ttBalanceRight:item?.ttBalanceRight, |
||||
|
remark:item?.remark |
||||
|
})); |
||||
|
} |
||||
|
|
||||
|
// 经办人.对账日期 |
||||
|
leftForm.value = { |
||||
|
name:adjustmentData?.ttOperatorLeft, |
||||
|
date:adjustmentData?.ttDzDateLeft |
||||
|
} |
||||
|
rightForm.value = { |
||||
|
name:adjustmentData?.ttOperatorRight, |
||||
|
date:adjustmentData?.ttDzDateRight |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//摘要表格左侧 |
||||
|
const bottomLeftHeader = ref([{ |
||||
|
label:'序号', |
||||
|
field:'index', |
||||
|
width:80 |
||||
|
},{ |
||||
|
label:'摘要', |
||||
|
field:'ttAbstractLeft', |
||||
|
width:180, |
||||
|
type:'input' |
||||
|
},{ |
||||
|
label:'金额', |
||||
|
field:'ttBalanceLeft', |
||||
|
width:200, |
||||
|
type:'inputnumber' |
||||
|
}]) |
||||
|
const bottomRightHeader = ref([{ |
||||
|
label:'序号', |
||||
|
field:'index', |
||||
|
width:80 |
||||
|
},{ |
||||
|
label:'摘要', |
||||
|
field:'ttAbstractRight', |
||||
|
width:180, |
||||
|
type:'input' |
||||
|
},{ |
||||
|
label:'金额', |
||||
|
field:'ttBalanceRight', |
||||
|
width:200, |
||||
|
type:'inputnumber' |
||||
|
}]) |
||||
|
|
||||
|
const bottomLeftTableData = ref([{ |
||||
|
index:'1', |
||||
|
ttAbstractLeft:'', |
||||
|
ttBalanceLeft:'', |
||||
|
remark:'' |
||||
|
},{ |
||||
|
index:'2', |
||||
|
ttAbstractLeft:'', |
||||
|
ttBalanceLeft:'', |
||||
|
remark:'' |
||||
|
},{ |
||||
|
index:'3', |
||||
|
ttAbstractLeft:'', |
||||
|
ttBalanceLeft:'', |
||||
|
remark:'' |
||||
|
},{ |
||||
|
index:'4', |
||||
|
ttAbstractLeft:'', |
||||
|
ttBalanceLeft:'', |
||||
|
remark:'' |
||||
|
},{ |
||||
|
index:'5', |
||||
|
ttAbstractLeft:'', |
||||
|
ttBalanceLeft:'', |
||||
|
remark:'' |
||||
|
},{ |
||||
|
index:'6', |
||||
|
ttAbstractLeft:'', |
||||
|
ttBalanceLeft:'', |
||||
|
remark:'' |
||||
|
},{ |
||||
|
index:'7', |
||||
|
ttAbstractLeft:'', |
||||
|
ttBalanceLeft:'', |
||||
|
remark:'' |
||||
|
},{ |
||||
|
index:'8', |
||||
|
ttAbstractLeft:'', |
||||
|
ttBalanceLeft:'', |
||||
|
remark:'' |
||||
|
}]) |
||||
|
|
||||
|
const bottomRightTableData = ref([{ |
||||
|
index:'1', |
||||
|
ttAbstractRight:'', |
||||
|
ttBalanceRight:'', |
||||
|
remark:'' |
||||
|
},{ |
||||
|
index:'2', |
||||
|
ttAbstractRight:'', |
||||
|
ttBalanceRight:'', |
||||
|
remark:'' |
||||
|
},{ |
||||
|
index:'3', |
||||
|
ttAbstractRight:'', |
||||
|
ttBalanceRight:'', |
||||
|
remark:'' |
||||
|
},{ |
||||
|
index:'4', |
||||
|
ttAbstractRight:'', |
||||
|
ttBalanceRight:'', |
||||
|
remark:'' |
||||
|
},{ |
||||
|
index:'5', |
||||
|
ttAbstractRight:'', |
||||
|
ttBalanceRight:'', |
||||
|
remark:'' |
||||
|
},{ |
||||
|
index:'6', |
||||
|
ttAbstractRight:'', |
||||
|
ttBalanceRight:'', |
||||
|
remark:'' |
||||
|
},{ |
||||
|
index:'7', |
||||
|
ttAbstractRight:'', |
||||
|
ttBalanceRight:'', |
||||
|
remark:'' |
||||
|
},{ |
||||
|
index:'8', |
||||
|
ttAbstractRight:'', |
||||
|
ttBalanceRight:'', |
||||
|
remark:'' |
||||
|
}]) |
||||
|
// 调整事项合计 、调整后余额 |
||||
|
const bottomLeftSumTableData = ref([{ |
||||
|
index:'', |
||||
|
ttAbstractLeft:'调整事项合计', |
||||
|
ttBalanceLeft:'', |
||||
|
remark:'', |
||||
|
isSum:true, |
||||
|
disabled:true |
||||
|
},{ |
||||
|
index:'', |
||||
|
ttAbstractLeft:'调整后余额', |
||||
|
ttBalanceLeft:'', |
||||
|
remark:'', |
||||
|
isSum:true |
||||
|
}]) |
||||
|
watch( |
||||
|
() => bottomLeftTableData.value, |
||||
|
() => { |
||||
|
//调整事项合计左 |
||||
|
bottomLeftSumTableData.value[0].ttBalanceLeft = bottomLeftTableData.value.reduce((prev, item1) => prev + Number(item1['ttBalanceLeft']),0) |
||||
|
console.log('调整事项合计左',bottomLeftTableData) |
||||
|
|
||||
|
}, |
||||
|
{ |
||||
|
deep: true |
||||
|
} |
||||
|
) |
||||
|
watch( |
||||
|
() => bottomRightTableData.value, |
||||
|
() => { |
||||
|
//调整事项合计右 |
||||
|
bottomRightSumTableData.value[0].ttBalanceRight = bottomRightTableData.value.reduce((prev, item1) => prev + Number(item1['ttBalanceRight']),0) |
||||
|
console.log('调整事项合计右',bottomRightTableData) |
||||
|
|
||||
|
}, |
||||
|
{ |
||||
|
deep: true |
||||
|
} |
||||
|
) |
||||
|
const bottomRightSumTableData = ref([{ |
||||
|
index:'', |
||||
|
ttAbstractRight:'调整事项合计', |
||||
|
ttBalanceRight:'', |
||||
|
remark:'', |
||||
|
isSum:true, |
||||
|
disabled:true |
||||
|
},{ |
||||
|
index:'', |
||||
|
ttAbstractRight:'调整后余额', |
||||
|
ttBalanceRight:'', |
||||
|
remark:'', |
||||
|
isSum:true |
||||
|
}]) |
||||
|
const leftForm = ref({ |
||||
|
name:'', |
||||
|
date:'' |
||||
|
}) |
||||
|
const rightForm = ref({ |
||||
|
name:'', |
||||
|
date:'' |
||||
|
}) |
||||
|
|
||||
|
const dialogVisible = ref(false) |
||||
|
const open = ()=>{ |
||||
|
dialogVisible.value = true |
||||
|
} |
||||
|
const saveData = async ()=>{ |
||||
|
// 保存 |
||||
|
let myData = unref(props.rowData) |
||||
|
// [ |
||||
|
// { |
||||
|
// masterId:myData.masterId, |
||||
|
// ttAbstractLeft:'摘要左',//摘要左 |
||||
|
// ttBalanceLeft:'金额左',//金额左 |
||||
|
// ttAbstractRight:'摘要右',//摘要右 |
||||
|
// ttBalanceRight:'金额右',//金额右 |
||||
|
// } |
||||
|
// ] |
||||
|
let subList = bottomLeftTableData.value.map((item,index)=>({ |
||||
|
masterId:myData.id, |
||||
|
ttAbstractLeft:item.ttAbstractLeft, |
||||
|
ttBalanceLeft:item.ttBalanceLeft, |
||||
|
ttAbstractRight:bottomRightTableData.value[index].ttAbstractRight, |
||||
|
ttBalanceRight:bottomRightTableData.value[index].ttBalanceRight, |
||||
|
})) |
||||
|
let data = { |
||||
|
id:myData.id, |
||||
|
subList, |
||||
|
ttAdjustmentTotalLeft:bottomLeftSumTableData.value[0].ttBalanceLeft,//调整事项合计左 |
||||
|
ttAdjustmentBalLeft:bottomLeftSumTableData.value[1].ttBalanceLeft,//调整后余额左 |
||||
|
ttOperatorLeft:leftForm.value.name,//经办人左 |
||||
|
ttDzDateLeft:leftForm.value.date,//对账日期左 |
||||
|
ttAdjustmentTotalRight:bottomRightSumTableData.value[0].ttBalanceRight,//调整事项合计右 |
||||
|
ttAdjustmentBalRight:bottomRightSumTableData.value[1].ttBalanceRight,//调整后余额右 |
||||
|
ttOperatorRight:rightForm.value.name,//经办人右 |
||||
|
ttDzDateRight:rightForm.value.date,//对账日期右 |
||||
|
} |
||||
|
await SupplierApbalanceMainApi.updateSupplierApbalanceMain(data) |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
console.log('保存数据',saveData) |
||||
|
emit('updateList') |
||||
|
} |
||||
|
// 传递给父类 |
||||
|
const emit = defineEmits([ |
||||
|
'updateList', |
||||
|
]) |
||||
|
defineExpose({open,saveData}) |
||||
|
</script> |
||||
|
<style lang="scss" scoped> |
||||
|
.top{ |
||||
|
margin-bottom: 20px |
||||
|
} |
||||
|
|
||||
|
|
||||
|
</style> |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="RepairSparePartsRecord.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="RepairSparePartsRecord.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="RepairSparePartsRecordRules" |
||||
|
:formAllSchemas="RepairSparePartsRecord.allSchemas" |
||||
|
:apiUpdate="RepairSparePartsRecordApi.updateRepairSparePartsRecord" |
||||
|
:apiCreate="RepairSparePartsRecordApi.createRepairSparePartsRecord" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="RepairSparePartsRecord.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/eam/repair-spare-parts-record/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { RepairSparePartsRecord,RepairSparePartsRecordRules } from './repairSparePartsRecord.data' |
||||
|
import * as RepairSparePartsRecordApi from '@/api/eam/repairSparePartsRecord' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'RepairSparePartsRecord' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(RepairSparePartsRecord.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: RepairSparePartsRecordApi.getRepairSparePartsRecordPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:repairSparePartsRecord:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:repairSparePartsRecord:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:repairSparePartsRecord:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'wms:repairSparePartsRecord:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:repairSparePartsRecord:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =RepairSparePartsRecord.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 RepairSparePartsRecordApi.createRepairSparePartsRecord(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await RepairSparePartsRecordApi.updateRepairSparePartsRecord(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, 'basicRepairSparePartsRecord') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await RepairSparePartsRecordApi.deleteRepairSparePartsRecord(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 RepairSparePartsRecordApi.exportRepairSparePartsRecord(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 RepairSparePartsRecordApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,238 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const RepairSparePartsRecordRules = reactive({ |
||||
|
number: [required], |
||||
|
sparePartsCode: [required], |
||||
|
qty: [required], |
||||
|
areaCode: [required], |
||||
|
locationCode: [required], |
||||
|
status: [required], |
||||
|
result: [required], |
||||
|
applyer: [required], |
||||
|
concurrencyStamp: [required] |
||||
|
}) |
||||
|
|
||||
|
export const RepairSparePartsRecord = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '单号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '备件编号', |
||||
|
field: 'sparePartsCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '数量', |
||||
|
field: 'qty', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '库区编号', |
||||
|
field: 'areaCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '库位编号', |
||||
|
field: 'locationCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '流程状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Radio' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '结果状态', |
||||
|
field: 'result', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '申请人', |
||||
|
field: 'applyer', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '审核人', |
||||
|
field: 'approver', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '审核内容', |
||||
|
field: 'approveContent', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Editor', |
||||
|
componentProps: { |
||||
|
valueHtml: '', |
||||
|
height: 200 |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '审核时间', |
||||
|
field: 'approveTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '自动审核', |
||||
|
field: 'autoExamine', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '自动通过', |
||||
|
field: 'autoAgree', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '直接生成记录', |
||||
|
field: 'directCreateRecord', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
isForm: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '部门', |
||||
|
field: 'departmentCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '删除时间', |
||||
|
field: 'deletionTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '删除人', |
||||
|
field: 'deleterId', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="RepairSparePartsRequest.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="RepairSparePartsRequest.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="RepairSparePartsRequestRules" |
||||
|
:formAllSchemas="RepairSparePartsRequest.allSchemas" |
||||
|
:apiUpdate="RepairSparePartsRequestApi.updateRepairSparePartsRequest" |
||||
|
:apiCreate="RepairSparePartsRequestApi.createRepairSparePartsRequest" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="RepairSparePartsRequest.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/eam/repair-spare-parts-request/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { RepairSparePartsRequest,RepairSparePartsRequestRules } from './repairSparePartsRequest.data' |
||||
|
import * as RepairSparePartsRequestApi from '@/api/eam/repairSparePartsRequest' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'RepairSparePartsRequest' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(RepairSparePartsRequest.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: RepairSparePartsRequestApi.getRepairSparePartsRequestPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:repairSparePartsRequest:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:repairSparePartsRequest:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:repairSparePartsRequest:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'wms:repairSparePartsRequest:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:repairSparePartsRequest:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =RepairSparePartsRequest.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 RepairSparePartsRequestApi.createRepairSparePartsRequest(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await RepairSparePartsRequestApi.updateRepairSparePartsRequest(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, 'basicRepairSparePartsRequest') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await RepairSparePartsRequestApi.deleteRepairSparePartsRequest(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 RepairSparePartsRequestApi.exportRepairSparePartsRequest(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 RepairSparePartsRequestApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,251 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const RepairSparePartsRequestRules = reactive({ |
||||
|
number: [required], |
||||
|
sparePartsCode: [required], |
||||
|
qty: [required], |
||||
|
areaCode: [required], |
||||
|
locationCode: [required], |
||||
|
status: [required], |
||||
|
result: [required], |
||||
|
applyer: [required], |
||||
|
concurrencyStamp: [required], |
||||
|
repairCause: [required] |
||||
|
}) |
||||
|
|
||||
|
export const RepairSparePartsRequest = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '单号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '备件编号', |
||||
|
field: 'sparePartsCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '数量', |
||||
|
field: 'qty', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '库区编号', |
||||
|
field: 'areaCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'SelectV2' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '库位编号', |
||||
|
field: 'locationCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'SelectV2' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '流程状态枚举0:待审核1:已撤回3:审核中4:已通过5:已驳回6:已完成', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Radio' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '结果状态枚举:0待维修,1已废弃,2已修好', |
||||
|
field: 'result', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'SelectV2' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '申请人', |
||||
|
field: 'applyer', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '审核人', |
||||
|
field: 'approver', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '审核内容', |
||||
|
field: 'approveContent', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Editor', |
||||
|
componentProps: { |
||||
|
valueHtml: '', |
||||
|
height: 200 |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '审核时间', |
||||
|
field: 'approveTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '自动审核', |
||||
|
field: 'autoExamine', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '自动通过', |
||||
|
field: 'autoAgree', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '直接生成记录', |
||||
|
field: 'directCreateRecord', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
isForm: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '部门', |
||||
|
field: 'departmentCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用--默认TRUE', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '删除时间', |
||||
|
field: 'deletionTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '删除人', |
||||
|
field: 'deleterId', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '维修原因', |
||||
|
field: 'repairCause', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="ToolChangedRecord.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ToolChangedRecord.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="ToolChangedRecordRules" |
||||
|
:formAllSchemas="ToolChangedRecord.allSchemas" |
||||
|
:apiUpdate="ToolChangedRecordApi.updateToolChangedRecord" |
||||
|
:apiCreate="ToolChangedRecordApi.createToolChangedRecord" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="ToolChangedRecord.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/eam/tool-changed-record/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ToolChangedRecord,ToolChangedRecordRules } from './toolChangedRecord.data' |
||||
|
import * as ToolChangedRecordApi from '@/api/eam/toolChangedRecord' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'ToolChangedRecord' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(ToolChangedRecord.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: ToolChangedRecordApi.getToolChangedRecordPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
// defaultButtons.defaultAddBtn({hasPermi:'eam:tool-changed-record:create'}), // 新增 |
||||
|
// defaultButtons.defaultImportBtn({hasPermi:'eam:tool-changed-record:import'}), // 导入 |
||||
|
// defaultButtons.defaultExportBtn({hasPermi:'eam:tool-changed-record: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-changed-record:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'eam:tool-changed-record:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =ToolChangedRecord.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 ToolChangedRecordApi.createToolChangedRecord(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await ToolChangedRecordApi.updateToolChangedRecord(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, 'basicToolChangedRecord') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ToolChangedRecordApi.deleteToolChangedRecord(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 ToolChangedRecordApi.exportToolChangedRecord(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 ToolChangedRecordApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,110 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import * as UserApi from '@/api/system/user' |
||||
|
|
||||
|
export interface User { |
||||
|
id: number, |
||||
|
nickname: string |
||||
|
} |
||||
|
// 表单校验
|
||||
|
export const ToolChangedRecordRules = reactive({ |
||||
|
code: [required], |
||||
|
name: [required], |
||||
|
concurrencyStamp: [required] |
||||
|
}) |
||||
|
|
||||
|
const userList = ref<User[]>([]) |
||||
|
userList.value = await UserApi.getSimpleUserList() |
||||
|
|
||||
|
export const ToolChangedRecord = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '工装编号', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
fixed: 'left' |
||||
|
}, |
||||
|
{ |
||||
|
label: '工装名称', |
||||
|
field: 'name', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '变更前状态', |
||||
|
field: 'statusBefore', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
dictType: DICT_TYPE.DEVICE_STATUS, |
||||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
form: { |
||||
|
component: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '变更后状态', |
||||
|
field: 'statusAfter', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
dictType: DICT_TYPE.DEVICE_STATUS, |
||||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
form: { |
||||
|
component: 'Select', |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作人', |
||||
|
field: 'operator', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'Select', |
||||
|
componentProps: { |
||||
|
options: userList.value, |
||||
|
optionsAlias: { |
||||
|
valueField: 'id', |
||||
|
labelField: 'nickname' |
||||
|
}, |
||||
|
filterable: true, |
||||
|
clearable: true |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作时间', |
||||
|
field: 'operateTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '操作',
|
||||
|
// field: 'action',
|
||||
|
// isForm: false,
|
||||
|
// table: {
|
||||
|
// width: 150,
|
||||
|
// fixed: 'right'
|
||||
|
// }
|
||||
|
// }
|
||||
|
])) |
@ -0,0 +1,280 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="ToolSigning.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ToolSigning.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="ToolSigningRules" |
||||
|
:formAllSchemas="ToolSigning.allSchemas" |
||||
|
:apiUpdate="ToolSigningApi.updateToolSigning" |
||||
|
:apiCreate="ToolSigningApi.createToolSigningNew" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
@onChange="onChange" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="ToolSigning.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/eam/tool-signing/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ToolSigning,ToolSigningRules } from './toolSigning.data' |
||||
|
import * as ToolSigningApi from '@/api/eam/toolSigning' |
||||
|
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 EquipmentSupplierApi from '@/api/eam/equipmentSupplier' |
||||
|
import * as UserApi from '@/api/system/user' |
||||
|
|
||||
|
defineOptions({ name: 'ToolSigning' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(ToolSigning.allSchemas.tableColumns) |
||||
|
|
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = async (formField, searchField, val, formRef) => { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
if(formField == 'toolName'){ |
||||
|
setV['toolCode'] = val[0]['code'] |
||||
|
setV['toolName'] = val[0]['name'] |
||||
|
setV['supplierCode'] = val[0]['supplierCode'] |
||||
|
setV['workshopCode'] = val[0]['workshopCode'] |
||||
|
const equipmentSupplierList = await EquipmentSupplierApi.getEquipmentSupplierNoPage({}) |
||||
|
const entry = equipmentSupplierList.find(item => item.number == val[0]['supplierCode']) |
||||
|
setV['supplierTelephone'] = entry?.phone |
||||
|
setV['supplierPeople'] = Number(entry?.contacts) |
||||
|
} |
||||
|
nextTick(() => { |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: ToolSigningApi.getToolSigningPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'eam:tool-signing:create'}), // 新增 |
||||
|
// defaultButtons.defaultImportBtn({hasPermi:'eam:tool-signing:import'}), // 导入 |
||||
|
// defaultButtons.defaultExportBtn({hasPermi:'eam:tool-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:tool-signing:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'eam:tool-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 = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =ToolSigning.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 ToolSigningApi.createToolSigningNew(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await ToolSigningApi.updateToolSigning(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, 'basicToolSigning') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ToolSigningApi.deleteToolSigning(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 ToolSigningApi.exportToolSigning(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'){ |
||||
|
const userList = await UserApi.getUserListByDeptIds([cur]) |
||||
|
ToolSigning.allSchemas.formSchema.find(item => item.field == 'operationer').componentProps.options = userList |
||||
|
let setV = {} |
||||
|
setV['operationer'] = '' |
||||
|
formRef.value.setValues(setV) |
||||
|
} |
||||
|
if(field == 'supplierCode'){ |
||||
|
const equipmentSupplierList = await EquipmentSupplierApi.getEquipmentSupplierNoPage({}) |
||||
|
const entry = equipmentSupplierList.find(item => item.number == cur) |
||||
|
let setV = {} |
||||
|
setV['supplierTelephone'] = entry.phone |
||||
|
setV['supplierPeople'] = Number(entry.contacts) |
||||
|
formRef.value.setValues(setV) |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await ToolSigningApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,487 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import { handleTreeToComponentOptions } from '@/utils/tree' |
||||
|
import * as DeptApi from '@/api/system/dept' |
||||
|
import * as UserApi from '@/api/system/user' |
||||
|
import { ToolAccounts,ToolAccountsRules } from '../toolAccounts/toolAccounts.data' |
||||
|
import * as ToolAccountsApi from '@/api/eam/toolAccounts' |
||||
|
import * as EquipmentSupplierApi from '@/api/eam/equipmentSupplier' |
||||
|
import * as BasicEamWorkshopApi from '@/api/eam/basicEamWorkshop' |
||||
|
|
||||
|
|
||||
|
export interface User { |
||||
|
id: number, |
||||
|
nickname: string |
||||
|
} |
||||
|
|
||||
|
const toolList = await ToolAccountsApi.getToolAccountsNoPage({}) |
||||
|
const workshopList = await BasicEamWorkshopApi.getBasicEamWorkshopNoPage({}) |
||||
|
const equipmentSupplierList = await EquipmentSupplierApi.getEquipmentSupplierNoPage({}) |
||||
|
const allDeptList = await DeptApi.getSimpleDeptList() |
||||
|
const deptList = ref<Tree[]>([]) // 树形结构
|
||||
|
const userList = ref<User[]>([]) |
||||
|
userList.value = await UserApi.getSimpleUserList() |
||||
|
// 加载部门树(默认格式)
|
||||
|
deptList.value = handleTreeToComponentOptions(allDeptList) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ToolSigningRules = reactive({ |
||||
|
toolCode: [required], |
||||
|
operationDate: [required], |
||||
|
operationer: [required], |
||||
|
operationDept: [required], |
||||
|
storageLocation: [required], |
||||
|
concurrencyStamp: [required] |
||||
|
}) |
||||
|
|
||||
|
export const ToolSigning = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '工装', |
||||
|
field: 'toolCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
isForm: false, |
||||
|
isDetail: false, |
||||
|
isTableForm: false, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: string) => { |
||||
|
return toolList.find((item) => item.code == cellValue)?.name |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '工装', |
||||
|
field: 'toolName', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isTable: false, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择设备', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '设备信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: ToolAccounts.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: ToolAccountsApi.getToolAccountsPage, // 查询弹窗所需分页方法
|
||||
|
searchCondition: |
||||
|
[{ |
||||
|
key: 'available', |
||||
|
value: 'TRUE', |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key: 'status', |
||||
|
value: 'TOACCEPT', |
||||
|
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: '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.value, |
||||
|
disabled: false, |
||||
|
placeholder: "请选择部门", |
||||
|
filterable: true, |
||||
|
multiple: 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: 'telephone', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商编号', |
||||
|
field: 'supplierCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: true, |
||||
|
isDetail: false, |
||||
|
isTable: false, |
||||
|
isTableForm: false, |
||||
|
form: { |
||||
|
component: 'Select', |
||||
|
componentProps: { |
||||
|
options: equipmentSupplierList, |
||||
|
optionsAlias: { |
||||
|
labelField: 'name', |
||||
|
valueField: 'number' |
||||
|
}, |
||||
|
filterable: true, |
||||
|
disabled: true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '供应商编号',
|
||||
|
// field: 'supplierName',
|
||||
|
// sort: 'custom',
|
||||
|
// isSearch: false,
|
||||
|
// isForm: true,
|
||||
|
// isDetail: false,
|
||||
|
// isTable: false,
|
||||
|
// isTableForm: false,
|
||||
|
// form: {
|
||||
|
// component: 'Input',
|
||||
|
// componentProps: {
|
||||
|
// disabled: true
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '供应商联系人', |
||||
|
field: 'supplierPeople', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
||||
|
return userList.value.find((item) => item.id == cellValue)?.nickname |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Select', |
||||
|
componentProps: { |
||||
|
options: userList.value, |
||||
|
optionsAlias: { |
||||
|
labelField: 'nickname', |
||||
|
valueField: 'id' |
||||
|
}, |
||||
|
disabled: true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商联系方式', |
||||
|
field: 'supplierTelephone', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: true, |
||||
|
form: { |
||||
|
component: 'Input', |
||||
|
componentProps: { |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '流程状态',
|
||||
|
// field: 'status',
|
||||
|
// sort: 'custom',
|
||||
|
// isSearch: true,
|
||||
|
// dictType: DICT_TYPE.JOB_STATUS,
|
||||
|
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
// 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',
|
||||
|
// valueHtml: '',
|
||||
|
// height: 200
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// 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',
|
||||
|
// dictType: DICT_TYPE.TRUE_FALSE,
|
||||
|
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
// isSearch: false,
|
||||
|
// form: {
|
||||
|
// component: 'Switch',
|
||||
|
// value: 'TRUE',
|
||||
|
// componentProps: {
|
||||
|
// inactiveValue: 'FALSE',
|
||||
|
// activeValue: 'TRUE'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '自动通过',
|
||||
|
// field: 'autoAgree',
|
||||
|
// sort: 'custom',
|
||||
|
// dictType: DICT_TYPE.TRUE_FALSE,
|
||||
|
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
// isSearch: false,
|
||||
|
// form: {
|
||||
|
// component: 'Switch',
|
||||
|
// value: 'TRUE',
|
||||
|
// componentProps: {
|
||||
|
// inactiveValue: 'FALSE',
|
||||
|
// activeValue: 'TRUE'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '直接生成记录',
|
||||
|
// field: 'directCreateRecord',
|
||||
|
// sort: 'custom',
|
||||
|
// dictType: DICT_TYPE.TRUE_FALSE,
|
||||
|
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
// isSearch: false,
|
||||
|
// form: {
|
||||
|
// component: 'Switch',
|
||||
|
// value: 'TRUE',
|
||||
|
// componentProps: {
|
||||
|
// inactiveValue: 'FALSE',
|
||||
|
// activeValue: 'TRUE'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '存放位置描述', |
||||
|
field: 'storageLocation', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: true, |
||||
|
form: { |
||||
|
component: 'Input', |
||||
|
componentProps: { |
||||
|
type: 'textarea', |
||||
|
placeholder: '请输入存放位置描述' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '所属厂区编号',
|
||||
|
// field: 'factoryAreaCode',
|
||||
|
// sort: 'custom',
|
||||
|
// isSearch: false
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '车间编号', |
||||
|
field: 'workshopCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: true, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: string) => { |
||||
|
return workshopList.find((item) => item.code == cellValue)?.name |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Select', |
||||
|
componentProps: { |
||||
|
options: workshopList, |
||||
|
placeholder: '请选择车间编号', |
||||
|
optionsAlias: { |
||||
|
valueField: 'code', |
||||
|
labelField: 'name' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '产线编号',
|
||||
|
// field: 'lineCode',
|
||||
|
// sort: 'custom',
|
||||
|
// 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: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '是否可用',
|
||||
|
// field: 'available',
|
||||
|
// sort: 'custom',
|
||||
|
// dictType: DICT_TYPE.TRUE_FALSE,
|
||||
|
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
// isSearch: true,
|
||||
|
// form: {
|
||||
|
// component: 'Switch',
|
||||
|
// value: 'TRUE',
|
||||
|
// componentProps: {
|
||||
|
// inactiveValue: 'FALSE',
|
||||
|
// activeValue: 'TRUE'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '操作',
|
||||
|
// field: 'action',
|
||||
|
// isForm: false,
|
||||
|
// table: {
|
||||
|
// width: 150,
|
||||
|
// fixed: 'right'
|
||||
|
// }
|
||||
|
// }
|
||||
|
])) |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="ProductionitemcodeSpareitemcode.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ProductionitemcodeSpareitemcode.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="ProductionitemcodeSpareitemcodeRules" |
||||
|
:formAllSchemas="ProductionitemcodeSpareitemcode.allSchemas" |
||||
|
:apiUpdate="ProductionitemcodeSpareitemcodeApi.updateProductionitemcodeSpareitemcode" |
||||
|
:apiCreate="ProductionitemcodeSpareitemcodeApi.createProductionitemcodeSpareitemcode" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="ProductionitemcodeSpareitemcode.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/wms/productionitemcode-spareitemcode/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ProductionitemcodeSpareitemcode,ProductionitemcodeSpareitemcodeRules } from './productionitemcodeSpareitemcode.data' |
||||
|
import * as ProductionitemcodeSpareitemcodeApi from '@/api/wms/productionitemcodeSpareitemcode' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'ProductionitemcodeSpareitemcode' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(ProductionitemcodeSpareitemcode.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: ProductionitemcodeSpareitemcodeApi.getProductionitemcodeSpareitemcodePage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:productionitemcode-spareitemcode:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:productionitemcode-spareitemcode:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:productionitemcode-spareitemcode:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'wms:productionitemcode-spareitemcode:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:productionitemcode-spareitemcode:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =ProductionitemcodeSpareitemcode.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 ProductionitemcodeSpareitemcodeApi.createProductionitemcodeSpareitemcode(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await ProductionitemcodeSpareitemcodeApi.updateProductionitemcodeSpareitemcode(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, 'basicProductionitemcodeSpareitemcode') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ProductionitemcodeSpareitemcodeApi.deleteProductionitemcodeSpareitemcode(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 ProductionitemcodeSpareitemcodeApi.exportProductionitemcodeSpareitemcode(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 ProductionitemcodeSpareitemcodeApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,72 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ProductionitemcodeSpareitemcodeRules = reactive({ |
||||
|
productionItemCode: [required], |
||||
|
available: [required], |
||||
|
}) |
||||
|
|
||||
|
export const ProductionitemcodeSpareitemcode = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '量产件', |
||||
|
field: 'productionItemCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备件', |
||||
|
field: 'spareItemCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
Loading…
Reference in new issue