Browse Source

备件归还入库 备件出库

master
songguoqiang 9 months ago
parent
commit
9125298b3c
  1. 5
      src/api/eam/item/itemAccounts/index.ts
  2. 11
      src/utils/validator.ts
  3. 102
      src/views/eam/item/itemInLocation/itemInLocation.data.ts
  4. 17
      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 })
}
// 查询备件台账详情
export const getByLocationNumber = async (locationNumber: string) => {
return await request.get({ url: `/eam/item-accounts/getByLocationNumber?locationNumber=` + locationNumber })
}
// 新增备件台账
export const createItemAccounts = async (data: ItemAccountsVO) => {
return await request.post({ url: `/eam/item-accounts/create`, data })

11
src/utils/validator.ts

@ -800,4 +800,15 @@ export function validateNumberMax20Length(rule, value, callback) {
} else {
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
}
}

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

@ -1,50 +1,114 @@
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({
number: [required],
itemNumber: [required],
locationNumber: [required],
qty: [
required,
{ validator: validateNumber, message: '数量不能等于0', trigger: 'blur' },
],
})
export const ItemInLocation = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '库编号',
field: 'number',
label: '库编号',
field: 'locationNumber',
sort: 'custom',
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: '备件编号',
field: 'itemNumber',
label: '库位名称',
field: 'locationName',
sort: 'custom',
isSearch: true,
},
{
label: '库位编号',
field: 'locationNumber',
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: '入库类型',
field: 'type',
label: '归还人',
field: 'returner',
sort: 'custom',
isSearch: false,
form: {
component: 'Select'
},
},
// {
// label: '出库类型',
// field: 'type',
// sort: 'custom',
// isSearch: false,
// form: {
// component: 'Select'
// },
// },
{
label: '数量',
label: '归还数量',
field: 'qty',
sort: 'custom',
isSearch: false,
table: {
width: 110
},
form:{
component: 'InputNumber',
componentProps:{
min: 0,//最小值`
precision: 2//精度`
}
}
},
{
label: '操作',
field: 'action',
isForm: false,
isTable:false,
table: {
width: 150,
fixed: 'right'

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

@ -61,6 +61,7 @@
import download from '@/utils/download'
import { ItemOutLocation,ItemOutLocationRules } from './itemOutLocation.data'
import * as ItemOutLocationApi from '@/api/eam/item/itemOutLocation'
import * as ItemAccountsApi from '@/api/eam/item/itemAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
@ -77,12 +78,24 @@ routeName.value = route.name
const tableColumns = ref(ItemOutLocation.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
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(() => {
const setV = {}
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)
})
}
}
//

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

@ -1,50 +1,152 @@
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({
number: [required],
// number: [required],
itemNumber: [required],
qty: [required],
locationNumber: [required],
})
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: '出库编号',
field: 'number',
label: '库编号',
field: 'locationNumber',
sort: 'custom',
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: '库位名称',
field: 'locationName',
sort: 'custom',
isSearch: false,
isForm:false
},
{
label: '备件编号',
field: 'itemNumber',
sort: 'custom',
isSearch: true,
form:{
componentProps:{
disabled:true
}
}
},
{
label: '库位编号',
field: 'locationNumber',
label: '备件名称',
field: 'itemName',
sort: 'custom',
isSearch: true,
isSearch: false,
form:{
componentProps:{
disabled:true
}
}
},
{
label: '出库类型',
field: 'type',
label: '领用人',
field: 'receiver',
sort: 'custom',
isSearch: false,
form: {
component: 'Select'
},
},
// {
// label: '出库类型',
// field: 'type',
// sort: 'custom',
// isSearch: false,
// form: {
// component: 'Select'
// },
// },
{
label: '数量',
label: '出库数量',
field: 'qty',
sort: 'custom',
isSearch: false,
table: {
width: 110
},
form:{
component: 'InputNumber',
componentProps:{
min: 0,//最小值`
precision: 2//精度`
}
}
},
{
label: '操作',
field: 'action',
isForm: false,
isTable:false,
table: {
width: 150,
fixed: 'right'

Loading…
Cancel
Save