Browse Source

备件归还入库 备件出库

master
宋国强 9 months ago
parent
commit
9125298b3c
  1. 5
      src/api/eam/item/itemAccounts/index.ts
  2. 11
      src/utils/validator.ts
  3. 100
      src/views/eam/item/itemInLocation/itemInLocation.data.ts
  4. 15
      src/views/eam/item/itemOutLocation/index.vue
  5. 128
      src/views/eam/item/itemOutLocation/itemOutLocation.data.ts

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

@ -28,6 +28,11 @@ export const getItemAccounts = async (id: number) => {
return await request.get({ url: `/eam/item-accounts/get?id=` + id }) return await request.get({ url: `/eam/item-accounts/get?id=` + id })
} }
// 查询备件台账详情
export const getByLocationNumber = async (locationNumber: string) => {
return await request.get({ url: `/eam/item-accounts/getByLocationNumber?locationNumber=` + locationNumber })
}
// 新增备件台账 // 新增备件台账
export const createItemAccounts = async (data: ItemAccountsVO) => { export const createItemAccounts = async (data: ItemAccountsVO) => {
return await request.post({ url: `/eam/item-accounts/create`, data }) return await request.post({ url: `/eam/item-accounts/create`, data })

11
src/utils/validator.ts

@ -801,3 +801,14 @@ export function validateNumberMax20Length(rule, value, callback) {
callback(); callback();
} }
} }
//数字大于0
export function validateNumber(rule, value, callback) {
const reg = /^\d+$/
if (reg.test(value) && parseInt(value) > 0) {
return true
} else {
//callback(new Error('请输入大于0的数字'))
return false
}
}

100
src/views/eam/item/itemInLocation/itemInLocation.data.ts

@ -1,50 +1,114 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import * as LocationApi from '@/api/eam/basic/location'
import { Location } from '@/views/eam/basic/location/location.data'
import { validateNumber } from '@/utils/validator'
// 表单校验 // 表单校验
export const ItemInLocationRules = reactive({ export const ItemInLocationRules = reactive({
number: [required], number: [required],
itemNumber: [required], itemNumber: [required],
locationNumber: [required], locationNumber: [required],
qty: [
required,
{ validator: validateNumber, message: '数量不能等于0', trigger: 'blur' },
],
}) })
export const ItemInLocation = useCrudSchemas(reactive<CrudSchema[]>([ export const ItemInLocation = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '库编号', label: '库编号',
field: 'number', field: 'locationNumber',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
}, form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择库位编号', // 输入框占位文本
searchField: 'number', // 查询弹窗赋值字段
searchTitle: '库位信息', // 查询弹窗标题
searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法
searchCondition: [
{ {
label: '备件编号', key: 'available',
field: 'itemNumber', value: 'TRUE',
sort: 'custom', isMainValue: false
isSearch: true, }
// ,
// {
// key: 'areaNumber',
// value: 'areaNumber',
// isMainValue: true
// },
]
}
}
}, },
{ {
label: '库位编号', label: '库位名称',
field: 'locationNumber', field: 'locationName',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: false,
isForm:false
}, },
// {
// label: '备件编号',
// field: 'itemNumber',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps:{
// disabled:true
// }
// }
// },
// {
// label: '备件名称',
// field: 'itemName',
// sort: 'custom',
// isSearch: false,
// form:{
// componentProps:{
// disabled:true
// }
// }
// },
{ {
label: '入库类型', label: '归还人',
field: 'type', field: 'returner',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
form: {
component: 'Select'
},
}, },
// {
// label: '出库类型',
// field: 'type',
// sort: 'custom',
// isSearch: false,
// form: {
// component: 'Select'
// },
// },
{ {
label: '数量', label: '归还数量',
field: 'qty', field: 'qty',
sort: 'custom', sort: 'custom',
isSearch: false, table: {
width: 110
},
form:{
component: 'InputNumber',
componentProps:{
min: 0,//最小值`
precision: 2//精度`
}
}
}, },
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',
isForm: false, isForm: false,
isTable:false,
table: { table: {
width: 150, width: 150,
fixed: 'right' fixed: 'right'

15
src/views/eam/item/itemOutLocation/index.vue

@ -61,6 +61,7 @@
import download from '@/utils/download' import download from '@/utils/download'
import { ItemOutLocation,ItemOutLocationRules } from './itemOutLocation.data' import { ItemOutLocation,ItemOutLocationRules } from './itemOutLocation.data'
import * as ItemOutLocationApi from '@/api/eam/item/itemOutLocation' import * as ItemOutLocationApi from '@/api/eam/item/itemOutLocation'
import * as ItemAccountsApi from '@/api/eam/item/itemAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
@ -77,14 +78,26 @@ routeName.value = route.name
const tableColumns = ref(ItemOutLocation.allSchemas.tableColumns) const tableColumns = ref(ItemOutLocation.allSchemas.tableColumns)
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = async(formField, searchField, val, formRef) => {
if(formField=='locationNumber'){//
let aa = await ItemAccountsApi.getByLocationNumber(val[0][searchField]);
if(aa.id==null){
message.info("该库位下无备件信息");
return;
}
nextTick(() => { nextTick(() => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
setV['locationName'] = val[0]['name']
setV['itemName'] = aa.itemName
setV['itemNumber'] = aa.itemNumber
ItemOutLocation.allSchemas.formSchema.find(item => item.field == 'qty').componentProps.max = aa.qty//
formRef.setValues(setV) formRef.setValues(setV)
}) })
} }
}
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
tableColumns.value = val tableColumns.value = val

