Browse Source

BUG修改

master
parent
commit
9ab87045bc
  1. 18
      src/api/eam/item/applicationRecordDetail/index.ts
  2. 4
      src/api/eam/item/itemAccounts/index.ts
  3. 16
      src/api/eam/item/itemApplyDetail/index.ts
  4. 49
      src/api/eam/item/itemLocationReplace/index.ts
  5. 12
      src/views/eam/item/itemAccounts/index.vue
  6. 118
      src/views/eam/item/itemApplyMain/itemApplyMain.data.ts
  7. 244
      src/views/eam/item/itemLocationReplace/index.vue
  8. 62
      src/views/eam/item/itemLocationReplace/itemLocationReplace.data.ts

18
src/api/eam/item/applicationRecordDetail/index.ts

@ -20,38 +20,38 @@ export const getApplicationRecordDetailPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
delete params.isSearch delete params.isSearch
const data = { ...params } const data = { ...params }
return await request.post({ url: '/eam/item-apply-detail/senior', data }) return await request.post({ url: '/eam/item-apply-request-detail/senior', data })
} else { } else {
return await request.get({ url: `/eam/item-apply-detail/page`, params }) return await request.get({ url: `/eam/item-apply-request-detail/page`, params })
} }
} }
// 查询备件申领记录主详情 // 查询备件申领记录主详情
export const getApplicationRecordDetail = async (id : number) => { export const getApplicationRecordDetail = async (id : number) => {
return await request.get({ url: `/eam/item-apply-detail/get?id=` + id }) return await request.get({ url: `/eam/item-apply-request-detail/get?id=` + id })
} }
// 新增备件申领记录主 // 新增备件申领记录主
export const createApplicationRecordDetail = async (data : ItemApplyDetailVO) => { export const createApplicationRecordDetail = async (data : ItemApplyDetailVO) => {
return await request.post({ url: `/eam/item-apply-detail/create`, data }) return await request.post({ url: `/eam/item-apply-request-detail/create`, data })
} }
// 修改备件申领记录主 // 修改备件申领记录主
export const updateApplicationRecordDetail = async (data : ItemApplyDetailVO) => { export const updateApplicationRecordDetail = async (data : ItemApplyDetailVO) => {
return await request.put({ url: `/eam/item-apply-detail/update`, data }) return await request.put({ url: `/eam/item-apply-request-detail/update`, data })
} }
// 删除备件申领记录主 // 删除备件申领记录主
export const deleteApplicationRecordDetail = async (id : number) => { export const deleteApplicationRecordDetail = async (id : number) => {
return await request.delete({ url: `/eam/item-apply-detail/delete?id=` + id }) return await request.delete({ url: `/eam/item-apply-request-detail/delete?id=` + id })
} }
// 导出备件申领记录主 Excel // 导出备件申领记录主 Excel
export const exportApplicationRecordDetail = async (params) => { export const exportApplicationRecordDetail = async (params) => {
return await request.download({ url: `/eam/item-apply-detail/export-excel`, params }) return await request.download({ url: `/eam/item-apply-request-detail/export-excel`, params })
} }
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/eam/item-apply-detail/get-import-template' }) return request.download({ url: '/eam/item-apply-request-detail/get-import-template' })
} }

4
src/api/eam/item/itemAccounts/index.ts

@ -52,6 +52,6 @@ export const importTemplate = () => {
} }
// 更改备件库位 // 更改备件库位
export const createDeviceItemBatch = async (data: Array<DeviceItemVO>) => { export const replaceLocation = async (data: Array<ItemAccountsVO>) => {
return await request.post({url: `/rel/device-item/createBatch `, data }); return await request.post({url: `/eam/item-accounts/replaceLocation `, data });
}; };

16
src/api/eam/item/itemApplyDetail/index.ts

