添加项目权限校验方法
This commit is contained in:
@ -5,7 +5,7 @@ VITE_APP_TITLE = RuoYi-Vue-Plus多租户管理系统
|
|||||||
VITE_APP_ENV = 'development'
|
VITE_APP_ENV = 'development'
|
||||||
|
|
||||||
# 开发环境
|
# 开发环境
|
||||||
VITE_APP_BASE_API = 'http://192.168.110.5:8899'
|
VITE_APP_BASE_API = 'http://192.168.110.2:8899'
|
||||||
|
|
||||||
# 应用访问路径 例如使用前缀 /admin/
|
# 应用访问路径 例如使用前缀 /admin/
|
||||||
VITE_APP_CONTEXT_PATH = '/'
|
VITE_APP_CONTEXT_PATH = '/'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export interface ProjectVO {
|
export interface ProjectVO {
|
||||||
/**
|
/**
|
||||||
*
|
* id
|
||||||
*/
|
*/
|
||||||
id: string | number;
|
id: string | number;
|
||||||
|
|
||||||
@ -108,12 +108,11 @@ export interface ProjectVO {
|
|||||||
* 是否删除(0正常 1删除)
|
* 是否删除(0正常 1删除)
|
||||||
*/
|
*/
|
||||||
isDelete: number;
|
isDelete: number;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProjectForm extends BaseEntity {
|
export interface ProjectForm extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
id?: string | number;
|
id?: string | number;
|
||||||
|
|
||||||
@ -221,11 +220,9 @@ export interface ProjectForm extends BaseEntity {
|
|||||||
* 是否删除(0正常 1删除)
|
* 是否删除(0正常 1删除)
|
||||||
*/
|
*/
|
||||||
isDelete?: number;
|
isDelete?: number;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProjectQuery extends PageQuery {
|
export interface ProjectQuery extends PageQuery {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目名称
|
* 项目名称
|
||||||
*/
|
*/
|
||||||
@ -326,11 +323,8 @@ export interface ProjectQuery extends PageQuery {
|
|||||||
*/
|
*/
|
||||||
isDelete?: number;
|
isDelete?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期范围参数
|
* 日期范围参数
|
||||||
*/
|
*/
|
||||||
params?: any;
|
params?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Index" lang="ts">
|
<script setup name="Index" lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref } from 'vue';
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter"
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||||
:leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
||||||
<div v-show="showSearch" class="mb-[10px]">
|
<div v-show="showSearch" class="mb-[10px]">
|
||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
@ -12,8 +11,7 @@
|
|||||||
<el-input v-model="queryParams.projectId" placeholder="请输入项目id" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.projectId" placeholder="请输入项目id" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="资质情况" prop="qualification">
|
<el-form-item label="资质情况" prop="qualification">
|
||||||
<el-input v-model="queryParams.qualification" placeholder="请输入资质情况" clearable
|
<el-input v-model="queryParams.qualification" placeholder="请输入资质情况" clearable @keyup.enter="handleQuery" />
|
||||||
@keyup.enter="handleQuery" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
@ -28,20 +26,20 @@
|
|||||||
<template #header>
|
<template #header>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['materials:company:add']">新增 </el-button>
|
||||||
v-hasPermi="['materials:company:add']">新增</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()"
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['materials:company:edit']"
|
||||||
v-hasPermi="['materials:company:edit']">修改</el-button>
|
>修改
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()"
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['materials:company:remove']"
|
||||||
v-hasPermi="['materials:company:remove']">删除</el-button>
|
>删除
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['materials:company:export']">导出 </el-button>
|
||||||
v-hasPermi="['materials:company:export']">导出</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -59,13 +57,15 @@
|
|||||||
<el-table-column label="公司名称" align="center" prop="companyName" />
|
<el-table-column label="公司名称" align="center" prop="companyName" />
|
||||||
<el-table-column label="公司状态" align="center" prop="status">
|
<el-table-column label="公司状态" align="center" prop="status">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<span :style="{
|
<span
|
||||||
color: row.status === 0 ? 'green' : 'red',
|
:style="{
|
||||||
backgroundColor: row.status === 0 ? '#E6F9E6' : '#FDE2E2',
|
color: row.status === 0 ? 'green' : 'red',
|
||||||
padding: '5px 10px',
|
backgroundColor: row.status === 0 ? '#E6F9E6' : '#FDE2E2',
|
||||||
borderRadius: '5px',
|
padding: '5px 10px',
|
||||||
display: 'inline-block'
|
borderRadius: '5px',
|
||||||
}">
|
display: 'inline-block'
|
||||||
|
}"
|
||||||
|
>
|
||||||
{{ row.status === 0 ? '正常' : '不正常' }}
|
{{ row.status === 0 ? '正常' : '不正常' }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
@ -76,22 +76,19 @@
|
|||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip content="修改" placement="top">
|
<el-tooltip content="修改" placement="top">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['materials:company:edit']"></el-button>
|
||||||
v-hasPermi="['materials:company:edit']"></el-button>
|
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="删除" placement="top">
|
<el-tooltip content="删除" placement="top">
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['materials:company:remove']"></el-button>
|
||||||
v-hasPermi="['materials:company:remove']"></el-button>
|
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
|
||||||
</el-card>
|
</el-card>
|
||||||
<!-- 添加或修改公司对话框 -->
|
<!-- 添加或修改公司对话框 -->
|
||||||
|
|
||||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||||
<el-form ref="companyFormRef" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="companyFormRef" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="公司名称" prop="companyName">
|
<el-form-item label="公司名称" prop="companyName">
|
||||||
@ -114,7 +111,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -147,8 +143,8 @@ const initFormData: CompanyForm = {
|
|||||||
projectId: undefined,
|
projectId: undefined,
|
||||||
status: undefined,
|
status: undefined,
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
qualification: undefined,
|
qualification: undefined
|
||||||
}
|
};
|
||||||
const data = reactive<PageData<CompanyForm, CompanyQuery>>({
|
const data = reactive<PageData<CompanyForm, CompanyQuery>>({
|
||||||
form: { ...initFormData },
|
form: { ...initFormData },
|
||||||
queryParams: {
|
queryParams: {
|
||||||
@ -158,13 +154,10 @@ const data = reactive<PageData<CompanyForm, CompanyQuery>>({
|
|||||||
projectId: undefined,
|
projectId: undefined,
|
||||||
status: undefined,
|
status: undefined,
|
||||||
qualification: undefined,
|
qualification: undefined,
|
||||||
params: {
|
params: {}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
id: [
|
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }]
|
||||||
{ required: true, message: "主键id不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -174,58 +167,58 @@ const { queryParams, form, rules } = toRefs(data);
|
|||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const res = await listCompany(queryParams.value);
|
const res = await listCompany(queryParams.value);
|
||||||
companyList.value = res.records;
|
companyList.value = res.data.records;
|
||||||
total.value = res.total;
|
total.value = res.total;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 取消按钮 */
|
/** 取消按钮 */
|
||||||
const cancel = () => {
|
const cancel = () => {
|
||||||
reset();
|
reset();
|
||||||
dialog.visible = false;
|
dialog.visible = false;
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 表单重置 */
|
/** 表单重置 */
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
form.value = { ...initFormData };
|
form.value = { ...initFormData };
|
||||||
companyFormRef.value?.resetFields();
|
companyFormRef.value?.resetFields();
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
const handleQuery = () => {
|
||||||
queryParams.value.pageNum = 1;
|
queryParams.value.pageNum = 1;
|
||||||
getList();
|
getList();
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
const resetQuery = () => {
|
const resetQuery = () => {
|
||||||
queryFormRef.value?.resetFields();
|
queryFormRef.value?.resetFields();
|
||||||
handleQuery();
|
handleQuery();
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 多选框选中数据 */
|
/** 多选框选中数据 */
|
||||||
const handleSelectionChange = (selection: CompanyVO[]) => {
|
const handleSelectionChange = (selection: CompanyVO[]) => {
|
||||||
ids.value = selection.map(item => item.id);
|
ids.value = selection.map((item) => item.id);
|
||||||
single.value = selection.length != 1;
|
single.value = selection.length != 1;
|
||||||
multiple.value = !selection.length;
|
multiple.value = !selection.length;
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
reset();
|
reset();
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = "添加公司";
|
dialog.title = '添加公司';
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
const handleUpdate = async (row?: CompanyVO) => {
|
const handleUpdate = async (row?: CompanyVO) => {
|
||||||
reset();
|
reset();
|
||||||
const _id = row?.id || ids.value[0]
|
const _id = row?.id || ids.value[0];
|
||||||
const res = await getCompany(_id);
|
const res = await getCompany(_id);
|
||||||
Object.assign(form.value, res.data);
|
Object.assign(form.value, res.data);
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = "修改公司";
|
dialog.title = '修改公司';
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
const submitForm = () => {
|
const submitForm = () => {
|
||||||
@ -233,38 +226,41 @@ const submitForm = () => {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
buttonLoading.value = true;
|
buttonLoading.value = true;
|
||||||
if (form.value.id) {
|
if (form.value.id) {
|
||||||
await updateCompany(form.value).finally(() => buttonLoading.value = false);
|
await updateCompany(form.value).finally(() => (buttonLoading.value = false));
|
||||||
} else {
|
} else {
|
||||||
await addCompany(form.value).finally(() => buttonLoading.value = false);
|
await addCompany(form.value).finally(() => (buttonLoading.value = false));
|
||||||
}
|
}
|
||||||
proxy?.$modal.msgSuccess("操作成功");
|
proxy?.$modal.msgSuccess('操作成功');
|
||||||
dialog.visible = false;
|
dialog.visible = false;
|
||||||
await getList();
|
await getList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
const handleDelete = async (row?: CompanyVO) => {
|
const handleDelete = async (row?: CompanyVO) => {
|
||||||
const _ids = row?.id || ids.value;
|
const _ids = row?.id || ids.value;
|
||||||
await proxy?.$modal.confirm('是否确认删除公司编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
await proxy?.$modal.confirm('是否确认删除公司编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||||
await delCompany(_ids);
|
await delCompany(_ids);
|
||||||
proxy?.$modal.msgSuccess("删除成功");
|
proxy?.$modal.msgSuccess('删除成功');
|
||||||
await getList();
|
await getList();
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
const handleExport = () => {
|
const handleExport = () => {
|
||||||
proxy?.download('materials/company/export', {
|
proxy?.download(
|
||||||
...queryParams.value
|
'materials/company/export',
|
||||||
}, `company_${new Date().getTime()}.xlsx`)
|
{
|
||||||
}
|
...queryParams.value
|
||||||
|
},
|
||||||
|
`company_${new Date().getTime()}.xlsx`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
import { useUserStoreHook } from '@/store/modules/user';
|
import { useUserStoreHook } from '@/store/modules/user';
|
||||||
// 获取用户 store
|
// 获取用户 store
|
||||||
const userStore = useUserStoreHook();
|
const userStore = useUserStoreHook();
|
||||||
@ -275,18 +271,14 @@ const currentProject = computed(() => userStore.selectedProject);
|
|||||||
const materialsInventoryList = computed(() => {
|
const materialsInventoryList = computed(() => {
|
||||||
// 如果有选中的项目,则只显示该项目的数据
|
// 如果有选中的项目,则只显示该项目的数据
|
||||||
if (currentProject.value && currentProject.value.id) {
|
if (currentProject.value && currentProject.value.id) {
|
||||||
return companyList.value.filter(item =>
|
return companyList.value.filter((item) => item.projectId === currentProject.value.id);
|
||||||
item.projectId === currentProject.value.id
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
// 没有选中项目则显示所有数据
|
// 没有选中项目则显示所有数据
|
||||||
return companyList.value;
|
return companyList.value;
|
||||||
});
|
});
|
||||||
// 根据 projectId 获取对应的 projectName
|
// 根据 projectId 获取对应的 projectName
|
||||||
const getProjectName = (projectId) => {
|
const getProjectName = (projectId) => {
|
||||||
const project = projectList.value.find(p => p.id === projectId);
|
const project = projectList.value.find((p) => p.id === projectId);
|
||||||
return project ? project.name : projectId; // 如果找不到对应的项目名,则显示 ID
|
return project ? project.name : projectId; // 如果找不到对应的项目名,则显示 ID
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -65,16 +65,20 @@
|
|||||||
<template #header>
|
<template #header>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['materials:materials:add']">新增</el-button>
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['materials:materials:add']"> 新增 </el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['materials:materials:edit']">修改</el-button>
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['materials:materials:edit']"
|
||||||
|
>修改
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['materials:materials:remove']">删除</el-button>
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['materials:materials:remove']"
|
||||||
|
>删除
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['materials:materials:export']">导出</el-button>
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['materials:materials:export']">导出 </el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -88,10 +92,10 @@
|
|||||||
<!-- <el-table-column label="公司id" align="center" prop="companyId" /> -->
|
<!-- <el-table-column label="公司id" align="center" prop="companyId" /> -->
|
||||||
<el-table-column label="公司名称" align="center" prop="companyVo.companyName" />
|
<el-table-column label="公司名称" align="center" prop="companyVo.companyName" />
|
||||||
<el-table-column label="项目名称" align="center" prop="">
|
<el-table-column label="项目名称" align="center" prop="">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ getProjectName(scope.row.projectId) }}
|
{{ getProjectName(scope.row.projectId) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格型号名称" align="center" prop="typeSpecificationName" />
|
<el-table-column label="规格型号名称" align="center" prop="typeSpecificationName" />
|
||||||
<el-table-column label="规格型号文件路径" align="center" prop="typeSpecificationUrl" />
|
<el-table-column label="规格型号文件路径" align="center" prop="typeSpecificationUrl" />
|
||||||
<el-table-column label="合格证编号名称" align="center" prop="certificateConformityName" />
|
<el-table-column label="合格证编号名称" align="center" prop="certificateConformityName" />
|
||||||
@ -106,15 +110,17 @@
|
|||||||
<el-table-column label="计量单位" align="center" prop="weightId" />
|
<el-table-column label="计量单位" align="center" prop="weightId" />
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
<el-table-column label="预计材料数量" align="center" prop="quantityCount" />
|
<el-table-column label="预计材料数量" align="center" prop="quantityCount" />
|
||||||
<el-table-column label="状态" align="center" prop="status" >
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<span :style="{
|
<span
|
||||||
color: row.status === 0 ? 'green' : 'red',
|
:style="{
|
||||||
backgroundColor: row.status === 0 ? '#E6F9E6' : '#FDE2E2',
|
color: row.status === 0 ? 'green' : 'red',
|
||||||
padding: '5px 10px',
|
backgroundColor: row.status === 0 ? '#E6F9E6' : '#FDE2E2',
|
||||||
borderRadius: '5px',
|
padding: '5px 10px',
|
||||||
display: 'inline-block'
|
borderRadius: '5px',
|
||||||
}">
|
display: 'inline-block'
|
||||||
|
}"
|
||||||
|
>
|
||||||
{{ row.status === 0 ? '正常' : '异常' }}
|
{{ row.status === 0 ? '正常' : '异常' }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
@ -241,10 +247,10 @@ const initFormData: MaterialsForm = {
|
|||||||
weightId: undefined,
|
weightId: undefined,
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
quantityCount: undefined,
|
quantityCount: undefined,
|
||||||
status: undefined,
|
status: undefined
|
||||||
}
|
};
|
||||||
const data = reactive<PageData<MaterialsForm, MaterialsQuery>>({
|
const data = reactive<PageData<MaterialsForm, MaterialsQuery>>({
|
||||||
form: {...initFormData},
|
form: { ...initFormData },
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@ -266,13 +272,10 @@ const data = reactive<PageData<MaterialsForm, MaterialsQuery>>({
|
|||||||
weightId: undefined,
|
weightId: undefined,
|
||||||
quantityCount: undefined,
|
quantityCount: undefined,
|
||||||
status: undefined,
|
status: undefined,
|
||||||
params: {
|
params: {}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
id: [
|
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }]
|
||||||
{ required: true, message: "主键id不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -282,58 +285,58 @@ const { queryParams, form, rules } = toRefs(data);
|
|||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const res = await listMaterials(queryParams.value);
|
const res = await listMaterials(queryParams.value);
|
||||||
materialsList.value = res.records;
|
materialsList.value = res.data.records;
|
||||||
total.value = res.total;
|
total.value = res.total;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 取消按钮 */
|
/** 取消按钮 */
|
||||||
const cancel = () => {
|
const cancel = () => {
|
||||||
reset();
|
reset();
|
||||||
dialog.visible = false;
|
dialog.visible = false;
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 表单重置 */
|
/** 表单重置 */
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
form.value = {...initFormData};
|
form.value = { ...initFormData };
|
||||||
materialsFormRef.value?.resetFields();
|
materialsFormRef.value?.resetFields();
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
const handleQuery = () => {
|
||||||
queryParams.value.pageNum = 1;
|
queryParams.value.pageNum = 1;
|
||||||
getList();
|
getList();
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
const resetQuery = () => {
|
const resetQuery = () => {
|
||||||
queryFormRef.value?.resetFields();
|
queryFormRef.value?.resetFields();
|
||||||
handleQuery();
|
handleQuery();
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 多选框选中数据 */
|
/** 多选框选中数据 */
|
||||||
const handleSelectionChange = (selection: MaterialsVO[]) => {
|
const handleSelectionChange = (selection: MaterialsVO[]) => {
|
||||||
ids.value = selection.map(item => item.id);
|
ids.value = selection.map((item) => item.id);
|
||||||
single.value = selection.length != 1;
|
single.value = selection.length != 1;
|
||||||
multiple.value = !selection.length;
|
multiple.value = !selection.length;
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
reset();
|
reset();
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = "添加材料名称";
|
dialog.title = '添加材料名称';
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
const handleUpdate = async (row?: MaterialsVO) => {
|
const handleUpdate = async (row?: MaterialsVO) => {
|
||||||
reset();
|
reset();
|
||||||
const _id = row?.id || ids.value[0]
|
const _id = row?.id || ids.value[0];
|
||||||
const res = await getMaterials(_id);
|
const res = await getMaterials(_id);
|
||||||
Object.assign(form.value, res.data);
|
Object.assign(form.value, res.data);
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = "修改材料名称";
|
dialog.title = '修改材料名称';
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
const submitForm = () => {
|
const submitForm = () => {
|
||||||
@ -341,33 +344,36 @@ const submitForm = () => {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
buttonLoading.value = true;
|
buttonLoading.value = true;
|
||||||
if (form.value.id) {
|
if (form.value.id) {
|
||||||
await updateMaterials(form.value).finally(() => buttonLoading.value = false);
|
await updateMaterials(form.value).finally(() => (buttonLoading.value = false));
|
||||||
} else {
|
} else {
|
||||||
await addMaterials(form.value).finally(() => buttonLoading.value = false);
|
await addMaterials(form.value).finally(() => (buttonLoading.value = false));
|
||||||
}
|
}
|
||||||
proxy?.$modal.msgSuccess("操作成功");
|
proxy?.$modal.msgSuccess('操作成功');
|
||||||
dialog.visible = false;
|
dialog.visible = false;
|
||||||
await getList();
|
await getList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
const handleDelete = async (row?: MaterialsVO) => {
|
const handleDelete = async (row?: MaterialsVO) => {
|
||||||
const _ids = row?.id || ids.value;
|
const _ids = row?.id || ids.value;
|
||||||
await proxy?.$modal.confirm('是否确认删除材料名称编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
await proxy?.$modal.confirm('是否确认删除材料名称编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||||
await delMaterials(_ids);
|
await delMaterials(_ids);
|
||||||
proxy?.$modal.msgSuccess("删除成功");
|
proxy?.$modal.msgSuccess('删除成功');
|
||||||
await getList();
|
await getList();
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
const handleExport = () => {
|
const handleExport = () => {
|
||||||
proxy?.download('materials/materials/export', {
|
proxy?.download(
|
||||||
...queryParams.value
|
'materials/materials/export',
|
||||||
}, `materials_${new Date().getTime()}.xlsx`)
|
{
|
||||||
}
|
...queryParams.value
|
||||||
|
},
|
||||||
|
`materials_${new Date().getTime()}.xlsx`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
import { useUserStoreHook } from '@/store/modules/user';
|
import { useUserStoreHook } from '@/store/modules/user';
|
||||||
// 获取用户 store
|
// 获取用户 store
|
||||||
@ -379,16 +385,14 @@ const currentProject = computed(() => userStore.selectedProject);
|
|||||||
const materialsInventoryList = computed(() => {
|
const materialsInventoryList = computed(() => {
|
||||||
// 如果有选中的项目,则只显示该项目的数据
|
// 如果有选中的项目,则只显示该项目的数据
|
||||||
if (currentProject.value && currentProject.value.id) {
|
if (currentProject.value && currentProject.value.id) {
|
||||||
return materialsList.value.filter(item =>
|
return materialsList.value.filter((item) => item.projectId === currentProject.value.id);
|
||||||
item.projectId === currentProject.value.id
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
// 没有选中项目则显示所有数据
|
// 没有选中项目则显示所有数据
|
||||||
return materialsList.value;
|
return materialsList.value;
|
||||||
});
|
});
|
||||||
// 根据 projectId 获取对应的 projectName
|
// 根据 projectId 获取对应的 projectName
|
||||||
const getProjectName = (projectId) => {
|
const getProjectName = (projectId) => {
|
||||||
const project = projectList.value.find(p => p.id === projectId);
|
const project = projectList.value.find((p) => p.id === projectId);
|
||||||
return project ? project.name : projectId; // 如果找不到对应的项目名,则显示 ID
|
return project ? project.name : projectId; // 如果找不到对应的项目名,则显示 ID
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -55,16 +55,28 @@
|
|||||||
<template #header>
|
<template #header>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['materials:materialsInventory:add']">新增</el-button>
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['materials:materialsInventory:add']">新增 </el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['materials:materialsInventory:edit']">修改</el-button>
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['materials:materialsInventory:edit']"
|
||||||
|
>修改
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['materials:materialsInventory:remove']">删除</el-button>
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete()"
|
||||||
|
v-hasPermi="['materials:materialsInventory:remove']"
|
||||||
|
>删除
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['materials:materialsInventory:export']">导出</el-button>
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['materials:materialsInventory:export']"
|
||||||
|
>导出
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -77,10 +89,10 @@
|
|||||||
<!-- <el-table-column label="材料id" align="center" prop="materialsId" /> -->
|
<!-- <el-table-column label="材料id" align="center" prop="materialsId" /> -->
|
||||||
<el-table-column label="材料名称" align="center" prop="materialsVo.materialsName" />
|
<el-table-column label="材料名称" align="center" prop="materialsVo.materialsName" />
|
||||||
<el-table-column label="项目名称" align="center">
|
<el-table-column label="项目名称" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ getProjectName(scope.row.projectId) }}
|
{{ getProjectName(scope.row.projectId) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="出入库状态" align="center" prop="outPut" />
|
<el-table-column label="出入库状态" align="center" prop="outPut" />
|
||||||
<el-table-column label="出/入库的数量" align="center" prop="number" />
|
<el-table-column label="出/入库的数量" align="center" prop="number" />
|
||||||
<el-table-column label="出/入库操作时间" align="center" prop="outPutTime" width="180">
|
<el-table-column label="出/入库操作时间" align="center" prop="outPutTime" width="180">
|
||||||
@ -98,10 +110,22 @@
|
|||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip content="修改" placement="top">
|
<el-tooltip content="修改" placement="top">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['materials:materialsInventory:edit']"></el-button>
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="Edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['materials:materialsInventory:edit']"
|
||||||
|
></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="删除" placement="top">
|
<el-tooltip content="删除" placement="top">
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['materials:materialsInventory:remove']"></el-button>
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="Delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['materials:materialsInventory:remove']"
|
||||||
|
></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -125,11 +149,7 @@
|
|||||||
<el-input v-model="form.number" placeholder="请输入出/入库的数量" />
|
<el-input v-model="form.number" placeholder="请输入出/入库的数量" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="出/入库操作时间" prop="outPutTime">
|
<el-form-item label="出/入库操作时间" prop="outPutTime">
|
||||||
<el-date-picker clearable
|
<el-date-picker clearable v-model="form.outPutTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择出/入库操作时间">
|
||||||
v-model="form.outPutTime"
|
|
||||||
type="datetime"
|
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
|
||||||
placeholder="请选择出/入库操作时间">
|
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="剩余库存数量" prop="residue">
|
<el-form-item label="剩余库存数量" prop="residue">
|
||||||
@ -139,7 +159,7 @@
|
|||||||
<el-input v-model="form.operator" placeholder="请输入操作人" />
|
<el-input v-model="form.operator" placeholder="请输入操作人" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="材料出入证明" prop="path">
|
<el-form-item label="材料出入证明" prop="path">
|
||||||
<el-input v-model="form.path" type="textarea" placeholder="请输入内容" />
|
<el-input v-model="form.path" type="textarea" placeholder="请输入内容" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="处理方式" prop="disposition">
|
<el-form-item label="处理方式" prop="disposition">
|
||||||
<el-input v-model="form.disposition" placeholder="请输入处理方式" />
|
<el-input v-model="form.disposition" placeholder="请输入处理方式" />
|
||||||
@ -165,7 +185,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="MaterialsInventory" lang="ts">
|
<script setup name="MaterialsInventory" lang="ts">
|
||||||
import { listMaterialsInventory, getMaterialsInventory, delMaterialsInventory, addMaterialsInventory, updateMaterialsInventory } from '@/api/materials/materialsInventory';
|
import {
|
||||||
|
listMaterialsInventory,
|
||||||
|
getMaterialsInventory,
|
||||||
|
delMaterialsInventory,
|
||||||
|
addMaterialsInventory,
|
||||||
|
updateMaterialsInventory
|
||||||
|
} from '@/api/materials/materialsInventory';
|
||||||
import { MaterialsInventoryVO, MaterialsInventoryQuery, MaterialsInventoryForm } from '@/api/materials/materialsInventory/types';
|
import { MaterialsInventoryVO, MaterialsInventoryQuery, MaterialsInventoryForm } from '@/api/materials/materialsInventory/types';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
@ -204,11 +230,11 @@ const initFormData: MaterialsInventoryForm = {
|
|||||||
materialsVo: {
|
materialsVo: {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
materialsName: undefined,
|
materialsName: undefined,
|
||||||
materialsCode: undefined,
|
materialsCode: undefined
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
const data = reactive<PageData<MaterialsInventoryForm, MaterialsInventoryQuery>>({
|
const data = reactive<PageData<MaterialsInventoryForm, MaterialsInventoryQuery>>({
|
||||||
form: {...initFormData},
|
form: { ...initFormData },
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@ -223,21 +249,16 @@ const data = reactive<PageData<MaterialsInventoryForm, MaterialsInventoryQuery>>
|
|||||||
disposition: undefined,
|
disposition: undefined,
|
||||||
recipient: undefined,
|
recipient: undefined,
|
||||||
shipper: undefined,
|
shipper: undefined,
|
||||||
params: {
|
params: {},
|
||||||
},
|
|
||||||
materialsVo: {
|
materialsVo: {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
materialsName: undefined,
|
materialsName: undefined,
|
||||||
materialsCode: undefined,
|
materialsCode: undefined
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
id: [
|
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }],
|
||||||
{ required: true, message: "主键id不能为空", trigger: "blur" }
|
materialsId: [{ required: true, message: '材料id不能为空', trigger: 'blur' }]
|
||||||
],
|
|
||||||
materialsId: [
|
|
||||||
{ required: true, message: "材料id不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -247,58 +268,58 @@ const { queryParams, form, rules } = toRefs(data);
|
|||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const res = await listMaterialsInventory(queryParams.value);
|
const res = await listMaterialsInventory(queryParams.value);
|
||||||
materialsInventoryList.value = res.records;
|
materialsInventoryList.value = res.data.records;
|
||||||
total.value = res.total;
|
total.value = res.total;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 取消按钮 */
|
/** 取消按钮 */
|
||||||
const cancel = () => {
|
const cancel = () => {
|
||||||
reset();
|
reset();
|
||||||
dialog.visible = false;
|
dialog.visible = false;
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 表单重置 */
|
/** 表单重置 */
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
form.value = {...initFormData};
|
form.value = { ...initFormData };
|
||||||
materialsInventoryFormRef.value?.resetFields();
|
materialsInventoryFormRef.value?.resetFields();
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
const handleQuery = () => {
|
||||||
queryParams.value.pageNum = 1;
|
queryParams.value.pageNum = 1;
|
||||||
getList();
|
getList();
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
const resetQuery = () => {
|
const resetQuery = () => {
|
||||||
queryFormRef.value?.resetFields();
|
queryFormRef.value?.resetFields();
|
||||||
handleQuery();
|
handleQuery();
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 多选框选中数据 */
|
/** 多选框选中数据 */
|
||||||
const handleSelectionChange = (selection: MaterialsInventoryVO[]) => {
|
const handleSelectionChange = (selection: MaterialsInventoryVO[]) => {
|
||||||
ids.value = selection.map(item => item.id);
|
ids.value = selection.map((item) => item.id);
|
||||||
single.value = selection.length != 1;
|
single.value = selection.length != 1;
|
||||||
multiple.value = !selection.length;
|
multiple.value = !selection.length;
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
reset();
|
reset();
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = "添加材料出/入库";
|
dialog.title = '添加材料出/入库';
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
const handleUpdate = async (row?: MaterialsInventoryVO) => {
|
const handleUpdate = async (row?: MaterialsInventoryVO) => {
|
||||||
reset();
|
reset();
|
||||||
const _id = row?.id || ids.value[0]
|
const _id = row?.id || ids.value[0];
|
||||||
const res = await getMaterialsInventory(_id);
|
const res = await getMaterialsInventory(_id);
|
||||||
Object.assign(form.value, res.data);
|
Object.assign(form.value, res.data);
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = "修改材料出/入库";
|
dialog.title = '修改材料出/入库';
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
const submitForm = () => {
|
const submitForm = () => {
|
||||||
@ -306,33 +327,36 @@ const submitForm = () => {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
buttonLoading.value = true;
|
buttonLoading.value = true;
|
||||||
if (form.value.id) {
|
if (form.value.id) {
|
||||||
await updateMaterialsInventory(form.value).finally(() => buttonLoading.value = false);
|
await updateMaterialsInventory(form.value).finally(() => (buttonLoading.value = false));
|
||||||
} else {
|
} else {
|
||||||
await addMaterialsInventory(form.value).finally(() => buttonLoading.value = false);
|
await addMaterialsInventory(form.value).finally(() => (buttonLoading.value = false));
|
||||||
}
|
}
|
||||||
proxy?.$modal.msgSuccess("操作成功");
|
proxy?.$modal.msgSuccess('操作成功');
|
||||||
dialog.visible = false;
|
dialog.visible = false;
|
||||||
await getList();
|
await getList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
const handleDelete = async (row?: MaterialsInventoryVO) => {
|
const handleDelete = async (row?: MaterialsInventoryVO) => {
|
||||||
const _ids = row?.id || ids.value;
|
const _ids = row?.id || ids.value;
|
||||||
await proxy?.$modal.confirm('是否确认删除材料出/入库编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
await proxy?.$modal.confirm('是否确认删除材料出/入库编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||||
await delMaterialsInventory(_ids);
|
await delMaterialsInventory(_ids);
|
||||||
proxy?.$modal.msgSuccess("删除成功");
|
proxy?.$modal.msgSuccess('删除成功');
|
||||||
await getList();
|
await getList();
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
const handleExport = () => {
|
const handleExport = () => {
|
||||||
proxy?.download('materials/materialsInventory/export', {
|
proxy?.download(
|
||||||
...queryParams.value
|
'materials/materialsInventory/export',
|
||||||
}, `materialsInventory_${new Date().getTime()}.xlsx`)
|
{
|
||||||
}
|
...queryParams.value
|
||||||
|
},
|
||||||
|
`materialsInventory_${new Date().getTime()}.xlsx`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
import { useUserStoreHook } from '@/store/modules/user';
|
import { useUserStoreHook } from '@/store/modules/user';
|
||||||
// 获取用户 store
|
// 获取用户 store
|
||||||
@ -344,16 +368,14 @@ const currentProject = computed(() => userStore.selectedProject);
|
|||||||
const materialsInventoryListNew = computed(() => {
|
const materialsInventoryListNew = computed(() => {
|
||||||
// 如果有选中的项目,则只显示该项目的数据
|
// 如果有选中的项目,则只显示该项目的数据
|
||||||
if (currentProject.value && currentProject.value.id) {
|
if (currentProject.value && currentProject.value.id) {
|
||||||
return materialsInventoryList.value.filter(item =>
|
return materialsInventoryList.value.filter((item) => item.projectId === currentProject.value.id);
|
||||||
item.projectId === currentProject.value.id
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
// 没有选中项目则显示所有数据
|
// 没有选中项目则显示所有数据
|
||||||
return materialsInventoryList.value;
|
return materialsInventoryList.value;
|
||||||
});
|
});
|
||||||
// 根据 projectId 获取对应的 projectName
|
// 根据 projectId 获取对应的 projectName
|
||||||
const getProjectName = (projectId) => {
|
const getProjectName = (projectId) => {
|
||||||
const project = projectList.value.find(p => p.id === projectId);
|
const project = projectList.value.find((p) => p.id === projectId);
|
||||||
return project ? project.name : projectId; // 如果找不到对应的项目名,则显示 ID
|
return project ? project.name : projectId; // 如果找不到对应的项目名,则显示 ID
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -68,20 +68,20 @@
|
|||||||
<template #header>
|
<template #header>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['project:project:add']">新增</el-button>
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['project:project:add']">新增 </el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['project:project:edit']"
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['project:project:edit']"
|
||||||
>修改</el-button
|
>修改
|
||||||
>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['project:project:remove']"
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['project:project:remove']"
|
||||||
>删除</el-button
|
>删除
|
||||||
>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['project:project:export']">导出</el-button>
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['project:project:export']">导出 </el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -288,7 +288,7 @@ const { queryParams, form, rules } = toRefs(data);
|
|||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const res = await listProject(queryParams.value);
|
const res = await listProject(queryParams.value);
|
||||||
projectList.value = res.records;
|
projectList.value = res.data.records;
|
||||||
total.value = res.total;
|
total.value = res.total;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
};
|
};
|
||||||
@ -327,7 +327,6 @@ const handleAdd = () => {
|
|||||||
reset();
|
reset();
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = '添加项目';
|
dialog.title = '添加项目';
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
|
Reference in New Issue
Block a user