128
src/views/eam/item/itemOutLocation/itemOutLocation.data.ts

@ -1,50 +1,152 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import * as LocationAreaApi from '@/api/eam/basic/locationArea'
import { LocationArea } from '@/views/eam/basic/locationArea/locationArea.data'
import * as LocationApi from '@/api/eam/basic/location'
import { Location } from '@/views/eam/basic/location/location.data'
// 表单校验 // 表单校验
export const ItemOutLocationRules = reactive({ export const ItemOutLocationRules = reactive({
number: [required], // number: [required],
itemNumber: [required], itemNumber: [required],
qty: [required],
locationNumber: [required], locationNumber: [required],
}) })
export const ItemOutLocation = useCrudSchemas(reactive<CrudSchema[]>([ export const ItemOutLocation = useCrudSchemas(reactive<CrudSchema[]>([
// {
// label: '编号',
// field: 'number',
// sort: 'custom',
// isSearch: false,
// isForm:false,
// },
// {
// label: '库区编号',
// field: 'areaNumber',
// sort: 'custom',
// isSearch: false,
// form: {
// // labelMessage: '信息提示说明!!!',
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// searchListPlaceholder: '请选择库区编号', // 输入框占位文本
// searchField: 'number', // 查询弹窗赋值字段
// searchTitle: '库区信息', // 查询弹窗标题
// searchAllSchemas: LocationArea.allSchemas, // 查询弹窗所需类
// searchPage: LocationAreaApi.getLocationAreaPage, // 查询弹窗所需分页方法
// searchCondition: [
// {
// key: 'available',
// value: 'TRUE',
// isMainValue: false
// }
// ]
// }
// }
// },
// {
// label: '库区名称',
// field: 'areaName',
// sort: 'custom',
// isSearch: false,
// isForm:false
// },
{ {
label: '出库编号', label: '库编号',
field: 'number', field: 'locationNumber',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择库位编号', // 输入框占位文本
searchField: 'number', // 查询弹窗赋值字段
searchTitle: '库位信息', // 查询弹窗标题
searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
// ,
// {
// key: 'areaNumber',
// value: 'areaNumber',
// isMainValue: true
// },
]
}
}
}, },
{ {
label: '备件编号', label: '库位名称',
field: 'itemNumber', field: 'locationName',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: false,
isForm:false
}, },
{ {
label: '库位编号', label: '备件编号',
field: 'locationNumber', field: 'itemNumber',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
form:{
componentProps:{
disabled:true
}
}
}, },
{ {
label: '出库类型', label: '备件名称',
field: 'type', field: 'itemName',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
form:{ form:{
component: 'Select' componentProps:{
disabled:true
}
}
}, },
{
label: '领用人',
field: 'receiver',
sort: 'custom',
isSearch: false,
}, },
// {
// label: '出库类型',
// field: 'type',
// sort: 'custom',
// isSearch: false,
// form: {
// component: 'Select'
// },
// },
{ {
label: '数量', label: '出库数量',
field: 'qty', field: 'qty',
sort: 'custom', sort: 'custom',
isSearch: false, table: {
width: 110
},
form:{
component: 'InputNumber',
componentProps:{
min: 0,//最小值`
precision: 2//精度`
}
}
}, },
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',
isForm: false, isForm: false,
isTable:false,
table: { table: {
width: 150, width: 150,
fixed: 'right' fixed: 'right'

Loading…
Cancel
Save