Browse Source

备件台账

master
songguoqiang 7 months ago
parent
commit
0fde0a150a
  1. 7
      src/api/eam/item/itemAccounts/index.ts
  2. 4
      src/locales/en-US.ts
  3. 2
      src/locales/zh-CN.ts
  4. 3
      src/utils/dict.ts
  5. 26
      src/utils/disposition/defaultButtons.ts
  6. 56
      src/views/eam/item/itemAccounts/index.vue
  7. 510
      src/views/eam/item/itemAccounts/itemAccounts.data.ts
  8. 175
      src/views/eam/item/itemAccounts/itemIn.data.ts

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

@ -8,6 +8,8 @@ export interface ItemAccountsVO {
siteId: string
available: string
concurrencyStamp: number
type: string
display?:boolean
}
// 查询备件台账列表
@ -31,6 +33,11 @@ export const createItemAccounts = async (data: ItemAccountsVO) => {
return await request.post({ url: `/eam/item-accounts/create`, data })
}
// 备件台账新到货转账内
export const newTurnIn = async (data: ItemAccountsVO) => {
return await request.post({ url: `/eam/item-accounts/newTurnIn`, data })
}
// 修改备件台账
export const updateItemAccounts = async (data: ItemAccountsVO) => {
return await request.put({ url: `/eam/item-accounts/update`, data })

4
src/locales/en-US.ts

@ -311,7 +311,9 @@ export default {
typeUpdate: 'Dict Type Eidt',
dataCreate: 'Dict Data Create',
dataUpdate: 'Dict Data Eidt',
fileUpload: 'File Upload'
fileUpload: 'File Upload',
itemIn: 'itemIn',
newTurnIn: 'newTurnIn',
},
dialog: {
dialog: 'Dialog',

2
src/locales/zh-CN.ts

@ -324,6 +324,8 @@ export default {
disAgree: '驳回',
selectItem: '选择备件',
qrCode: '二维码',
itemIn: '入库',
newTurnIn: '新到货转账内',
},

3
src/utils/dict.ts

@ -306,6 +306,7 @@ export enum DICT_TYPE {
ORDER_COMPLETE_RESULT = 'order_complete_result', //维修工单完成结果
FACTORY_TYPE = 'factory_type',//厂区类别
EQUIPMENT_INDEX_NAME = 'equipment_index_name',//设备年度目标指标名称分类字段
SPECIAL_DEPT_ROLE = 'special_dept_role'
SPECIAL_DEPT_ROLE = 'special_dept_role',
ITEM_ACCOUNT_LOCATION_TYPE = "item_account_location_type",
}

26
src/utils/disposition/defaultButtons.ts

@ -1078,6 +1078,32 @@ export function orderPrintBtn(option:any) {
})
}
// 头部入库按钮
export function ItemInBtn(option:any) {
return __defaultBtnOption(option,{
label: '入库',
name: 'itemIn',
hide: false,
type: 'primary',
icon: 'ep:plus',
color: '',
hasPermi: ''
})
}
// 操作列表-到货转账内
export function newTurnIn(option:any) {
return __defaultBtnOption(option,{
label: '到货转账内',
name: 'newTurnIn',
hide: false,
type: 'primary',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 默认按钮规则
function __defaultBtnOption(option:any,specific:any){

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

@ -20,7 +20,7 @@
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
@ -30,6 +30,10 @@
:formAllSchemas="ItemAccounts.allSchemas" :apiUpdate="ItemAccountsApi.updateItemAccounts"
:apiCreate="ItemAccountsApi.createItemAccounts" @searchTableSuccess="searchTableSuccess" :isBusiness="false" />
<BasicForm ref="basicFormRef1" @success="formsSuccess" :rules="ItemInRules"
:formAllSchemas="ItemIn.allSchemas" :apiUpdate="ItemAccountsApi.updateItemAccounts"
:apiCreate="ItemAccountsApi.createItemAccounts" @searchTableSuccess="searchTableSuccess" :isBusiness="false" />
<SearchTable ref="searchTableRef" @searchTableSuccess="submitItem" />
<!-- 详情 -->
@ -43,6 +47,7 @@
<script setup lang="ts">
import download from '@/utils/download'
import { ItemAccounts, ItemAccountsRules } from './itemAccounts.data'
import { ItemIn, ItemInRules } from './itemIn.data'
import * as ItemAccountsApi from '@/api/eam/item/itemAccounts'
import { Item } from '@/views/eam/basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
@ -63,10 +68,11 @@
const tableColumns = ref(ItemAccounts.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
const searchTableSuccess = (formField, searchField, val, formRef) => {//
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
setV['itemName'] = val[0]['name']
formRef.setValues(setV)
})
}
@ -86,6 +92,7 @@
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({ hasPermi: 'item:itemAccounts:create' }), //
//defaultButtons.ItemInBtn({ hasPermi: 'item:itemAccounts:createIn' }), //
defaultButtons.defaultImportBtn({ hasPermi: 'item:itemAccounts:import' }), //
defaultButtons.defaultExportBtn({ hasPermi: 'item:itemAccounts:export' }), //
defaultButtons.defaultFreshBtn(null), //
@ -112,17 +119,20 @@
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
} else if(val=='itemIn'){ //
openForm('itemIn')
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({ hasPermi: 'item:itemAccounts:update' }), //
defaultButtons.replaceLocation({ hasPermi: 'item:itemAccounts:replaceLocation' }), //
defaultButtons.mainListDeleteBtn({ hasPermi: 'item:itemAccounts:delete' }), //
const butttondata =(row)=>{
return [
//defaultButtons.mainListEditBtn({ hasPermi: 'item:itemAccounts:update' }), //
defaultButtons.replaceLocation({ hasPermi: 'item:itemAccounts:replaceLocation',hide:!(row.display)}), //
defaultButtons.newTurnIn({ hasPermi: 'item:itemAccounts:newTurnIn',hide:!(row.type=='2'&& row.qty>0)}), //
//defaultButtons.mainListDeleteBtn({ hasPermi: 'item:itemAccounts:delete' }), //
]
}
// -
const buttonTableClick = async (val, row) => {
@ -130,8 +140,10 @@
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'replaceLocation') {
} else if (val == 'replaceLocation') {//
openItem(row.locationNumber, row.id)
}else if (val == 'newTurnIn') {//
openForm('newTurnIn', row);
}
}
@ -193,8 +205,21 @@
/** 添加/修改操作 */
const basicFormRef = ref()
const basicFormRef1 = ref();
const openForm = (type : string, row ?: any) => {
basicFormRef.value.open(type, row)
//debugger
// if(type=='itemIn'){
// row?.type = null;
// row?.itemName=null;
// }
if(type=='newTurnIn'){//
//
ItemIn.allSchemas.formSchema.find(item => item.field == 'qty').componentProps.max = row.qty//
basicFormRef1.value.open(type, row)
}else{
basicFormRef.value.open(type, row)
}
}
// form
@ -210,14 +235,21 @@
}
if (data.activeTime == 0) data.activeTime = null;
if (data.expireTime == 0) data.expireTime = null;
if (formType === 'create') {
try{
if (formType === 'create') {
await ItemAccountsApi.createItemAccounts(data)
message.success(t('common.createSuccess'))
} if (formType === 'newTurnIn') {//
await ItemAccountsApi.newTurnIn(data)
message.success(t('common.createSuccess'))
} else {
await ItemAccountsApi.updateItemAccounts(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
}finally{
basicFormRef.value.dialogVisible = false
basicFormRef1.value.dialogVisible = false
}
getList()
}

510
src/views/eam/item/itemAccounts/itemAccounts.data.ts

@ -1,312 +1,236 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
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'
import * as ItemApi from '@/api/eam/basic/item'
import { Item } from '@/views/eam/basic/item/item.data'
import { getStrDictOptions } from '@/utils/dict'
const typeList = getStrDictOptions(DICT_TYPE.ITEM_ACCOUNT_LOCATION_TYPE).filter(item => item.value != '1')
const typeLists = getStrDictOptions(DICT_TYPE.ITEM_ACCOUNT_LOCATION_TYPE)
// 表单校验
export const ItemAccountsRules = reactive({
itemNumber: [required],
name: [required],
areaNumber: [required],
concurrencyStamp: [required],
type: [required],
locationNumber: [required],
qty: [required]
})
export const ItemAccounts = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '备件编号',
field: 'itemNumber',
sort: 'custom',
isSearch: true,
table: {
width: 180,
fixed: 'left'
},
},
{
label: '备件名称',
field: 'name',
sort: 'custom',
table: {
width: 110
},
isSearch: false,
},
{
label: '库位编号',
field: 'locationNumber',
sort: 'custom',
table: {
width: 110
},
},
{
label: '库区编号',
field: 'areaNumber',
sort: 'custom',
table: {
width: 110
},
},
{
label: '库存数量',
field: 'qty',
sort: 'custom',
table: {
width: 110
},
},
{
label: '是否账内库',
field: 'isInAccount',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isTable: true,
sort: 'custom',
table: {
width: 130
},
tableForm: {
type: 'Select',
inactiveValue: 'FALSE',
disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
export const ItemAccounts = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '备件编号',
field: 'itemNumber',
sort: 'custom',
isSearch: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件编号', // 输入框占位文本
searchField: 'number', // 查询弹窗赋值字段
searchTitle: '备件信息', // 查询弹窗标题
searchAllSchemas: Item.allSchemas, // 查询弹窗所需类
searchPage: ItemApi.getItemPage, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
]
}
}
}
},
{
label: '规格',
field: 'specifications',
sort: 'custom',
},
{
label: '是否常储',
field: 'isConstant',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isTable: true,
sort: 'custom',
table: {
width: 110,
},
tableForm: {
type: 'Select',
inactiveValue: 'FALSE',
disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
{
label: '备件名称',
field: 'itemName',
sort: 'custom',
table: {
width: 110
},
form:{
componentProps:{
disabled:true
}
},
isSearch: 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: 'subject',
sort: 'custom',
dictType: DICT_TYPE.ITEM_SUBJECT,
dictClass: 'string',
isSearch: false,
isTable: true,
tableForm: {
type: 'Select'
}
},
{
label: '科目代码',
field: 'subjectCode',
sort: 'custom',
isTable: true,
},
{
label: '单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: false,
isTable: true,
tableForm: {
type: 'Select'
}
},
{
label: '类别',
field: 'category',
sort: 'custom',
dictType: DICT_TYPE.ITEM_CATEGORY,
dictClass: 'string',
isSearch: false,
isTable: true,
tableForm: {
type: 'Select'
}
},
{
label: '备件分类',
field: 'classification',
sort: 'custom',
dictType: DICT_TYPE.CLASSIFICATION,
dictClass: 'string',
isSearch: false,
isTable: true,
tableForm: {
type: 'Select'
}
},
{
label: '区域',
field: 'region',
sort: 'custom',
dictType: DICT_TYPE.ITEM_REGION,
dictClass: 'string',
isSearch: false,
isTable: true,
tableForm: {
type: 'Select'
}
},
// {
// label: '单价',
// field: 'singlePrice',
// sort: 'custom',
// },
{
label: '重采购点',
field: 'reprocurement',
sort: 'custom',
table: {
width: 110,
},
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '安全库存',
field: 'safetyStock',
sort: 'custom',
table: {
width: 110,
},
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '成本中心',
field: 'cost',
sort: 'custom',
table: {
width: 110,
},
},
{
label: '采购员',
field: 'purchaser',
sort: 'custom',
table: {
width: 100,
},
},
{
label: '财务',
field: 'financer',
sort: 'custom',
},
{
label: '是否以旧换新',
field: 'isRadeIn',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isTable: true,
sort: 'custom',
table: {
width: 140
},
tableForm: {
type: 'Select',
inactiveValue: 'FALSE',
disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
{
label: '库区名称',
field: 'areaName',
sort: 'custom',
isSearch: false,
isForm:false
},
{
label: '库位编号',
field: 'locationNumber',
sort: 'custom',
isSearch: false,
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: 'isFramework',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isTable: true,
sort: 'custom',
table: {
width: 140
},
tableForm: {
type: 'Select',
inactiveValue: 'FALSE',
disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
{
label: '库位名称',
field: 'locationName',
sort: 'custom',
isSearch: false,
isForm:false
},
// {
// label: '库位类型',
// field: 'type',
// dictType: DICT_TYPE.ITEM_ACCOUNT_LOCATION_TYPE,
// dictClass: 'string',
// isSearch: true,
// isTable: true,
// sort: 'custom',
// table: {
// width: 130
// },
// form: {
// component: 'Select'
// }
// },
{
label: '库位类型',
field: 'type',
sort: 'custom',
table: {
width: '150',
},
isDetail: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return typeLists.find((account) => account.value == cellValue)?.label
},
// dictType: DICT_TYPE.APP_DEVICE_MOLD_TYPE,
isSearch: false,
search: {
component: 'Select',
componentProps: {
options: typeList,
optionsAlias: {
labelField: 'label',
valueField: 'value'
},
filterable: true,
},
},
form: {
component: 'Select',
componentProps: {
options: typeList,
optionsAlias: {
labelField: 'label',
valueField: 'value'
},
//disabled: true,
//filterable: true,
placeholder: "请选择类型"
}
},
},
// {
// label: '库位类型',
// field: 'type',
// dictType: DICT_TYPE.ITEM_ACCOUNT_LOCATION_TYPE,
// dictClass: 'string',
// isSearch: true,
// isTable: true,
// sort: 'custom',
// table: {
// width: 130
// },
// form: {
// component: 'Select'
// }
// },
{
label: '库存数量',
field: 'qty',
sort: 'custom',
table: {
width: 110
},
form:{
component: 'InputNumber',
componentProps:{
min: 0,//最小值`
precision: 2//精度`
}
}
}
},
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isTable: true,
sort: 'custom',
table: {
width: 150
},
tableForm: {
type: 'Select',
inactiveValue: 'FALSE',
disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
// {
// label: '是否账内库',
// field: 'isInAccount',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string',
// isSearch: false,
// isTable: true,
// sort: 'custom',
// table: {
// width: 130
// },
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 250,
fixed: 'right'
}
}
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
])
)

