diff --git a/src/api/materials/company/types.ts b/src/api/materials/company/types.ts index 8fb437d..493630c 100644 --- a/src/api/materials/company/types.ts +++ b/src/api/materials/company/types.ts @@ -28,7 +28,6 @@ export interface CompanyVO { * 资质情况 */ qualification: string; - } export interface CompanyForm extends BaseEntity { @@ -61,11 +60,9 @@ export interface CompanyForm extends BaseEntity { * 资质情况 */ qualification?: string; - } -export interface CompanyQuery extends PageQuery { - +export interface CompanyQuery extends PageRequest { /** * 公司名称 */ @@ -86,11 +83,8 @@ export interface CompanyQuery extends PageQuery { */ qualification?: string; - /** - * 日期范围参数 - */ - params?: any; + /** + * 日期范围参数 + */ + params?: any; } - - - diff --git a/src/api/materials/materials/types.ts b/src/api/materials/materials/types.ts index a22fad5..33e32f6 100644 --- a/src/api/materials/materials/types.ts +++ b/src/api/materials/materials/types.ts @@ -93,7 +93,6 @@ export interface MaterialsVO { * 状态(0正常 1停用) */ status: string; - } export interface MaterialsForm extends BaseEntity { @@ -191,11 +190,9 @@ export interface MaterialsForm extends BaseEntity { * 状态(0正常 1停用) */ status?: string; - } -export interface MaterialsQuery extends PageQuery { - +export interface MaterialsQuery extends PageRequest { /** * 材料名称 */ @@ -281,11 +278,8 @@ export interface MaterialsQuery extends PageQuery { */ status?: string; - /** - * 日期范围参数 - */ - params?: any; + /** + * 日期范围参数 + */ + params?: any; } - - - diff --git a/src/api/materials/materialsInventory/types.ts b/src/api/materials/materialsInventory/types.ts index ed2697b..db3c5ca 100644 --- a/src/api/materials/materialsInventory/types.ts +++ b/src/api/materials/materialsInventory/types.ts @@ -63,7 +63,6 @@ export interface MaterialsInventoryVO { * 备注 */ remark: string; - } export interface MaterialsInventoryForm extends BaseEntity { @@ -131,11 +130,9 @@ export interface MaterialsInventoryForm extends BaseEntity { * 备注 */ remark?: string; - } -export interface MaterialsInventoryQuery extends PageQuery { - +export interface MaterialsInventoryQuery extends PageRequest { /** * 材料id */ @@ -191,11 +188,8 @@ export interface MaterialsInventoryQuery extends PageQuery { */ shipper?: string; - /** - * 日期范围参数 - */ - params?: any; + /** + * 日期范围参数 + */ + params?: any; } - - - diff --git a/src/api/project/constructionUser/types.ts b/src/api/project/constructionUser/types.ts index ea9ed35..d237cd3 100644 --- a/src/api/project/constructionUser/types.ts +++ b/src/api/project/constructionUser/types.ts @@ -1,3 +1,5 @@ +import { ContractorVO } from '@/api/project/contractor/types'; + export interface ConstructionUserVO { /** * 主键id @@ -34,6 +36,11 @@ export interface ConstructionUserVO { */ contractorId: string | number; + /** + * 分包公司 + */ + contractorVo: ContractorVO; + /** * 班组id */ @@ -138,7 +145,6 @@ export interface ConstructionUserVO { * 备注 */ remark: string; - } export interface ConstructionUserForm extends BaseEntity { @@ -281,11 +287,9 @@ export interface ConstructionUserForm extends BaseEntity { * 备注 */ remark?: string; - } export interface ConstructionUserQuery extends PageQuery { - /** * 微信id */ @@ -416,11 +420,8 @@ export interface ConstructionUserQuery extends PageQuery { */ salary?: number; - /** - * 日期范围参数 - */ - params?: any; + /** + * 日期范围参数 + */ + params?: any; } - - - diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 229e181..26c3d8a 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -53,6 +53,7 @@ declare global { /** 其他参数 */ [key: string]: any; } + /** * 字典数据 数据配置 */ @@ -81,6 +82,7 @@ declare global { queryParams: D; rules: ElFormRules; } + /** * 分页查询参数 */ @@ -88,6 +90,14 @@ declare global { pageNum: number; pageSize: number; } + + declare interface PageRequest { + current: number; + pageSize: number; + sortField: string; + sortOrder: string; + } + declare interface LayoutSetting { /** * 是否显示顶部导航 diff --git a/src/views/materials/company/index.vue b/src/views/materials/company/index.vue index 60d8ee5..a531c78 100644 --- a/src/views/materials/company/index.vue +++ b/src/views/materials/company/index.vue @@ -7,8 +7,10 @@ - - + + + + 搜索 @@ -48,35 +50,23 @@ - - + + + + - - - - - - - - - - + + - + - @@ -153,9 +162,11 @@ import { addMaterials, delMaterials, getMaterials, listMaterials, updateMaterials } from '@/api/materials/materials'; import { MaterialsForm, MaterialsQuery, MaterialsVO } from '@/api/materials/materials/types'; import { useUserStoreHook } from '@/store/modules/user'; +import MaterialsInventoryTable from '@/views/materials/materials/component/MaterialsInventoryTable.vue'; +import MaterialsInventoryAddDialog from '@/views/materials/materials/component/MaterialsInventoryAddDialog.vue'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; - +const { sys_normal_disable } = toRefs(proxy?.useDict('sys_normal_disable')); // 获取用户 store const userStore = useUserStoreHook(); // 从 store 中获取项目列表和当前选中的项目 @@ -202,7 +213,7 @@ const initFormData: MaterialsForm = { const data = reactive>({ form: { ...initFormData }, queryParams: { - pageNum: 1, + current: 1, pageSize: 10, materialsName: undefined, companyId: undefined, @@ -230,6 +241,7 @@ const data = reactive>({ }); const { queryParams, form, rules } = toRefs(data); +const companyOptions = ref([]); /** 查询材料名称列表 */ const getList = async () => { @@ -237,6 +249,14 @@ const getList = async () => { const res = await listMaterials(queryParams.value); materialsList.value = res.data.records; total.value = res.data.total; + const companyMap = new Map(); + res.data.records.forEach((record) => { + const { id, companyName } = record.companyVo; + if (!companyMap.has(id)) { + companyMap.set(id, { id, companyName }); + } + }); + companyOptions.value = Array.from(companyMap.values()); loading.value = false; }; @@ -254,7 +274,7 @@ const reset = () => { /** 搜索按钮操作 */ const handleQuery = () => { - queryParams.value.pageNum = 1; + queryParams.value.current = 1; getList(); }; @@ -271,6 +291,21 @@ const handleSelectionChange = (selection: MaterialsVO[]) => { multiple.value = !selection.length; }; +// 存储当前展开行的 key 数组(只允许一个展开) +const expandedRowKeys = ref([]); +// row-key 函数:返回每一行的唯一标识 +const getRowKey = (row: any) => row.id; +/** 展开选中数据 */ +const handleExpandChange = async (selection: MaterialsVO, expanded: any) => { + if (expanded) { + // 展开当前行时,将其他展开行关闭,只保留当前行 id + expandedRowKeys.value = [selection.id]; + } else { + // 收起当前行时,从 expandedRowKeys 中移除 + expandedRowKeys.value = expandedRowKeys.value.filter((key) => key !== selection.id); + } +}; + /** 新增按钮操作 */ const handleAdd = () => { reset(); @@ -325,6 +360,13 @@ const handleExport = () => { ); }; +const dialogRef = ref(); +const currentMaterialsId = ref(0); +const handleAddMaterialsInventory = (row?: MaterialsVO) => { + currentMaterialsId.value = row.id ?? 0; + dialogRef.value.openDialog(); +}; + onMounted(() => { getList(); }); diff --git a/src/views/materials/materialsInventory/index.vue b/src/views/materials/materialsInventory/index.vue index bce03c5..016cf20 100644 --- a/src/views/materials/materialsInventory/index.vue +++ b/src/views/materials/materialsInventory/index.vue @@ -4,38 +4,11 @@
- 搜索 重置 @@ -49,27 +22,8 @@