@ -20,38 +20,38 @@ export const getItemApplyDetailPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
delete params.isSearch delete params.isSearch
const data = {...params} const data = {...params}
return await request.post({ url: '/eam/item-apply-detail/senior', data }) return await request.post({ url: '/eam/item-apply-request-detail/senior', data })
} else { } else {
return await request.get({ url: `/eam/item-apply-detail/page`, params }) return await request.get({ url: `/eam/item-apply-request-detail/page`, params })
} }
} }
// 查询备件申领记录主详情 // 查询备件申领记录主详情
export const getItemApplyDetail = async (id: number) => { export const getItemApplyDetail = async (id: number) => {
return await request.get({ url: `/eam/item-apply-detail/get?id=` + id }) return await request.get({ url: `/eam/item-apply-request-detail/get?id=` + id })
} }
// 新增备件申领记录主 // 新增备件申领记录主
export const createItemApplyDetail = async (data: ItemApplyDetailVO) => { export const createItemApplyDetail = async (data: ItemApplyDetailVO) => {
return await request.post({ url: `/eam/item-apply-detail/create`, data }) return await request.post({ url: `/eam/item-apply-request-detail/create`, data })
} }
// 修改备件申领记录主 // 修改备件申领记录主
export const updateItemApplyDetail = async (data: ItemApplyDetailVO) => { export const updateItemApplyDetail = async (data: ItemApplyDetailVO) => {
return await request.put({ url: `/eam/item-apply-detail/update`, data }) return await request.put({ url: `/eam/item-apply-request-detail/update`, data })
} }
// 删除备件申领记录主 // 删除备件申领记录主
export const deleteItemApplyDetail = async (id: number) => { export const deleteItemApplyDetail = async (id: number) => {
return await request.delete({ url: `/eam/item-apply-detail/delete?id=` + id }) return await request.delete({ url: `/eam/item-apply-request-detail/delete?id=` + id })
} }
// 导出备件申领记录主 Excel // 导出备件申领记录主 Excel
export const exportItemApplyDetail = async (params) => { export const exportItemApplyDetail = async (params) => {
return await request.download({ url: `/eam/item-apply-detail/export-excel`, params }) return await request.download({ url: `/eam/item-apply-request-detail/export-excel`, params })
} }
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/eam/item-apply-detail/get-import-template' }) return request.download({ url: '/eam/item-apply-request-detail/get-import-template' })
} }

49
src/api/eam/item/itemLocationReplace/index.ts