175
src/views/eam/item/itemAccounts/itemIn.data.ts

@ -0,0 +1,175 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
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'
import * as ItemApi from '@/api/eam/basic/item'
import { Item } from '@/views/eam/basic/item/item.data'
import { getStrDictOptions } from '@/utils/dict'
const typeList = getStrDictOptions(DICT_TYPE.ITEM_ACCOUNT_LOCATION_TYPE).filter(item => item.value != '1')
//const typeList = getStrDictOptions(DICT_TYPE.ITEM_ACCOUNT_LOCATION_TYPE)
// 表单校验
export const ItemInRules = reactive({
// itemNumber: [required],
// name: [required],
// areaNumber: [required],
// type: [required],
// locationNumber: [required],
qty: [required]
})
export const ItemIn = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '备件编号',
field: 'itemNumber',
sort: 'custom',
form:{
componentProps:{
disabled:true
}
}
},
{
label: '备件名称',
field: 'itemName',
sort: 'custom',
table: {
width: 110
},
form:{
componentProps:{
disabled:true
}
},
},
{
label: '库区编号',
field: 'areaNumber',
sort: 'custom',
form:{
componentProps:{
disabled:true
}
},
},{
label: '库位编号',
field: 'locationNumber',
sort: 'custom',
form:{
componentProps:{
disabled:true
}
},
},
// {
// label: '库位类型',
// field: 'type',
// dictType: DICT_TYPE.ITEM_ACCOUNT_LOCATION_TYPE,
// dictClass: 'string',
// isSearch: true,
// isTable: true,
// sort: 'custom',
// table: {
// width: 130
// },
// form: {
// component: 'Select'
// }
// },
// {
// label: '库位类型',
// field: 'type',
// sort: 'custom',
// table: {
// width: '150',
// },
// isDetail: false,
// formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
// return typeList.find((account) => account.value == cellValue)?.label
// },
// // dictType: DICT_TYPE.APP_DEVICE_MOLD_TYPE,
// isSearch: false,
// search: {
// component: 'Select',
// componentProps: {
// options: typeList,
// optionsAlias: {
// labelField: 'label',
// valueField: 'value'
// },
// filterable: true,
// },
// },
// form: {
// component: 'Select',
// componentProps: {
// options: typeList,
// optionsAlias: {
// labelField: 'label',
// valueField: 'value'
// },
// //disabled: true,
// //filterable: true,
// placeholder: "请选择类型"
// }
// },
// },
// {
// label: '库位类型',
// field: 'type',
// dictType: DICT_TYPE.ITEM_ACCOUNT_LOCATION_TYPE,
// dictClass: 'string',
// isSearch: true,
// isTable: true,
// sort: 'custom',
// table: {
// width: 130
// },
// form: {
// component: 'Select'
// }
// },
{
label: '库存数量',
field: 'qty',
sort: 'custom',
table: {
width: 110
},
form:{
component: 'InputNumber',
componentProps:{
min: 0,//最小值`
precision: 2//精度`
}
}
},
// {
// label: '是否账内库',
// field: 'isInAccount',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string',
// isSearch: false,
// isTable: true,
// sort: 'custom',
// table: {
// width: 130
// },
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
])
)
Loading…
Cancel
Save