Browse Source

修改备件变更记录表的BUG

master
叶佳兴 4 weeks ago
parent
commit
e020578ac6
  1. 35
      src/views/eam/item/itemAccounts/index.vue
  2. 936
      src/views/eam/item/itemAccounts/itemAccounts.data.ts
  3. 25
      src/views/eam/item/itemAccountsChange/itemAccountsChange.data.ts

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

@ -312,11 +312,44 @@ const getItemWithOutBind = async () => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const openForm = (type: string, row?: any) => { const openForm = (type: string, row?: any) => {
console.log(type,"11111");
if(type == 'update'){
ItemAccounts.allSchemas.formSchema.forEach((item) => {
if (item.field == 'itemNumber') {
item.componentProps.isSearchList = false
item.componentProps.disabled = true
}
if (item.field == 'areaNumber') {
item.componentProps.isSearchList = false
item.componentProps.disabled = true
}
if (item.field == 'locationNumber') {
item.componentProps.isSearchList = false
item.componentProps.disabled = true
}
})
}else if(type == 'create'){
ItemAccounts.allSchemas.formSchema.forEach((item) => {
if (item.field == 'itemNumber') {
item.componentProps.isSearchList = true
item.componentProps.disabled = false
}
if (item.field == 'areaNumber') {
item.componentProps.isSearchList = true
item.componentProps.disabled = false
}
if (item.field == 'locationNumber') {
item.componentProps.isSearchList = true
item.componentProps.disabled = false
}
})
}
if (type == 'view') { if (type == 'view') {
showView.value = true showView.value = true
urls.value = row.filePathList urls.value = row.filePathList
viewKey.value += 1 viewKey.value += 1
} else { }
else{
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
} }

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

@ -12,529 +12,533 @@ export const ItemAccountsRules = reactive({
itemNumber: [required], itemNumber: [required],
areaNumber: [required], areaNumber: [required],
locationNumber: [required], locationNumber: [required],
concurrencyStamp: [required], concurrencyStamp: [required]
}) })
export const ItemAccounts = useCrudSchemas(reactive<CrudSchema[]>([ export const ItemAccounts = useCrudSchemas(
{ reactive<CrudSchema[]>([
label: '备件编号', {
field: 'itemNumber', label: '备件编号',
sort: 'custom', field: 'itemNumber',
isSearch: true, sort: 'custom',
table: { isSearch: true,
width: 180, table: {
fixed: 'left' width: 180,
}, fixed: 'left'
form: { },
componentProps: { form: {
isSearchList: true, // 开启查询弹窗 componentProps: {
searchListPlaceholder: '请选择备件', // 输入框占位文本 isSearchList: true, // 开启查询弹窗
searchField: 'number', // 查询弹窗赋值字段 searchListPlaceholder: '请选择备件', // 输入框占位文本
searchTitle: '备件', // 查询弹窗标题 searchField: 'number', // 查询弹窗赋值字段
searchAllSchemas: Item.allSchemas, // 查询弹窗所需类 searchTitle: '备件', // 查询弹窗标题
searchPage: ItemApi.getItemNotInAccountSenior, // 查询弹窗所需分页方法 searchAllSchemas: Item.allSchemas, // 查询弹窗所需类
searchCondition: [] searchPage: ItemApi.getItemNotInAccountSenior, // 查询弹窗所需分页方法
searchCondition: []
}
} }
}
},
{
label: '库区编号',
field: 'areaNumber',
sort: 'custom',
table: {
width: 110
}, },
form: { {
componentProps: { label: '库区编号',
isSearchList: true, // 开启查询弹窗 field: 'areaNumber',
searchListPlaceholder: '请选择备件', // 输入框占位文本 sort: 'custom',
searchField: 'number', // 查询弹窗赋值字段 table: {
searchTitle: '备件', // 查询弹窗标题 width: 110
searchAllSchemas: LocationArea.allSchemas, // 查询弹窗所需类 },
searchPage: LocationAreaApi.getLocationAreaPage, // 查询弹窗所需分页方法 form: {
searchCondition: [] componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件', // 输入框占位文本
searchField: 'number', // 查询弹窗赋值字段
searchTitle: '备件', // 查询弹窗标题
searchAllSchemas: LocationArea.allSchemas, // 查询弹窗所需类
searchPage: LocationAreaApi.getLocationAreaPage, // 查询弹窗所需分页方法
searchCondition: []
}
} }
}
},
{
label: '库位编号',
field: 'locationNumber',
sort: 'custom',
table: {
width: 110
}, },
form: { {
componentProps: { label: '库位编号',
isSearchList: true, // 开启查询弹窗 field: 'locationNumber',
searchListPlaceholder: '请选择备件', // 输入框占位文本 sort: 'custom',
searchField: 'number', // 查询弹窗赋值字段 table: {
searchTitle: '备件', // 查询弹窗标题 width: 110
searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 },
searchPage: LocationApi.getLocationNoInAccountPage, // 查询弹窗所需分页方法 form: {
searchCondition: [{ componentProps: {
key: 'areaNumber', isSearchList: true, // 开启查询弹窗
value: 'areaNumber', searchListPlaceholder: '请选择备件', // 输入框占位文本
message: '请选择库区编号!', searchField: 'number', // 查询弹窗赋值字段
isMainValue: true, // 拼接条件必须要 false 同时不能与 isMainValue: true 同用 // 前置添加必有,和isFormModel结合使用 searchTitle: '备件', // 查询弹窗标题
},{ searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
key: 'isInAccount', searchPage: LocationApi.getLocationNoInAccountPage, // 查询弹窗所需分页方法
value: 'isInAccountWill', searchCondition: [
message: '请选择备件编号!', {
isMainValue: true, // 拼接条件必须要 false 同时不能与 isMainValue: true 同用 // 前置添加必有,和isFormModel结合使用 key: 'areaNumber',
}, value: 'areaNumber',
{ message: '请选择库区编号!',
key: 'isInAccount', isMainValue: true // 拼接条件必须要 false 同时不能与 isMainValue: true 同用 // 前置添加必有,和isFormModel结合使用
value: "ALL", },
isMainValue: false {
}, ] key: 'itemNumber',
value: 'itemNumber',
message: '请选择备件编号!',
isMainValue: true // 拼接条件必须要 false 同时不能与 isMainValue: true 同用 // 前置添加必有,和isFormModel结合使用
},
{
key: 'isInAccount',
value: 'ALL',
isMainValue: false
}
]
}
} }
}
},
{
label: '是否账内预期值',
field: 'isInAccountWill',
sort: 'custom',
isDetail: false,
isForm: false,
isSearch: false,
isTable: false,
isTableForm: false,
},
{
label: '备件名称',
field: 'name',
sort: 'custom',
isForm: false,
table: {
width: 110
}, },
isSearch: false, {
}, label: '是否账内预期值',
{ field: 'isInAccountWill',
label: '规格', sort: 'custom',
field: 'specifications', isDetail: false,
sort: 'custom', isForm: false,
isForm: true, isSearch: false,
form: { isTable: false,
componentProps: { isTableForm: false
disabled: true },
{
label: '备件名称',
field: 'name',
sort: 'custom',
isForm: false,
table: {
width: 110
},
isSearch: false
},
{
label: '规格',
field: 'specifications',
sort: 'custom',
isForm: true,
form: {
componentProps: {
disabled: true
}
} }
}, },
}, {
{ label: '(账内或账外)库存数量',
label: '(账内或账外)库存数量', field: 'qty',
field: 'qty', sort: 'custom',
sort: 'custom', table: {
table: { width: 110
width: 110
},
},
{
label: '库存总数',
field: 'totalStockQty',
sort: 'custom',
table: {
width: 150
},
isForm: false,
},
{
label: '已申请库存数量',
field: 'requestQty',
sort: 'custom',
table: {
width: 150
},
isForm: false,
},
{
label: '可申请库存数量',
field: 'availableQty',
sort: 'custom',
table: {
width: 150
},
isForm: false,
},
{
label: '单价',
field: 'singlePrice',
sort: 'custom',
isForm: true,
form: {
componentProps: {
disabled: true
} }
}, },
}, {
{ label: '库存总数',
label: '总价', field: 'totalStockQty',
field: 'totalPrice', sort: 'custom',
sort: 'custom', table: {
isForm: false, width: 150
}, },
{ isForm: false
label: '是否账内库', },
field: 'isInAccount', {
dictType: DICT_TYPE.TRUE_FALSE, label: '已申请库存数量',
dictClass: 'string', field: 'requestQty',
isSearch: false, sort: 'custom',
isTable: true, table: {
sort: 'custom', width: 150
table: { },
width: 130 isForm: false
}, },
tableForm: { {
type: 'Select', label: '可申请库存数量',
inactiveValue: 'FALSE', field: 'availableQty',
disabled: true sort: 'custom',
table: {
width: 150
},
isForm: false
},
{
label: '单价',
field: 'singlePrice',
sort: 'custom',
isForm: true,
form: {
componentProps: {
disabled: true
}
}
}, },
form: { {
component: 'Switch', label: '总价',
value: 'TRUE', field: 'totalPrice',
componentProps: { sort: 'custom',
isForm: false
},
{
label: '是否账内库',
field: 'isInAccount',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isTable: true,
sort: 'custom',
table: {
width: 130
},
tableForm: {
type: 'Select',
inactiveValue: 'FALSE', inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
} }
}
},
{
label: '是否常储',
field: 'isConstant',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isTable: true,
sort: 'custom',
table: {
width: 110,
}, },
tableForm: {
type: 'Select', {
inactiveValue: 'FALSE', label: '是否常储',
disabled: true field: 'isConstant',
}, dictType: DICT_TYPE.TRUE_FALSE,
form: { dictClass: 'string',
component: 'Switch', isSearch: false,
value: 'TRUE', isTable: true,
componentProps: { sort: 'custom',
table: {
width: 110
},
tableForm: {
type: 'Select',
inactiveValue: 'FALSE', inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
} }
}
},
{
label: '科目',
field: 'subject',
sort: 'custom',
dictType: DICT_TYPE.ITEM_SUBJECT,
dictClass: 'string',
isSearch: false,
isTable: true,
tableForm: {
type: 'Select'
}, },
isForm: true, {
form: { label: '科目',
componentProps: { field: 'subject',
disabled: true sort: 'custom',
dictType: DICT_TYPE.ITEM_SUBJECT,
dictClass: 'string',
isSearch: false,
isTable: true,
tableForm: {
type: 'Select'
},
isForm: true,
form: {
componentProps: {
disabled: true
}
} }
}, },
},
{ {
label: '科目代码', label: '科目代码',
field: 'subjectCode', field: 'subjectCode',
sort: 'custom', sort: 'custom',
isTable: true, isTable: true,
isForm: true, isForm: true,
form: { form: {
componentProps: { componentProps: {
disabled: true disabled: true
}
} }
}, },
}, {
{ label: '单位',
label: '单位', field: 'uom',
field: 'uom', sort: 'custom',
sort: 'custom', dictType: DICT_TYPE.UOM,
dictType: DICT_TYPE.UOM, dictClass: 'string',
dictClass: 'string', isSearch: false,
isSearch: false, isTable: true,
isTable: true, tableForm: {
tableForm: { type: 'Select'
type: 'Select' },
}, isForm: true,
isForm: true, form: {
form: { componentProps: {
componentProps: { disabled: true
disabled: true }
} }
}, },
}, {
{ label: '类别',
label: '类别', field: 'category',
field: 'category', sort: 'custom',
sort: 'custom', dictType: DICT_TYPE.ITEM_CATEGORY,
dictType: DICT_TYPE.ITEM_CATEGORY, dictClass: 'string',
dictClass: 'string', isSearch: false,
isSearch: false, isTable: true,
isTable: true, tableForm: {
tableForm: { type: 'Select'
type: 'Select' },
}, isForm: true,
isForm: true, form: {
form: { componentProps: {
componentProps: { disabled: true
disabled: true }
} }
}, },
}, {
{ label: '备件分类',
label: '备件分类', field: 'classification',
field: 'classification', sort: 'custom',
sort: 'custom', dictType: DICT_TYPE.CLASSIFICATION,
dictType: DICT_TYPE.CLASSIFICATION, dictClass: 'string',
dictClass: 'string', isSearch: false,
isSearch: false, isTable: true,
isTable: true, tableForm: {
tableForm: { type: 'Select'
type: 'Select' },
}, isForm: true,
isForm: true, form: {
form: { componentProps: {
componentProps: { disabled: true
disabled: true }
} }
}, },
}, {
{ label: '区域',
label: '区域', field: 'region',
field: 'region', sort: 'custom',
sort: 'custom', dictType: DICT_TYPE.ITEM_REGION,
dictType: DICT_TYPE.ITEM_REGION, dictClass: 'string',
dictClass: 'string', isSearch: false,
isSearch: false, isTable: true,
isTable: true, tableForm: {
tableForm: { type: 'Select'
type: 'Select' },
}, isForm: true,
isForm: true, form: {
form: { componentProps: {
componentProps: { disabled: true
disabled: true }
} }
}, },
}, // {
// { // label: '单价',
// label: '单价', // field: 'singlePrice',
// field: 'singlePrice', // sort: 'custom',
// sort: 'custom', // },
// }, {
{ label: '重采购点',
label: '重采购点', field: 'reprocurement',
field: 'reprocurement', sort: 'custom',
sort: 'custom', table: {
table: { width: 110
width: 110, },
}, isForm: true,
isForm: true, form: {
form: { componentProps: {
componentProps: { disabled: true
disabled: true }
} }
}, },
}, {
{ label: '安全库存',
label: '安全库存', field: 'safetyStock',
field: 'safetyStock', sort: 'custom',
sort: 'custom', isForm: true,
isForm: true, table: {
table: { width: 110
width: 110, },
}, form: {
form: { component: 'InputNumber',
component: 'InputNumber', value: 0,
value: 0, componentProps: {
componentProps: { disabled: true
disabled: true }
} }
}, },
}, {
{ label: '成本中心',
label: '成本中心', field: 'cost',
field: 'cost', sort: 'custom',
sort: 'custom', table: {
table: { width: 110
width: 110, },
}, isForm: true,
isForm: true, form: {
form: { componentProps: {
componentProps: { disabled: true
disabled: true }
} }
}, },
}, {
{ label: '采购员',
label: '采购员', field: 'purchaser',
field: 'purchaser', sort: 'custom',
sort: 'custom', table: {
table: { width: 100
width: 100, },
}, isForm: true,
isForm: true, form: {
form: { componentProps: {
componentProps: { disabled: true
disabled: true }
} }
}, },
}, {
{ label: '财务',
label: '财务', field: 'financer',
field: 'financer', sort: 'custom',
sort: 'custom', isForm: true,
isForm: true, form: {
form: { componentProps: {
componentProps: { disabled: true
disabled: true }
} }
}, },
}, {
{ label: '是否以旧换新',
label: '是否以旧换新', field: 'isRadeIn',
field: 'isRadeIn', dictType: DICT_TYPE.TRUE_FALSE,
dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string',
dictClass: 'string', isSearch: false,
isSearch: false, isTable: true,
isTable: true, sort: 'custom',
sort: 'custom', table: {
table: { width: 140
width: 140 },
}, tableForm: {
tableForm: { type: 'Select',
type: 'Select',
inactiveValue: 'FALSE',
disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE', inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
} }
}
},
{
label: '采购时间',
field: 'purchaseTime',
sort: 'custom',
formatter: dateFormatter,
table: {
width: 150
}, },
isForm: false, {
}, label: '采购时间',
{ field: 'purchaseTime',
label: '批次', sort: 'custom',
field: 'batch', formatter: dateFormatter,
sort: 'custom', table: {
isTable: true, width: 150
isForm: true, },
form: { isForm: false
componentProps: { },
disabled: true {
label: '批次',
field: 'batch',
sort: 'custom',
isTable: true,
isForm: true,
form: {
componentProps: {
disabled: true
}
} }
}, },
}, {
{ label: '库龄',
label: '库龄', field: 'areaAge',
field: 'areaAge', sort: 'custom',
sort: 'custom', formatter: (row: Recordable, column: TableColumn, cellValue: any) => {
formatter: (row: Recordable, column: TableColumn, cellValue: any) => { if (!row.batchDate) {
if (!row.batchDate) { return '未知' // 如果 purchaseTime 为 null 或 undefined,返回 '未知'
return '未知'; // 如果 purchaseTime 为 null 或 undefined,返回 '未知' }
}
const purchaseTime = new Date(row.batchDate); // 获取采购时间 const purchaseTime = new Date(row.batchDate) // 获取采购时间
if (isNaN(purchaseTime.getTime())) { if (isNaN(purchaseTime.getTime())) {
return '未知'; // 如果 purchaseTime 不是有效日期,返回 '未知' return '未知' // 如果 purchaseTime 不是有效日期,返回 '未知'
} }
const currentTime = new Date(); // 当前时间 const currentTime = new Date() // 当前时间
const ageInMilliseconds = currentTime.getTime() - purchaseTime.getTime(); // 时间差(毫秒) const ageInMilliseconds = currentTime.getTime() - purchaseTime.getTime() // 时间差(毫秒)
const ageInDays = Math.floor(ageInMilliseconds / (1000 * 60 * 60 * 24)); // 转换为天数 const ageInDays = Math.floor(ageInMilliseconds / (1000 * 60 * 60 * 24)) // 转换为天数
return `${ageInDays}`; // 返回计算结果 return `${ageInDays}` // 返回计算结果
}, },
isForm: false, isForm: false,
table: { table: {
width: 150 width: 150
}, }
},
{
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', label: '是否框架协议',
value: 'TRUE', field: 'isFramework',
componentProps: { dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isTable: true,
sort: 'custom',
table: {
width: 140
},
tableForm: {
type: 'Select',
inactiveValue: 'FALSE', inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
} }
}
},
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isTable: true,
sort: 'custom',
table: {
width: 150
}, },
tableForm: { {
type: 'Select', label: '是否可用',
inactiveValue: 'FALSE', field: 'available',
disabled: true dictType: DICT_TYPE.TRUE_FALSE,
}, dictClass: 'string',
form: { isSearch: false,
component: 'Switch', isTable: true,
value: 'TRUE', sort: 'custom',
componentProps: { table: {
width: 150
},
tableForm: {
type: 'Select',
inactiveValue: 'FALSE', inactiveValue: 'FALSE',
activeValue: 'TRUE' disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
isForm: false
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
} }
},
isForm: false
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
} }
} ])
])) )

25
src/views/eam/item/itemAccountsChange/itemAccountsChange.data.ts

@ -146,13 +146,29 @@ export const ItemAccountsChange = useCrudSchemas(
sort: 'custom', sort: 'custom',
isSearch: false isSearch: false
}, },
{ {
label: '操作时间', label: '操作时间',
field: 'createTime', field: 'createTime',
sort: 'custom',
formatter: dateFormatter, formatter: dateFormatter,
isSearch: false, detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
isTable: true,
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
},
isForm: false,
isSearch: true,
search: { search: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
@ -160,8 +176,7 @@ export const ItemAccountsChange = useCrudSchemas(
type: 'daterange', type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
} }
}, }
isForm: false
}, },
// { // {
// label: '操作', // label: '操作',

Loading…
Cancel
Save