diff --git a/src/views/eam/item/itemAccounts/index.vue b/src/views/eam/item/itemAccounts/index.vue index 5ce2318..d2fe18c 100644 --- a/src/views/eam/item/itemAccounts/index.vue +++ b/src/views/eam/item/itemAccounts/index.vue @@ -312,11 +312,44 @@ const getItemWithOutBind = async () => { /** 添加/修改操作 */ const basicFormRef = ref() 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') { showView.value = true urls.value = row.filePathList viewKey.value += 1 - } else { + } + else{ basicFormRef.value.open(type, row) } } diff --git a/src/views/eam/item/itemAccounts/itemAccounts.data.ts b/src/views/eam/item/itemAccounts/itemAccounts.data.ts index 8a99d43..2f74467 100644 --- a/src/views/eam/item/itemAccounts/itemAccounts.data.ts +++ b/src/views/eam/item/itemAccounts/itemAccounts.data.ts @@ -12,529 +12,533 @@ export const ItemAccountsRules = reactive({ itemNumber: [required], areaNumber: [required], locationNumber: [required], - concurrencyStamp: [required], + concurrencyStamp: [required] }) -export const ItemAccounts = useCrudSchemas(reactive([ - { - label: '备件编号', - field: 'itemNumber', - sort: 'custom', - isSearch: true, - table: { - width: 180, - fixed: 'left' - }, - form: { - componentProps: { - isSearchList: true, // 开启查询弹窗 - searchListPlaceholder: '请选择备件', // 输入框占位文本 - searchField: 'number', // 查询弹窗赋值字段 - searchTitle: '备件', // 查询弹窗标题 - searchAllSchemas: Item.allSchemas, // 查询弹窗所需类 - searchPage: ItemApi.getItemNotInAccountSenior, // 查询弹窗所需分页方法 - searchCondition: [] +export const ItemAccounts = useCrudSchemas( + reactive([ + { + label: '备件编号', + field: 'itemNumber', + sort: 'custom', + isSearch: true, + table: { + width: 180, + fixed: 'left' + }, + form: { + componentProps: { + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择备件', // 输入框占位文本 + searchField: 'number', // 查询弹窗赋值字段 + searchTitle: '备件', // 查询弹窗标题 + searchAllSchemas: Item.allSchemas, // 查询弹窗所需类 + searchPage: ItemApi.getItemNotInAccountSenior, // 查询弹窗所需分页方法 + searchCondition: [] + } } - } - }, - { - label: '库区编号', - field: 'areaNumber', - sort: 'custom', - table: { - width: 110 }, - form: { - componentProps: { - isSearchList: true, // 开启查询弹窗 - searchListPlaceholder: '请选择备件', // 输入框占位文本 - searchField: 'number', // 查询弹窗赋值字段 - searchTitle: '备件', // 查询弹窗标题 - searchAllSchemas: LocationArea.allSchemas, // 查询弹窗所需类 - searchPage: LocationAreaApi.getLocationAreaPage, // 查询弹窗所需分页方法 - searchCondition: [] + { + label: '库区编号', + field: 'areaNumber', + sort: 'custom', + table: { + width: 110 + }, + form: { + componentProps: { + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择备件', // 输入框占位文本 + searchField: 'number', // 查询弹窗赋值字段 + searchTitle: '备件', // 查询弹窗标题 + searchAllSchemas: LocationArea.allSchemas, // 查询弹窗所需类 + searchPage: LocationAreaApi.getLocationAreaPage, // 查询弹窗所需分页方法 + searchCondition: [] + } } - } - }, - { - label: '库位编号', - field: 'locationNumber', - sort: 'custom', - table: { - width: 110 }, - form: { - componentProps: { - isSearchList: true, // 开启查询弹窗 - searchListPlaceholder: '请选择备件', // 输入框占位文本 - searchField: 'number', // 查询弹窗赋值字段 - searchTitle: '备件', // 查询弹窗标题 - searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 - searchPage: LocationApi.getLocationNoInAccountPage, // 查询弹窗所需分页方法 - searchCondition: [{ - key: 'areaNumber', - value: 'areaNumber', - message: '请选择库区编号!', - isMainValue: true, // 拼接条件必须要 false 同时不能与 isMainValue: true 同用 // 前置添加必有,和isFormModel结合使用 - },{ - key: 'isInAccount', - value: 'isInAccountWill', - message: '请选择备件编号!', - isMainValue: true, // 拼接条件必须要 false 同时不能与 isMainValue: true 同用 // 前置添加必有,和isFormModel结合使用 - }, - { - key: 'isInAccount', - value: "ALL", - isMainValue: false - }, ] + { + label: '库位编号', + field: 'locationNumber', + sort: 'custom', + table: { + width: 110 + }, + form: { + componentProps: { + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择备件', // 输入框占位文本 + searchField: 'number', // 查询弹窗赋值字段 + searchTitle: '备件', // 查询弹窗标题 + searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 + searchPage: LocationApi.getLocationNoInAccountPage, // 查询弹窗所需分页方法 + searchCondition: [ + { + key: 'areaNumber', + value: 'areaNumber', + message: '请选择库区编号!', + isMainValue: true // 拼接条件必须要 false 同时不能与 isMainValue: true 同用 // 前置添加必有,和isFormModel结合使用 + }, + { + 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: 'specifications', - sort: 'custom', - isForm: true, - form: { - componentProps: { - disabled: true + { + 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: 'specifications', + sort: 'custom', + isForm: true, + form: { + componentProps: { + disabled: true + } } }, - }, - { - label: '(账内或账外)库存数量', - field: 'qty', - sort: 'custom', - table: { - 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: '(账内或账外)库存数量', + field: 'qty', + sort: 'custom', + table: { + width: 110 } }, - }, - { - label: '总价', - field: 'totalPrice', - 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', - disabled: true + { + 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 + } + } }, - form: { - component: 'Switch', - value: 'TRUE', - componentProps: { + { + label: '总价', + field: 'totalPrice', + 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', - activeValue: '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', - disabled: true }, - form: { - component: 'Switch', - value: 'TRUE', - componentProps: { + + { + label: '是否常储', + field: 'isConstant', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + isSearch: false, + isTable: true, + sort: 'custom', + table: { + width: 110 + }, + tableForm: { + type: 'Select', inactiveValue: 'FALSE', - activeValue: '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: { - componentProps: { - disabled: true + { + label: '科目', + field: 'subject', + sort: 'custom', + dictType: DICT_TYPE.ITEM_SUBJECT, + dictClass: 'string', + isSearch: false, + isTable: true, + tableForm: { + type: 'Select' + }, + isForm: true, + form: { + componentProps: { + disabled: true + } } }, - }, - { - label: '科目代码', - field: 'subjectCode', - sort: 'custom', - isTable: true, - isForm: true, - form: { - componentProps: { - disabled: true + { + label: '科目代码', + field: 'subjectCode', + sort: 'custom', + isTable: true, + isForm: true, + form: { + componentProps: { + disabled: true + } } }, - }, - { - label: '单位', - field: 'uom', - sort: 'custom', - dictType: DICT_TYPE.UOM, - dictClass: 'string', - isSearch: false, - isTable: true, - tableForm: { - type: 'Select' - }, - isForm: true, - form: { - componentProps: { - disabled: true + { + label: '单位', + field: 'uom', + sort: 'custom', + dictType: DICT_TYPE.UOM, + dictClass: 'string', + isSearch: false, + isTable: true, + tableForm: { + type: 'Select' + }, + isForm: true, + form: { + componentProps: { + disabled: true + } } }, - }, - { - label: '类别', - field: 'category', - sort: 'custom', - dictType: DICT_TYPE.ITEM_CATEGORY, - dictClass: 'string', - isSearch: false, - isTable: true, - tableForm: { - type: 'Select' - }, - isForm: true, - form: { - componentProps: { - disabled: true + { + label: '类别', + field: 'category', + sort: 'custom', + dictType: DICT_TYPE.ITEM_CATEGORY, + dictClass: 'string', + isSearch: false, + isTable: true, + tableForm: { + type: 'Select' + }, + isForm: true, + form: { + componentProps: { + disabled: true + } } }, - }, - { - label: '备件分类', - field: 'classification', - sort: 'custom', - dictType: DICT_TYPE.CLASSIFICATION, - dictClass: 'string', - isSearch: false, - isTable: true, - tableForm: { - type: 'Select' - }, - isForm: true, - form: { - componentProps: { - disabled: true + { + label: '备件分类', + field: 'classification', + sort: 'custom', + dictType: DICT_TYPE.CLASSIFICATION, + dictClass: 'string', + isSearch: false, + isTable: true, + tableForm: { + type: 'Select' + }, + isForm: true, + form: { + componentProps: { + disabled: true + } } }, - }, - { - label: '区域', - field: 'region', - sort: 'custom', - dictType: DICT_TYPE.ITEM_REGION, - dictClass: 'string', - isSearch: false, - isTable: true, - tableForm: { - type: 'Select' - }, - isForm: true, - form: { - componentProps: { - disabled: true + { + label: '区域', + field: 'region', + sort: 'custom', + dictType: DICT_TYPE.ITEM_REGION, + dictClass: 'string', + isSearch: false, + isTable: true, + tableForm: { + type: 'Select' + }, + isForm: true, + form: { + componentProps: { + disabled: true + } } }, - }, - // { - // label: '单价', - // field: 'singlePrice', - // sort: 'custom', - // }, - { - label: '重采购点', - field: 'reprocurement', - sort: 'custom', - table: { - width: 110, - }, - isForm: true, - form: { - componentProps: { - disabled: true + // { + // label: '单价', + // field: 'singlePrice', + // sort: 'custom', + // }, + { + label: '重采购点', + field: 'reprocurement', + sort: 'custom', + table: { + width: 110 + }, + isForm: true, + form: { + componentProps: { + disabled: true + } } }, - }, - { - label: '安全库存', - field: 'safetyStock', - sort: 'custom', - isForm: true, - table: { - width: 110, - }, - form: { - component: 'InputNumber', - value: 0, - componentProps: { - disabled: true + { + label: '安全库存', + field: 'safetyStock', + sort: 'custom', + isForm: true, + table: { + width: 110 + }, + form: { + component: 'InputNumber', + value: 0, + componentProps: { + disabled: true + } } }, - }, - { - label: '成本中心', - field: 'cost', - sort: 'custom', - table: { - width: 110, - }, - isForm: true, - form: { - componentProps: { - disabled: true + { + label: '成本中心', + field: 'cost', + sort: 'custom', + table: { + width: 110 + }, + isForm: true, + form: { + componentProps: { + disabled: true + } } }, - }, - { - label: '采购员', - field: 'purchaser', - sort: 'custom', - table: { - width: 100, - }, - isForm: true, - form: { - componentProps: { - disabled: true + { + label: '采购员', + field: 'purchaser', + sort: 'custom', + table: { + width: 100 + }, + isForm: true, + form: { + componentProps: { + disabled: true + } } }, - }, - { - label: '财务', - field: 'financer', - sort: 'custom', - isForm: true, - form: { - componentProps: { - disabled: true + { + label: '财务', + field: 'financer', + sort: 'custom', + isForm: true, + form: { + componentProps: { + disabled: true + } } }, - }, - { - 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: { + { + label: '是否以旧换新', + field: 'isRadeIn', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + isSearch: false, + isTable: true, + sort: 'custom', + table: { + width: 140 + }, + tableForm: { + type: 'Select', inactiveValue: 'FALSE', - activeValue: '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: 'batch', - sort: 'custom', - isTable: true, - isForm: true, - form: { - componentProps: { - disabled: true + { + label: '采购时间', + field: 'purchaseTime', + sort: 'custom', + formatter: dateFormatter, + table: { + width: 150 + }, + isForm: false + }, + { + label: '批次', + field: 'batch', + sort: 'custom', + isTable: true, + isForm: true, + form: { + componentProps: { + disabled: true + } } }, - }, - { - label: '库龄', - field: 'areaAge', - sort: 'custom', - formatter: (row: Recordable, column: TableColumn, cellValue: any) => { - if (!row.batchDate) { - return '未知'; // 如果 purchaseTime 为 null 或 undefined,返回 '未知' - } - - const purchaseTime = new Date(row.batchDate); // 获取采购时间 - if (isNaN(purchaseTime.getTime())) { - return '未知'; // 如果 purchaseTime 不是有效日期,返回 '未知' + { + label: '库龄', + field: 'areaAge', + sort: 'custom', + formatter: (row: Recordable, column: TableColumn, cellValue: any) => { + if (!row.batchDate) { + return '未知' // 如果 purchaseTime 为 null 或 undefined,返回 '未知' + } + + const purchaseTime = new Date(row.batchDate) // 获取采购时间 + if (isNaN(purchaseTime.getTime())) { + return '未知' // 如果 purchaseTime 不是有效日期,返回 '未知' + } + + const currentTime = new Date() // 当前时间 + const ageInMilliseconds = currentTime.getTime() - purchaseTime.getTime() // 时间差(毫秒) + const ageInDays = Math.floor(ageInMilliseconds / (1000 * 60 * 60 * 24)) // 转换为天数 + return `${ageInDays} 天` // 返回计算结果 + }, + isForm: false, + table: { + width: 150 } - - const currentTime = new Date(); // 当前时间 - const ageInMilliseconds = currentTime.getTime() - purchaseTime.getTime(); // 时间差(毫秒) - const ageInDays = Math.floor(ageInMilliseconds / (1000 * 60 * 60 * 24)); // 转换为天数 - return `${ageInDays} 天`; // 返回计算结果 - }, - isForm: false, - table: { - 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', - value: 'TRUE', - componentProps: { + { + label: '是否框架协议', + field: 'isFramework', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + isSearch: false, + isTable: true, + sort: 'custom', + table: { + width: 140 + }, + tableForm: { + type: 'Select', inactiveValue: 'FALSE', - activeValue: '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', - inactiveValue: 'FALSE', - disabled: true - }, - form: { - component: 'Switch', - value: 'TRUE', - componentProps: { + { + label: '是否可用', + field: 'available', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + isSearch: false, + isTable: true, + sort: 'custom', + table: { + width: 150 + }, + tableForm: { + type: 'Select', 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' } - } -])) + ]) +) diff --git a/src/views/eam/item/itemAccountsChange/itemAccountsChange.data.ts b/src/views/eam/item/itemAccountsChange/itemAccountsChange.data.ts index ad82b0b..e9eab38 100644 --- a/src/views/eam/item/itemAccountsChange/itemAccountsChange.data.ts +++ b/src/views/eam/item/itemAccountsChange/itemAccountsChange.data.ts @@ -146,13 +146,29 @@ export const ItemAccountsChange = useCrudSchemas( sort: 'custom', isSearch: false }, - { label: '操作时间', field: 'createTime', - sort: 'custom', 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: { component: 'DatePicker', componentProps: { @@ -160,8 +176,7 @@ export const ItemAccountsChange = useCrudSchemas( type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } - }, - isForm: false + } }, // { // label: '操作',