@ -0,0 +1,49 @@
import request from '@/config/axios'
export interface ItemLocationReplaceVO {
locationNumber: string
describe: string
oldItemNumber: string
itemNumber: string
}
// 查询备件库位变更记录列表
export const getItemLocationReplacePage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/item-location-replace/senior', data })
} else {
return await request.get({ url: `/eam/item-location-replace/page`, params })
}
}
// 查询备件库位变更记录详情
export const getItemLocationReplace = async (id: number) => {
return await request.get({ url: `/eam/item-location-replace/get?id=` + id })
}
// 新增备件库位变更记录
export const createItemLocationReplace = async (data: ItemLocationReplaceVO) => {
return await request.post({ url: `/eam/item-location-replace/create`, data })
}
// 修改备件库位变更记录
export const updateItemLocationReplace = async (data: ItemLocationReplaceVO) => {
return await request.put({ url: `/eam/item-location-replace/update`, data })
}
// 删除备件库位变更记录
export const deleteItemLocationReplace = async (id: number) => {
return await request.delete({ url: `/eam/item-location-replace/delete?id=` + id })
}
// 导出备件库位变更记录 Excel
export const exportItemLocationReplace = async (params) => {
return await request.download({ url: `/eam/item-location-replace/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/item-location-replace/get-import-template' })
}

12
src/views/eam/item/itemAccounts/index.vue

@ -50,6 +50,8 @@
:isBusiness="false" :isBusiness="false"
/> />
<SearchTable ref="searchTableRef" @searchTableSuccess="submitItem" />
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemAccounts.allSchemas" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="ItemAccounts.allSchemas" />
@ -75,6 +77,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
const locationNumber = ref() const locationNumber = ref()
const id = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(ItemAccounts.allSchemas.tableColumns) const tableColumns = ref(ItemAccounts.allSchemas.tableColumns)
@ -147,14 +150,16 @@ const buttonTableClick = async (val, row) => {
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) handleDelete(row.id)
} else if (val == 'selectItem') { } else if (val == 'selectItem') {
openItem(row.locationNumber) openItem(row.locationNumber,row.id)
} }
} }
const searchTableRef = ref() const searchTableRef = ref()
/** 绑定备件操作 */ /** 绑定备件操作 */
const openItem = async (number: String) => { const openItem = async (number: String,id: number) => {
console.log(id)
locationNumber.value = number locationNumber.value = number
id = id
searchTableRef.value.open( searchTableRef.value.open(
'选择备件', '选择备件',
Item.allSchemas, Item.allSchemas,
@ -171,10 +176,11 @@ const openItem = async (number: String) => {
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => { const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => {
const deviceItemRelList = selections.map((element) => ({ const deviceItemRelList = selections.map((element) => ({
id: id.value,
locationNumber: locationNumber.value, locationNumber: locationNumber.value,
itemNumber: element.number itemNumber: element.number
})) }))
createDeviceItemBatch(deviceItemRelList).then((res) => { ItemAccountsApi.replaceLocation(deviceItemRelList).then((res) => {
console.log('res', res) console.log('res', res)
}) })
console.log('deviceItemRelList', deviceItemRelList) console.log('deviceItemRelList', deviceItemRelList)

118
src/views/eam/item/itemApplyMain/itemApplyMain.data.ts

@ -116,6 +116,124 @@ export const ItemApplyDetail = useCrudSchemas(reactive<CrudSchema[]>([
] ]
}, },
}, },
{
label: '类型',
field: 'type',
sort: 'custom',
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 150
},
tableForm: {
type: 'Select',
disabled: false
}
},
{
label: '设备/模具编号',
field: 'deviceNumber',
sort: 'custom',
isSearch: true,
tableForm: {
isInpuFocusShow: true,
searchListPlaceholder: '请选择单号',
searchField: 'number',
searchTitle: '单号信息',
searchAllSchemas: DeviceMOLD.allSchemas, // 查询弹窗所需类
searchPage: DeviceMoldItemsApi.getNumber, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: "TRUE",
isMainValue: false
}, {
key: 'type',
value: "type",
isMainValue: true
}
]
},
},
{
label: '申领数量',
field: 'qty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
tableForm: {
type: 'InputNumber',
min: 1,
precision: 6
}
},
{
label: '库存数量',
field: 'currentQty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
tableForm: {
type: 'InputNumber',
min: 1,
precision: 6
}
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 150
},
tableForm: {
type: 'Select',
disabled: true
}
},
{
label: '是否以旧换新',
field: 'isRadeIn',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 150
},
tableForm: {
type: 'Select',
disabled: true
}
},
{ {
label: '备注', label: '备注',
field: 'remark', field: 'remark',

244
src/views/eam/item/itemLocationReplace/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ItemLocationReplace.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ItemLocationReplace.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="ItemLocationReplaceRules"
:formAllSchemas="ItemLocationReplace.allSchemas"
:apiUpdate="ItemLocationReplaceApi.updateItemLocationReplace"
:apiCreate="ItemLocationReplaceApi.createItemLocationReplace"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemLocationReplace.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/record/item-location-replace/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { ItemLocationReplace,ItemLocationReplaceRules } from './itemLocationReplace.data'
import * as ItemLocationReplaceApi from '@/api/eam/item/itemLocationReplace'
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: 'ItemLocationReplace' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(ItemLocationReplace.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: ItemLocationReplaceApi.getItemLocationReplacePage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:itemLocationReplace:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:itemLocationReplace:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:itemLocationReplace: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:itemLocationReplace:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:itemLocationReplace: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 =ItemLocationReplace.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 ItemLocationReplaceApi.createItemLocationReplace(data)
message.success(t('common.createSuccess'))
} else {
await ItemLocationReplaceApi.updateItemLocationReplace(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, 'basicItemLocationReplace')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ItemLocationReplaceApi.deleteItemLocationReplace(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 ItemLocationReplaceApi.exportItemLocationReplace(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 ItemLocationReplaceApi.importTemplate()
})
</script>

62
src/views/eam/item/itemLocationReplace/itemLocationReplace.data.ts

@ -0,0 +1,62 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const ItemLocationReplaceRules = reactive({
locationNumber: [required],
oldItemNumber: [required],
itemNumber: [required],
})
export const ItemLocationReplace = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '库位编号',
field: 'locationNumber',
sort: 'custom',
isSearch: true,
},
{
label: '变更前备件编号',
field: 'oldItemNumber',
sort: 'custom',
isSearch: true,
},
{
label: '变更后备件编号',
field: 'itemNumber',
sort: 'custom',
isSearch: true,
},
{
label: '创建时间',
field: 'createTime',
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')]
}
},
isForm: false,
},
{
label: '描述',
field: 'describe',
sort: 'custom',
isSearch: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
Loading…
Cancel
Save