物资供应总计划

This commit is contained in:
2025-08-14 19:44:07 +08:00
40 changed files with 1430 additions and 2041 deletions

View File

@ -92,6 +92,14 @@
<el-dialog :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body>
<el-form ref="materialReceiveFormRef" :model="form" :rules="rules" label-width="110px">
<el-row>
<el-col :span="12">
<el-form-item label="材料来源" prop="materialSource">
<el-select v-model="form.materialSource" filterable placeholder="请选择材料来源" style="width: 100%">
<el-option label="甲供材料" value="1"></el-option>
<el-option label="已供材料" value="2"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="表单编号" prop="formCode">
<el-input v-model="form.formCode" placeholder="请输入表单编号" />

View File

@ -1,498 +0,0 @@
<template>
<div class="p-2">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="表单编号" prop="formCode">
<el-input v-model="queryParams.formCode" placeholder="请输入表单编号" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="工程名称" prop="projectName">
<el-input v-model="queryParams.projectName" placeholder="请输入工程名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="材料名称" prop="materialName">
<el-input v-model="queryParams.materialName" placeholder="请输入设备材料名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="订货单位" prop="orderingUnit">
<el-input v-model="queryParams.orderingUnit" placeholder="请输入订货单位" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="供货单位" prop="supplierUnit">
<el-input v-model="queryParams.supplierUnit" placeholder="请输入供货单位" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="领料单位" prop="issueUnit">
<el-input v-model="queryParams.issueUnit" placeholder="请输入领料单位" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="保管单位" prop="storageUnit">
<el-input v-model="queryParams.storageUnit" placeholder="请输入保管单位" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['materials:materialIssue:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['materials:materialIssue:remove']"
>删除</el-button
>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="materialIssueList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="表单编号" align="center" prop="formCode" />
<el-table-column label="工程名称" align="center" prop="projectName" />
<el-table-column label="设备材料名称" align="center" prop="materialName" />
<el-table-column label="订货单位" align="center" prop="orderingUnit" />
<el-table-column label="供货单位" align="center" prop="supplierUnit" />
<el-table-column label="领料单位" align="center" prop="issueUnit" />
<el-table-column label="保管单位" align="center" prop="storageUnit" />
<el-table-column label="缺陷情况" align="center" prop="defectDescription" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="查看" placement="top">
<el-button link type="primary" icon="View" @click="handleView(scope.row)"></el-button>
</el-tooltip>
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['materials:materialIssue:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button
link
type="primary"
icon="Delete"
@click="handleDelete(scope.row)"
v-hasPermi="['materials:materialIssue:remove']"
></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
<el-dialog
:close-on-click-modal="false"
:close-on-press-escape="false"
:title="dialog.title"
v-model="dialog.visible"
width="800px"
append-to-body
>
<el-form ref="materialIssueFormRef" :model="form" :rules="rules" label-width="110px">
<el-row>
<el-col :span="12">
<el-form-item label="表单编号" prop="formCode">
<el-input v-model="form.formCode" placeholder="请输入表单编号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工程名称" prop="projectName">
<el-input v-model="form.projectName" placeholder="请输入工程名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备材料名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入设备材料名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="订货单位" prop="orderingUnit">
<el-input v-model="form.orderingUnit" placeholder="请输入订货单位" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供货单位" prop="supplierUnit">
<el-input v-model="form.supplierUnit" placeholder="请输入供货单位" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="领料单位" prop="issueUnit">
<el-input v-model="form.issueUnit" placeholder="请输入领料单位" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="保管单位" prop="storageUnit">
<el-input v-model="form.storageUnit" placeholder="请输入保管单位" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="缺陷情况" prop="defectDescription">
<el-input v-model="form.defectDescription" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-col>
<el-col :span="24">
<div class="detail">
<div class="detail-header">
<span>数量验收</span>
<el-button type="primary" link @click="addItem" icon="Plus">添加一行</el-button>
</div>
<div v-for="(item, index) in form.itemList" :key="index" class="detail-item">
<el-row>
<el-col :span="12">
<el-form-item
:label="index === 0 ? '名称' : ''"
:prop="`itemList.${index}.name`"
:rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]"
>
<el-input v-model="item.name" placeholder="请输入名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="index === 0 ? '规格' : ''"
:prop="`itemList.${index}.specification`"
:rules="[{ required: true, message: '规格不能为空', trigger: 'blur' }]"
>
<el-input v-model="item.specification" placeholder="请输入规格" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="index === 0 ? '单位' : ''"
:prop="`itemList.${index}.unit`"
:rules="[{ required: true, message: '单位不能为空', trigger: 'blur' }]"
>
<el-input v-model="item.unit" placeholder="请输入单位" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="index === 0 ? '库存' : ''"
:prop="`itemList.${index}.stockQuantity`"
:rules="[{ required: true, message: '库存不能为空', trigger: 'blur' }]"
>
<el-input v-model="item.stockQuantity" placeholder="请输入库存" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="index === 0 ? '领取' : ''"
:prop="`itemList.${index}.issuedQuantity`"
:rules="[{ required: true, message: '领取数量不能为空', trigger: 'blur' }]"
>
<el-input v-model="item.issuedQuantity" placeholder="请输入领取数量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="index === 0 ? '剩余' : ''"
:prop="`itemList.${index}.remainingQuantity`"
:rules="[{ required: true, message: '剩余数量不能为空', trigger: 'blur' }]"
>
<el-input v-model="item.remainingQuantity" placeholder="请输入剩余数量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="index === 0 ? '备注' : ''" prop="remark">
<el-input v-model="item.remark" placeholder="请输入内容" />
</el-form-item>
</el-col>
<el-col :span="12" v-if="form.itemList.length > 1">
<div class="item-actions">
<el-button type="danger" link @click="removeItem(index)" icon="Delete">删除</el-button>
</div>
</el-col>
</el-row>
</div>
</div>
</el-col>
<el-col :span="12">
<el-form-item label="合格证文件" prop="certCountFileId">
<file-upload :isShowTip="false" v-model="form.certCountFileId" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="出厂报告文件" prop="reportCountFileId">
<file-upload :isShowTip="false" v-model="form.reportCountFileId" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="技术资料文件" prop="techDocCountFileId">
<file-upload :isShowTip="false" v-model="form.techDocCountFileId" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="厂家资质文件" prop="licenseCountFileId">
<file-upload :isShowTip="false" v-model="form.licenseCountFileId" />
</el-form-item>
</el-col>
<el-col :span="24">
<span style="color: #ff0000ab; margin-bottom: 10px; display: block"
>注意请上传doc/xls/ppt/txt/pdf/png/jpg/jpeg/zip格式文件</span
> </el-col
><el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
<wordllssue ref="wordllssueRef"></wordllssue>
</div>
</template>
<script setup name="MaterialIssue" lang="ts">
import { listMaterialIssue, getMaterialIssue, delMaterialIssue, addMaterialIssue, updateMaterialIssue } from '@/api/materials/materialIssue';
import { MaterialIssueVO, MaterialIssueQuery, MaterialIssueForm } from '@/api/materials/materialIssue/types';
import { useUserStoreHook } from '@/store/modules/user';
import wordllssue from './word/index.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
// 获取用户 store
const userStore = useUserStoreHook();
// 从 store 中获取项目列表和当前选中的项目
const currentProject = computed(() => userStore.selectedProject);
const materialIssueList = ref<MaterialIssueVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const wordllssueRef = ref<InstanceType<typeof wordllssue>>();
const queryFormRef = ref<ElFormInstance>();
const materialIssueFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const getInitFormData = () => {
return {
id: undefined,
projectId: currentProject.value?.id,
materialSource: '2',
formCode: undefined,
projectName: undefined,
materialName: undefined,
orderingUnit: undefined,
supplierUnit: undefined,
issueUnit: undefined,
storageUnit: undefined,
defectDescription: undefined,
certCount: undefined,
certCountFileId: undefined,
reportCount: undefined,
reportCountFileId: undefined,
techDocCount: undefined,
techDocCountFileId: undefined,
licenseCount: undefined,
licenseCountFileId: undefined,
remark: undefined,
itemList: [
{
id: undefined,
specification: undefined,
unit: undefined,
stockQuantity: undefined,
issuedQuantity: undefined,
remainingQuantity: undefined,
name: undefined,
remark: undefined
}
]
};
};
const initFormData: MaterialIssueForm = {};
const data = reactive<PageData<MaterialIssueForm, MaterialIssueQuery>>({
form: getInitFormData(),
queryParams: {
pageNum: 1,
pageSize: 10,
projectId: currentProject.value?.id,
materialSource: '2',
formCode: undefined,
projectName: undefined,
materialName: undefined,
orderingUnit: undefined,
supplierUnit: undefined,
issueUnit: undefined,
storageUnit: undefined,
defectDescription: undefined,
params: {}
},
rules: {
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询物料领料单列表 */
const getList = async () => {
loading.value = true;
const res = await listMaterialIssue(queryParams.value);
materialIssueList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = getInitFormData();
materialIssueFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: MaterialIssueVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
reset();
dialog.visible = true;
dialog.title = '添加物料领料单';
};
/** 修改按钮操作 */
const handleUpdate = async (row?: MaterialIssueVO) => {
reset();
const _id = row?.id || ids.value[0];
const res = await getMaterialIssue(_id);
Object.assign(form.value, res.data);
dialog.visible = true;
dialog.title = '修改物料领料单';
};
/** 提交按钮 */
const submitForm = () => {
materialIssueFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updateMaterialIssue(form.value).finally(() => (buttonLoading.value = false));
} else {
await addMaterialIssue(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
// 添加数量验收条目
const addItem = () => {
form.value.itemList.push({
id: undefined,
specification: undefined,
unit: undefined,
stockQuantity: undefined,
issuedQuantity: undefined,
remainingQuantity: undefined,
name: undefined,
remark: undefined
});
};
// 删除数量验收条目
const removeItem = (index: number) => {
if (form.value.itemList.length > 1) {
form.value.itemList.splice(index, 1);
} else {
proxy?.$modal.msgWarning('至少需要保留一条数量验收记录');
}
};
/** 删除按钮操作 */
const handleDelete = async (row?: MaterialIssueVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除物料领料单编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delMaterialIssue(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
const handleView = (row) => {
// 查看详情
wordllssueRef.value?.openDialog(row);
};
onMounted(() => {
getList();
});
//监听项目id刷新数据
const listeningProject = watch(
() => currentProject.value?.id,
(nid, oid) => {
queryParams.value.projectId = nid;
form.value.projectId = nid;
getList();
}
);
onUnmounted(() => {
listeningProject();
});
</script>
<style scoped lang="scss">
.detail {
border-bottom: 1px solid #ececec;
border-top: 1px solid #ececec;
margin: 10px 0;
padding: 10px 0;
&-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
font-weight: bold;
color: #1eaaff;
}
&-item {
padding: 10px;
margin-bottom: 15px;
border-radius: 4px;
background-color: #f8f9fa;
position: relative;
&:last-child {
margin-bottom: 0;
}
}
}
.item-actions {
display: flex;
justify-content: flex-end;
padding-top: 6px;
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 922 B

View File

@ -1,301 +0,0 @@
<template>
<el-dialog v-model="isShowDialog" title="变更单详情" draggable width="60vw" :close-on-click-modal="false" :destroy-on-close="true">
<el-card :body-style="{ padding: '20px' }" style="border: none; box-shadow: none">
<div class="dialog-footer">
<div class="btn-item" @click="onLoad">
<img src="./icon/down.png" />
<span>导出</span>
</div>
</div>
<el-form ref="formRef" :model="formData" label-width="100px" id="formContent" style="width: 75%; margin-left: 10%">
<div class="table-content" id="table-content">
<el-row class="mb20" style="display: flex; justify-content: center">
<h2>设计材料设备领料单</h2>
</el-row>
<el-row class="mb10" style="display: flex; justify-content: space-between">
<div class="head-text">
<span>工程名称</span>
<span>{{ formData.projectName }}</span>
</div>
<div class="head-text">
<span>编号</span>
<span>{{ formData.formCode }}</span>
</div>
</el-row>
<table style="width: 100%" border="1" cellspacing="1">
<thead>
<tr>
<th colspan="2">设备材料名称</th>
<td class="th-bg" colspan="2">{{ formData.materialName }}</td>
<th colspan="2">规格及数量</th>
<td class="th-bg" colspan="2">见下表</td>
</tr>
</thead>
<tbody>
<tr>
<th colspan="2">供货单位</th>
<td class="th-bg" colspan="2">{{ formData.supplierUnit }}</td>
<th colspan="2">订货单位</th>
<td class="th-bg" colspan="2">{{ formData.orderingUnit }}</td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="2">领料单位</th>
<td class="th-bg" colspan="2">{{ formData.placeholder }}</td>
<th colspan="2">保管单位</th>
<td class="th-bg" colspan="2">{{ formData.storageUnit }}</td>
</tr>
</thead>
<tbody>
<tr>
<th width="150" colspan="8">数量验收</th>
</tr>
</tbody>
<thead>
<tr>
<th width="150">序号</th>
<th width="150">名称</th>
<th width="150">规格</th>
<th width="150">单位</th>
<th width="150">库存</th>
<th width="150">领取</th>
<th width="150">剩余</th>
<th width="150">备注</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, i) of formData.itemList" :key="i">
<th width="150">{{ i + 1 }}</th>
<th width="150">{{ item.name }}</th>
<th width="150">{{ item.specification }}</th>
<th width="150">{{ item.unit }}</th>
<th width="150">{{ item.stockQuantity }}</th>
<th width="150">{{ item.issuedQuantity }}</th>
<th width="150">{{ item.remainingQuantity }}</th>
<th width="150">{{ item.remark }}</th>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="7">
<div style="margin-bottom: 10px;">缺陷情况:</div>
{{ formData.defectDescription }}
</td>
</tr>
</tbody>
<tbody>
<tr>
<!-- <th width="150"></th> -->
<td colspan="8">
<span>是否附带以下随机资料</span>
<div class="file_detail">
<span>(1) 合格证 {{ formData.certCountFile ? formData.certCountFile.length : 0 }} </span>
<span>(2) 出厂报告 {{ formData.reportCountFileId ? formData.reportCountFileId.length : 0 }} </span>
<span>(3) 技术资料文件 {{ formData.techDocCountFileId ? formData.techDocCountFileId.length : 0 }} </span>
<span>(4) 厂家资质文件 {{ formData.licenseCountFileId ? formData.licenseCountFileId.length : 0 }} </span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</el-form>
</el-card>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue';
import { getMaterialIssue } from '@/api/materials/materialIssue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { downLoadOss } from '@/api/system/oss';
// 响应式状态
const isShowDialog = ref(false);
const initFormData = {
id: undefined,
materialSource: '1',
formCode: undefined,
projectName: undefined,
materialName: undefined,
orderingUnit: undefined,
supplierUnit: undefined,
issueUnit: undefined,
storageUnit: undefined,
defectDescription: undefined,
certCount: undefined,
certCountFileId: undefined,
reportCount: undefined,
reportCountFileId: undefined,
techDocCount: undefined,
techDocCountFileId: undefined,
licenseCount: undefined,
licenseCountFileId: undefined,
remark: undefined,
itemList: [
{
id: undefined,
specification: undefined,
unit: undefined,
stockQuantity: undefined,
issuedQuantity: undefined,
remainingQuantity: undefined,
name: undefined,
remark: undefined
}
]
};
const data = reactive({
formData: { ...initFormData }
});
const design_change_reason_type = ref([]);
const { formData } = toRefs(data);
// 打开弹窗
const openDialog = (row?: any, types) => {
resetForm();
design_change_reason_type.value = types;
if (row?.id) {
getInfos(row.id, types);
}
isShowDialog.value = true;
};
// 获取详情数据
const getInfos = async (id: string, types) => {
const res = await getMaterialIssue(id);
Object.assign(formData.value, res.data);
// 数据处理
if (formData.value.changeReason) {
let arr = formData.value.changeReason.split(',');
var changeReason = types.filter((item) => arr.includes(item.value.toString())).map((item) => item.label);
formData.value.changeReason = changeReason.join('');
}
};
// 重置表单
const resetForm = () => {
Object.keys(formData.value).forEach((key) => {
formData[key] = undefined;
});
};
// 下载文件
const onOpen = (path: string) => {
window.open(path, '_blank');
};
// 导出
const onLoad = async () => {
await downLoadOss({ id: formData.value.id }, '/materials/materialIssue/export/word', '设计材料设备领料单.zip');
};
// 关闭弹窗
const closeDialog = () => {
isShowDialog.value = false;
};
// 暴露方法给父组件
defineExpose({
openDialog,
closeDialog
});
</script>
<style scoped lang="scss">
.pic-block {
margin-right: 8px;
}
.file-block {
width: 100%;
border: 1px solid var(--el-border-color);
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
transition: var(--el-transition-duration-fast);
margin-bottom: 5px;
padding: 3px 6px;
}
.ml-2 {
margin-right: 5px;
}
::v-deep .el-icon svg {
height: 100% !important;
width: 100% !important;
}
::v-deep .el-step__icon-inner {
font-size: 14px !important;
font-weight: 700 !important;
}
.dialog-footer {
height: 100px;
display: flex;
flex-direction: column;
justify-content: space-between;
position: absolute;
top: 14%;
right: 10%;
background: #fff;
box-shadow: 0px 0px 10px #ddd;
text-align: center;
padding: 20px 10px;
.btn-item {
display: flex;
flex-direction: column;
justify-content: center;
cursor: pointer;
> span {
padding-top: 5px;
font-size: 14px;
font-weight: 400;
color: rgba(51, 51, 51, 1);
}
}
}
.file_detail{
>span{
width: 40%;
display: inline-block;
}
}
table {
border-collapse: collapse; //合并为一个单一的边框
border-color: rgba(199, 199, 199, 1); //边框颜色按实际自定义即可
}
thead {
tr {
th {
background-color: rgba(247, 247, 247, 1); //设置表格标题背景色
height: 35px; //设置单元格最小高度
text-align: center;
letter-spacing: 5px;
padding: 15px;
}
td {
text-align: left;
height: 35px; //设置单元格最小高度
padding: 15px;
}
.th-bg {
background-color: rgba(247, 247, 247, 1);
}
}
}
tbody {
tr {
td {
text-align: left;
height: 40px; //设置单元格最小高度
padding: 15px;
}
th {
height: 35px; //设置单元格最小高度
text-align: center;
letter-spacing: 5px;
padding: 15px;
}
}
}
.table-content {
box-shadow: 0px 0px 10px #ddd;
padding: 20px;
position: relative;
}
</style>

View File

@ -1,502 +0,0 @@
<template>
<div class="p-2">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="表单编号" prop="formCode">
<el-input v-model="queryParams.formCode" placeholder="请输入表单编号" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="工程名称" prop="projectName">
<el-input v-model="queryParams.projectName" placeholder="请输入工程名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="材料名称" prop="materialName">
<el-input v-model="queryParams.materialName" placeholder="请输入设备材料名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="合同名称" prop="contractName">
<el-input v-model="queryParams.contractName" placeholder="请输入合同名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="订货单位" prop="orderingUnit">
<el-input v-model="queryParams.orderingUnit" placeholder="请输入订货单位" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="供货单位" prop="supplierUnit">
<el-input v-model="queryParams.supplierUnit" placeholder="请输入供货单位" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['materials:materialReceive:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete()"
v-hasPermi="['materials:materialReceive:remove']"
>删除</el-button
>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="materialReceiveList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="表单编号" align="center" prop="formCode" />
<el-table-column label="工程名称" align="center" prop="projectName" />
<el-table-column label="设备材料名称" align="center" prop="materialName" />
<el-table-column label="合同名称" align="center" prop="contractName" />
<el-table-column label="订货单位" align="center" prop="orderingUnit" />
<el-table-column label="供货单位" align="center" prop="supplierUnit" />
<el-table-column label="设备材料入库/移交" align="center" prop="storageType">
<template #default="scope">
<dict-tag :options="storage_type" :value="scope.row.storageType ? scope.row.storageType.split(',') : []" />
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="查看" placement="top">
<el-button link type="primary" icon="View" @click="handleView(scope.row)"></el-button>
</el-tooltip>
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['materials:materialReceive:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button
link
type="primary"
icon="Delete"
@click="handleDelete(scope.row)"
v-hasPermi="['materials:materialReceive:remove']"
></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
<!-- 添加或修改物料接收单对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body>
<el-form ref="materialReceiveFormRef" :model="form" :rules="rules" label-width="110px">
<el-row>
<el-col :span="12">
<el-form-item label="表单编号" prop="formCode">
<el-input v-model="form.formCode" placeholder="请输入表单编号" />
</el-form-item>
</el-col>
<el-col :span="12"
><el-form-item label="工程名称" prop="projectName">
<el-input v-model="form.projectName" placeholder="请输入工程名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备材料名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入设备材料名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同名称" prop="contractName">
<el-input v-model="form.contractName" placeholder="请输入合同名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="订货单位" prop="orderingUnit">
<el-input v-model="form.orderingUnit" placeholder="请输入订货单位" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供货单位" prop="supplierUnit">
<el-input v-model="form.supplierUnit" placeholder="请输入供货单位" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="缺陷情况" prop="defectDescription">
<el-input v-model="form.defectDescription" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-col>
<el-col :span="24">
<div class="detail">
<div class="detail-header">
<span>数量验收</span>
<el-button type="primary" link @click="addItem" icon="Plus">添加一行</el-button>
</div>
<div v-for="(item, index) in form.itemList" :key="index" class="detail-item">
<el-row>
<el-col :span="12">
<el-form-item
:label="index === 0 ? '名称' : ''"
:prop="`itemList.${index}.name`"
:rules="{ required: true, message: '名称不能为空', trigger: 'blur' }"
>
<el-input v-model="item.name" placeholder="请输入名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="index === 0 ? '规格' : ''"
:prop="`itemList.${index}.specification`"
:rules="{ required: true, message: '规格不能为空', trigger: 'blur' }"
>
<el-input v-model="item.specification" placeholder="请输入规格" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="index === 0 ? '单位' : ''"
:prop="`itemList.${index}.unit`"
:rules="{ required: true, message: '单位不能为空', trigger: 'blur' }"
>
<el-input v-model="item.unit" placeholder="请输入单位" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="index === 0 ? '数量' : ''"
:prop="`itemList.${index}.quantity`"
:rules="{ required: true, message: '数量不能为空', trigger: 'blur' }"
>
<el-input v-model="item.quantity" placeholder="请输入数量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="index === 0 ? '验收' : ''"
:prop="`itemList.${index}.acceptedQuantity`"
:rules="{ required: true, message: '验收数量不能为空', trigger: 'blur' }"
>
<el-input v-model="item.acceptedQuantity" placeholder="请输入验收" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="index === 0 ? '缺件' : ''"
:prop="`itemList.${index}.shortageQuantity`"
:rules="{ required: true, message: '缺件数量不能为空', trigger: 'blur' }"
>
<el-input v-model="item.shortageQuantity" placeholder="请输入缺件" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="index === 0 ? '备注' : ''" prop="remark">
<el-input v-model="item.remark" placeholder="请输入备注" />
</el-form-item>
</el-col>
<el-col :span="12" v-if="form.itemList.length > 1">
<div class="item-actions">
<el-button type="danger" link @click="removeItem(index)" icon="Delete">删除</el-button>
</div>
</el-col>
</el-row>
</div>
</div>
</el-col>
<el-col :span="12">
<el-form-item label="合格证文件" prop="certCountFileId">
<file-upload :isShowTip="false" v-model="form.certCountFileId" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="出厂报告文件" prop="reportCountFileId">
<file-upload :isShowTip="false" v-model="form.reportCountFileId" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="技术资料文件" prop="techDocCountFileId">
<file-upload :isShowTip="false" v-model="form.techDocCountFileId" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="厂家资质文件" prop="licenseCountFileId">
<file-upload :isShowTip="false" v-model="form.licenseCountFileId" />
</el-form-item>
</el-col>
<el-col :span="24">
<span style="color: #ff0000ab; margin-bottom: 10px; display: block"
>注意请上传doc/xls/ppt/txt/pdf/png/jpg/jpeg/zip格式文件</span
> </el-col
><el-col :span="24"
><el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
<wordllReceive ref="wordllReceiveRef"></wordllReceive>
</div>
</template>
<script setup name="MaterialReceive" lang="ts">
import {
listMaterialReceive,
getMaterialReceive,
delMaterialReceive,
addMaterialReceive,
updateMaterialReceive
} from '@/api/materials/materialReceive';
import { MaterialReceiveVO, MaterialReceiveQuery, MaterialReceiveForm } from '@/api/materials/materialReceive/types';
import { useUserStoreHook } from '@/store/modules/user';
import wordllReceive from './word/index.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { storage_type } = toRefs<any>(proxy?.useDict('storage_type'));
// 获取用户 store
const userStore = useUserStoreHook();
// 从 store 中获取项目列表和当前选中的项目
const currentProject = computed(() => userStore.selectedProject);
const wordllReceiveRef = ref<InstanceType<typeof wordllReceive>>();
const materialReceiveList = ref<MaterialReceiveVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const materialReceiveFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const getInitFormData = () => {
return {
id: undefined,
projectId: currentProject.value?.id,
materialSource: '2',
formCode: undefined,
projectName: undefined,
materialName: undefined,
contractName: undefined,
orderingUnit: undefined,
supplierUnit: undefined,
defectDescription: undefined,
certCount: undefined,
certCountFileId: undefined,
reportCount: undefined,
reportCountFileId: undefined,
techDocCount: undefined,
techDocCountFileId: undefined,
licenseCount: undefined,
licenseCountFileId: undefined,
storageType: [],
remark: undefined,
itemList: [
{
name: undefined,
specification: undefined,
unit: undefined,
quantity: undefined,
acceptedQuantity: undefined,
shortageQuantity: undefined,
remark: undefined
}
]
};
};
const data = reactive<PageData<MaterialReceiveForm, MaterialReceiveQuery>>({
form: getInitFormData(),
queryParams: {
pageNum: 1,
pageSize: 10,
projectId: currentProject.value?.id,
materialSource: '2',
formCode: undefined,
projectName: undefined,
materialName: undefined,
contractName: undefined,
orderingUnit: undefined,
supplierUnit: undefined,
params: {}
},
rules: {}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询物料接收单列表 */
const getList = async () => {
loading.value = true;
const res = await listMaterialReceive(queryParams.value);
materialReceiveList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = getInitFormData();
materialReceiveFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: MaterialReceiveVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
reset();
dialog.visible = true;
dialog.title = '添加物料接收单';
};
/** 修改按钮操作 */
const handleUpdate = async (row?: MaterialReceiveVO) => {
reset();
const _id = row?.id || ids.value[0];
const res = await getMaterialReceive(_id);
Object.assign(form.value, res.data);
if (form.value.storageType.length) {
form.value.storageType = form.value.storageType.split(',');
} else {
form.value.storageType = [];
}
dialog.visible = true;
dialog.title = '修改物料接收单';
};
/** 提交按钮 */
const submitForm = () => {
materialReceiveFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
form.value.storageType = form.value.storageType.join(',');
if (form.value.id) {
await updateMaterialReceive(form.value).finally(() => (buttonLoading.value = false));
} else {
await addMaterialReceive(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: MaterialReceiveVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除物料接收单编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delMaterialReceive(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
// 添加数量验收条目
const addItem = () => {
form.value.itemList.push({
name: undefined,
specification: undefined,
unit: undefined,
quantity: undefined,
acceptedQuantity: undefined,
shortageQuantity: undefined,
remark: undefined
});
};
// 删除数量验收条目
const removeItem = (index: number) => {
if (form.value.itemList.length > 1) {
form.value.itemList.splice(index, 1);
} else {
proxy?.$modal.msgWarning('至少需要保留一条数量验收记录');
}
};
const handleView = (row) => {
// 查看详情
wordllReceiveRef.value?.openDialog(row);
};
onMounted(() => {
getList();
});
//监听项目id刷新数据
const listeningProject = watch(
() => currentProject.value?.id,
(nid, oid) => {
queryParams.value.projectId = nid;
form.value.projectId = nid;
getList();
}
);
onUnmounted(() => {
listeningProject();
});
</script>
<style scoped lang="scss">
.detail {
border-bottom: 1px solid #ececec;
border-top: 1px solid #ececec;
margin: 10px 0;
padding: 10px 0;
&-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
font-weight: bold;
color: #1eaaff;
}
&-item {
padding: 10px;
margin-bottom: 15px;
border-radius: 4px;
background-color: #f8f9fa;
position: relative;
&:last-child {
margin-bottom: 0;
}
}
}
.item-actions {
display: flex;
justify-content: flex-end;
padding-top: 6px;
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 922 B

View File

@ -1,290 +0,0 @@
<template>
<el-dialog v-model="isShowDialog" title="变更单详情" draggable width="60vw" :close-on-click-modal="false" :destroy-on-close="true">
<el-card :body-style="{ padding: '20px' }" style="border: none; box-shadow: none">
<div class="dialog-footer">
<div class="btn-item" @click="onLoad">
<img src="./icon/down.png" />
<span>导出</span>
</div>
</div>
<el-form ref="formRef" :model="formData" label-width="100px" id="formContent" style="width: 75%; margin-left: 10%">
<div class="table-content" id="table-content">
<el-row class="mb20" style="display: flex; justify-content: center">
<h2>材料设备验收单</h2>
</el-row>
<el-row class="mb10" style="display: flex; justify-content: space-between">
<div class="head-text">
<span>工程名称</span>
<span>{{ formData.projectName }}</span>
</div>
<div class="head-text">
<span>编号</span>
<span>{{ formData.formCode }}</span>
</div>
</el-row>
<table style="width: 100%" border="1" cellspacing="1">
<thead>
<tr>
<th colspan="2">设备材料名称</th>
<td class="th-bg" colspan="2">{{ formData.materialName }}</td>
<th colspan="2">合同名称</th>
<td class="th-bg" colspan="2">{{ formData.contractName }}</td>
</tr>
</thead>
<tbody>
<tr>
<th colspan="2">订货单位</th>
<td class="th-bg" colspan="2">{{ formData.orderingUnit }}</td>
<th colspan="2">供货单位</th>
<td class="th-bg" colspan="2">{{ formData.supplierUnit }}</td>
</tr>
</tbody>
<tbody>
<tr>
<th width="150" colspan="8">数量验收验收缺件数量由承包单位填写</th>
</tr>
</tbody>
<thead>
<tr>
<th width="150">序号</th>
<th width="150">名称</th>
<th width="150">规格</th>
<th width="150">单位</th>
<th width="150">数量</th>
<th width="150">验收</th>
<th width="150">缺件</th>
<th width="150">备注</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, i) of formData.itemList" :key="i">
<th width="150">{{ i + 1 }}</th>
<th width="150">{{ item.name }}</th>
<th width="150">{{ item.specification }}</th>
<th width="150">{{ item.unit }}</th>
<th width="150">{{ item.quantity }}</th>
<th width="150">{{ item.acceptedQuantity }}</th>
<th width="150">{{ item.shortageQuantity }}</th>
<th width="150">{{ item.remark }}</th>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="7">
<div style="margin-bottom: 10px">缺陷情况:</div>
{{ formData.defectDescription }}
</td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="8">
<span>是否附带以下随机资料</span>
<div class="file_detail">
<span>(1) 合格证 {{ formData.certCountFile ? formData.certCountFile.length : 0 }} </span>
<span>(2) 出厂报告 {{ formData.reportCountFileId ? formData.reportCountFileId.length : 0 }} </span>
<span>(3) 技术资料文件 {{ formData.techDocCountFileId ? formData.techDocCountFileId.length : 0 }} </span>
<span>(4) 厂家资质文件 {{ formData.licenseCountFileId ? formData.licenseCountFileId.length : 0 }} </span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</el-form>
</el-card>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue';
import { getMaterialReceive } from '@/api/materials/materialReceive';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { downLoadOss } from '@/api/system/oss';
// 响应式状态
const isShowDialog = ref(false);
const initFormData = {
id: undefined,
materialSource: '1',
formCode: undefined,
projectName: undefined,
materialName: undefined,
contractName: undefined,
orderingUnit: undefined,
supplierUnit: undefined,
defectDescription: undefined,
certCount: undefined,
certCountFileId: undefined,
reportCount: undefined,
reportCountFileId: undefined,
techDocCount: undefined,
techDocCountFileId: undefined,
licenseCount: undefined,
licenseCountFileId: undefined,
storageType: [],
remark: undefined,
itemList: [
{
name: undefined,
specification: undefined,
unit: undefined,
quantity: undefined,
acceptedQuantity: undefined,
shortageQuantity: undefined,
remark: undefined
}
]
};
const data = reactive({
formData: { ...initFormData }
});
const design_change_reason_type = ref([]);
const { formData } = toRefs(data);
// 打开弹窗
const openDialog = (row?: any, types) => {
resetForm();
design_change_reason_type.value = types;
if (row?.id) {
getInfos(row.id, types);
}
isShowDialog.value = true;
};
// 获取详情数据
const getInfos = async (id: string, types) => {
const res = await getMaterialReceive(id);
Object.assign(formData.value, res.data);
// 数据处理
if (formData.value.changeReason) {
let arr = formData.value.changeReason.split(',');
var changeReason = types.filter((item) => arr.includes(item.value.toString())).map((item) => item.label);
formData.value.changeReason = changeReason.join('');
}
};
// 重置表单
const resetForm = () => {
Object.keys(formData.value).forEach((key) => {
formData[key] = undefined;
});
};
// 下载文件
const onOpen = (path: string) => {
window.open(path, '_blank');
};
// 导出
const onLoad = async () => {
await downLoadOss({ id: formData.value.id }, '/materials/materialReceive/export/word', '材料设备验收单.zip');
};
// 关闭弹窗
const closeDialog = () => {
isShowDialog.value = false;
};
// 暴露方法给父组件
defineExpose({
openDialog,
closeDialog
});
</script>
<style scoped lang="scss">
.pic-block {
margin-right: 8px;
}
.file-block {
width: 100%;
border: 1px solid var(--el-border-color);
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
transition: var(--el-transition-duration-fast);
margin-bottom: 5px;
padding: 3px 6px;
}
.ml-2 {
margin-right: 5px;
}
::v-deep .el-icon svg {
height: 100% !important;
width: 100% !important;
}
::v-deep .el-step__icon-inner {
font-size: 14px !important;
font-weight: 700 !important;
}
.dialog-footer {
height: 100px;
display: flex;
flex-direction: column;
justify-content: space-between;
position: absolute;
top: 14%;
right: 10%;
background: #fff;
box-shadow: 0px 0px 10px #ddd;
text-align: center;
padding: 20px 10px;
.btn-item {
display: flex;
flex-direction: column;
justify-content: center;
cursor: pointer;
> span {
padding-top: 5px;
font-size: 14px;
font-weight: 400;
color: rgba(51, 51, 51, 1);
}
}
}
.file_detail {
> span {
width: 40%;
display: inline-block;
}
}
table {
border-collapse: collapse; //合并为一个单一的边框
border-color: rgba(199, 199, 199, 1); //边框颜色按实际自定义即可
}
thead {
tr {
th {
background-color: rgba(247, 247, 247, 1); //设置表格标题背景色
height: 35px; //设置单元格最小高度
text-align: center;
letter-spacing: 5px;
padding: 15px;
}
td {
text-align: left;
height: 35px; //设置单元格最小高度
padding: 15px;
}
.th-bg {
background-color: rgba(247, 247, 247, 1);
}
}
}
tbody {
tr {
td {
text-align: left;
height: 40px; //设置单元格最小高度
padding: 15px;
}
th {
height: 35px; //设置单元格最小高度
text-align: center;
letter-spacing: 5px;
padding: 15px;
}
}
}
.table-content {
box-shadow: 0px 0px 10px #ddd;
padding: 20px;
position: relative;
}
</style>

View File

@ -31,7 +31,8 @@
<el-table v-loading="loading" :data="materialsInventoryList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" type="index" width="60" align="center" />
<el-table-column label="材料名称" align="center" prop="materialsName" />
<el-table-column label="物资名称" align="center" prop="materialsName" />
<el-table-column label="计划数量" align="center" prop="quantityCount" />
<el-table-column label="入库登记" align="center">
<el-table-column label="数量" align="center" prop="number">
<template #default="scope">

View File

@ -441,6 +441,7 @@ const getSupplierList = async () => {
pageSize: 10000
});
supplierOptions.value = res.rows;
console.log('🚀 ~ getSupplierList ~ res.rows:', res.rows);
};
onMounted(() => {

View File

@ -1,4 +1,5 @@
<template>
<<<<<<< HEAD
<div class="overall-plan-material-supply">
<!-- tabPosition="left" -->
<el-card shadow="always">
@ -313,3 +314,20 @@ onMounted(() => {
margin-bottom: 0;
}
</style>
=======
<div>init</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
setup() {
// todo
return {};
}
});
</script>
<style lang="stylus" scoped></style>
>>>>>>> 90e6ddc21241aecd8dcdfb84d82b9283ab193ccf

View File

@ -4,9 +4,6 @@
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="项目ID" prop="projectId">
<el-input v-model="queryParams.projectId" placeholder="请输入项目ID" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="采购单编号" prop="docCode">
<el-input v-model="queryParams.docCode" placeholder="请输入采购单编号" clearable @keyup.enter="handleQuery" />
</el-form-item>
@ -86,18 +83,13 @@
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['cailiaoshebei:purchaseDoc:export']">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="purchaseDocList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键ID" align="center" prop="id" v-if="true" />
<el-table-column label="项目ID" align="center" prop="projectId" />
<el-table-column label="采购单编号" align="center" prop="docCode" />
<el-table-column label="采购单编号" align="center" prop="docCode" width="90" />
<el-table-column label="供应商" align="center" prop="supplier" />
<el-table-column label="事由" align="center" prop="reason" />
<el-table-column label="设备统称" align="center" prop="name" />
@ -106,40 +98,50 @@
<span>{{ parseTime(scope.row.arrivalDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="设计负责人联系方式" align="center" prop="designDirectorTel" />
<el-table-column label="现场技术负责人联系方式" align="center" prop="technicalDirectorTel" />
<el-table-column label="负责人联系方式" align="center" prop="designDirectorTel" width="130" />
<el-table-column label="现场联系方式" align="center" prop="technicalDirectorTel" width="130" />
<el-table-column label="收货地址" align="center" prop="receivingAddress" />
<el-table-column label="联系人" align="center" prop="contacts" />
<el-table-column label="项目负责人" align="center" prop="projectDirector" />
<el-table-column label="采购经办人" align="center" prop="purchasingAgent" />
<el-table-column label="项目负责人" align="center" prop="projectDirector" width="90" />
<el-table-column label="采购经办人" align="center" prop="purchasingAgent" width="90" />
<el-table-column label="日期" align="center" prop="preparedDate" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.preparedDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="反馈文件地址" align="center" prop="feedbackUrl" />
<el-table-column label="签收单位" align="center" prop="signingUnit" />
<el-table-column label="签收人" align="center" prop="signingPerson" />
<el-table-column label="签收日期" align="center" prop="signingDate" width="180">
<el-table-column label="文件地址" align="center" prop="feedbackUrl" width="130">
<template #default="scope">
<span>{{ parseTime(scope.row.signingDate, '{y}-{m}-{d}') }}</span>
<el-link :href="scope.row.feedbackUrl" target="_blank" type="primary" v-if="scope.row.feedbackUrl">回单</el-link>
</template>
</el-table-column>
<el-table-column label="审核状态" align="center" prop="status" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="审核状态" align="center" prop="status">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['cailiaoshebei:purchaseDoc:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button
link
type="primary"
icon="Delete"
@click="handleDelete(scope.row)"
v-hasPermi="['cailiaoshebei:purchaseDoc:remove']"
></el-button>
</el-tooltip>
<dict-tag :options="wf_business_status" :value="scope.row.status"></dict-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="160">
<template #default="scope">
<div class="flex flex-wrap">
<div class="flex">
<div class="w3"></div>
<el-button link type="primary" icon="Finished" @click="handleAudit(scope.row)" v-hasPermi="['cailiaoshebei:purchaseDoc:edit']">
审核</el-button
>
<el-button link type="primary" icon="Upload" @click="handleUpload(scope.row)" v-hasPermi="['cailiaoshebei:purchaseDoc:edit']"
>上传</el-button
>
</div>
<br />
<div class="w3"></div>
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['cailiaoshebei:purchaseDoc:edit']"
>修改</el-button
>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['cailiaoshebei:purchaseDoc:remove']"
>删除</el-button
>
</div>
</template>
</el-table-column>
</el-table>
@ -147,62 +149,71 @@
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
<!-- 添加或修改物资-采购联系单对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="purchaseDocFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="项目ID" prop="projectId">
<el-input v-model="form.projectId" placeholder="请输入项目ID" />
</el-form-item>
<el-form-item label="采购单编号" prop="docCode">
<el-input v-model="form.docCode" placeholder="请输入采购单编号" />
</el-form-item>
<el-form-item label="供应商" prop="supplier">
<el-input v-model="form.supplier" placeholder="请输入供应商" />
</el-form-item>
<el-form-item label="事由" prop="reason">
<el-input v-model="form.reason" placeholder="请输入事由" />
</el-form-item>
<el-form-item label="设备统称" prop="name">
<el-input v-model="form.name" placeholder="请输入设备统称" />
</el-form-item>
<el-form-item label="到货日期" prop="arrivalDate">
<el-date-picker clearable v-model="form.arrivalDate" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择到货日期">
</el-date-picker>
</el-form-item>
<el-form-item label="设计负责人联系方式" prop="designDirectorTel">
<el-input v-model="form.designDirectorTel" placeholder="请输入设计负责人联系方式" />
</el-form-item>
<el-form-item label="现场技术负责人联系方式" prop="technicalDirectorTel">
<el-input v-model="form.technicalDirectorTel" placeholder="请输入现场技术负责人联系方式" />
</el-form-item>
<el-form-item label="收货地址" prop="receivingAddress">
<el-input v-model="form.receivingAddress" placeholder="请输入收货地址" />
</el-form-item>
<el-form-item label="联系人" prop="contacts">
<el-input v-model="form.contacts" placeholder="请输入联系人" />
</el-form-item>
<el-form-item label="项目负责人" prop="projectDirector">
<el-input v-model="form.projectDirector" placeholder="请输入项目负责人" />
</el-form-item>
<el-form-item label="采购经办人" prop="purchasingAgent">
<el-input v-model="form.purchasingAgent" placeholder="请输入采购经办人" />
</el-form-item>
<el-form-item label="日期" prop="preparedDate">
<el-date-picker clearable v-model="form.preparedDate" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="反馈文件地址" prop="feedbackUrl">
<el-input v-model="form.feedbackUrl" placeholder="请输入反馈文件地址" />
</el-form-item>
<el-form-item label="签收单位" prop="signingUnit">
<el-input v-model="form.signingUnit" placeholder="请输入签收单位" />
</el-form-item>
<el-form-item label="签收人" prop="signingPerson">
<el-input v-model="form.signingPerson" placeholder="请输入签收人" />
</el-form-item>
<el-form-item label="签收日期" prop="signingDate">
<el-date-picker clearable v-model="form.signingDate" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择签收日期">
</el-date-picker>
</el-form-item>
<el-dialog :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body>
<el-form ref="purchaseDocFormRef" :model="form" :rules="rules" label-width="120px">
<el-row :gutter="20">
<el-col :span="12" :offset="0"
><el-form-item label="采购单编号" prop="docCode"> <el-input v-model="form.docCode" placeholder="请输入采购单编号" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="供应商" prop="supplier">
<!-- <el-input v-model="form.supplier" placeholder="请输入供应商" /> -->
<el-select v-model="form.supplier" value-key="id" placeholder="请选择供应商" clearable filterable @change="">
<el-option v-for="item in supplierOptions" :key="item.id" :label="item.name" :value="item.name"> </el-option>
</el-select> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="需求批次号" prop="mrpBaseId">
<el-select v-model="form.mrpBaseId" value-key="id" placeholder="请选择需求批次号" filterable @change="getPlanList">
<el-option v-for="item in batchOptions" :key="item.id" :label="item.planCode" :value="item.id"> </el-option>
</el-select> </el-form-item
></el-col>
<el-col :span="12" :offset="0">
<el-form-item label="需求计划" prop="planId">
<el-select v-model="form.planId" value-key="id" placeholder="请选择需求计划" multiple filterable :disabled="!form.mrpBaseId">
<el-option v-for="item in planList" :key="item.id" :label="item.name" :value="item.id"> </el-option>
</el-select> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="事由" prop="reason"> <el-input v-model="form.reason" placeholder="请输入事由" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0">
<el-form-item label="设备统称" prop="name"> <el-input v-model="form.name" placeholder="请输入设备统称" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="到货日期" prop="arrivalDate">
<el-date-picker clearable v-model="form.arrivalDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择到货日期">
</el-date-picker> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="负责人联系方式" prop="designDirectorTel">
<el-input v-model="form.designDirectorTel" placeholder="请输入设计负责人联系方式" type="number" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="现场联系方式" prop="technicalDirectorTel">
<el-input v-model="form.technicalDirectorTel" placeholder="请输入现场技术负责人联系方式" type="number" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0">
<el-form-item label="收货地址" prop="receivingAddress">
<el-input v-model="form.receivingAddress" placeholder="请输入收货地址" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0">
<el-form-item label="联系人" prop="contacts"> <el-input v-model="form.contacts" placeholder="请输入联系人" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="项目负责人" prop="projectDirector">
<el-input v-model="form.projectDirector" placeholder="请输入项目负责人" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="采购经办人" prop="purchasingAgent">
<el-input v-model="form.purchasingAgent" placeholder="请输入采购经办人" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="日期" prop="preparedDate">
<el-date-picker clearable v-model="form.preparedDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择日期">
</el-date-picker> </el-form-item
></el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
@ -211,17 +222,34 @@
</div>
</template>
</el-dialog>
<el-dialog title="上传文件" v-model="uploadDialogVisible" width="30%">
<file-upload v-model="feedbackUrl" :file-type="['pdf']" :onUploadSuccess="handleSuccess" />
<template #footer>
<span>
<el-button @click="uploadDialogVisible = false">取消</el-button>
<el-button type="primary" @click="uploadFile">确定</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script setup name="PurchaseDoc" lang="ts">
import { getBatch, listBatch } from '@/api/materials/batchPlan';
import { listPurchaseDoc, getPurchaseDoc, delPurchaseDoc, addPurchaseDoc, updatePurchaseDoc } from '@/api/materials/purchaseDoc';
import { PurchaseDocVO, PurchaseDocQuery, PurchaseDocForm } from '@/api/materials/purchaseDoc/types';
import { listContractor } from '@/api/project/contractor';
import { useUserStoreHook } from '@/store/modules/user';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
const router = useRouter();
const { supply, wf_business_status } = toRefs<any>(proxy?.useDict('supply', 'wf_business_status'));
// 获取用户 store
const userStore = useUserStoreHook();
// 从 store 中获取项目列表和当前选中的项目
const currentProject = computed(() => userStore.selectedProject);
const uploadDialogVisible = ref(false);
const purchaseDocList = ref<PurchaseDocVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
@ -230,7 +258,7 @@ const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const feedbackUrl = ref('');
const queryFormRef = ref<ElFormInstance>();
const purchaseDocFormRef = ref<ElFormInstance>();
@ -238,10 +266,14 @@ const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const batchOptions = ref([]);
const supplierOptions = ref([]);
const initFormData: PurchaseDocForm = {
const planList = ref([]);
const initFormData: any = {
id: undefined,
projectId: undefined,
projectId: currentProject.value?.id,
docCode: undefined,
supplier: undefined,
reason: undefined,
@ -251,6 +283,8 @@ const initFormData: PurchaseDocForm = {
technicalDirectorTel: undefined,
receivingAddress: undefined,
contacts: undefined,
associationList: [],
projectDirector: undefined,
purchasingAgent: undefined,
preparedDate: undefined,
@ -260,12 +294,13 @@ const initFormData: PurchaseDocForm = {
signingDate: undefined,
status: undefined
};
const data = reactive<PageData<PurchaseDocForm, PurchaseDocQuery>>({
const data = reactive({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
projectId: undefined,
projectId: currentProject.value?.id,
docCode: undefined,
supplier: undefined,
reason: undefined,
@ -311,6 +346,7 @@ const cancel = () => {
const reset = () => {
form.value = { ...initFormData };
purchaseDocFormRef.value?.resetFields();
form.value.projectId = currentProject.value?.id;
};
/** 搜索按钮操作 */
@ -345,6 +381,9 @@ const handleUpdate = async (row?: PurchaseDocVO) => {
const _id = row?.id || ids.value[0];
const res = await getPurchaseDoc(_id);
Object.assign(form.value, res.data);
getPlanList();
form.value.planId = form.value.associationList?.map((item: any) => item.planId);
dialog.visible = true;
dialog.title = '修改物资-采购联系单';
};
@ -354,6 +393,10 @@ const submitForm = () => {
purchaseDocFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
form.value.associationList = form.value.planId?.map((item: any) => ({
planId: item
}));
if (form.value.id) {
await updatePurchaseDoc(form.value).finally(() => (buttonLoading.value = false));
} else {
@ -366,6 +409,38 @@ const submitForm = () => {
});
};
const getPlanList = async () => {
form.value.planId = '';
const res = await getBatch({
pageNum: 1,
pageSize: 10,
mrpBaseId: undefined,
projectId: currentProject.value?.id,
mrpBaseId: form.value.mrpBaseId
});
planList.value = res.rows;
};
const getBatchList = async () => {
const res = await listBatch({
pageNum: 1,
pageSize: 10,
planCode: undefined,
projectId: currentProject.value?.id
});
batchOptions.value = res.rows.filter((item) => item.status == 'finish');
};
const getSupplierList = async () => {
const res = await listContractor({
projectId: currentProject.value?.id,
pageNum: 1,
contractorType: 4,
pageSize: 10000
});
supplierOptions.value = res.rows;
};
/** 删除按钮操作 */
const handleDelete = async (row?: PurchaseDocVO) => {
const _ids = row?.id || ids.value;
@ -376,17 +451,54 @@ const handleDelete = async (row?: PurchaseDocVO) => {
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
'cailiaoshebei/purchaseDoc/export',
{
...queryParams.value
},
`purchaseDoc_${new Date().getTime()}.xlsx`
);
const handleUpload = (row?: PurchaseDocVO) => {
form.value.feedbackUrl = '';
form.value.id = row.id;
uploadDialogVisible.value = true;
};
const uploadFile = async () => {
if (!feedbackUrl.value) {
proxy?.$modal.msgError('请上传文件');
return;
}
await updatePurchaseDoc(form.value).finally(() => (buttonLoading.value = false));
proxy?.$modal.msgSuccess('操作成功');
uploadDialogVisible.value = false;
await getList();
};
const handleSuccess = (list, res: any) => {
form.value.feedbackUrl = res.data.url;
};
/** 审核按钮操作 */
const handleAudit = async (row?: PurchaseDocVO) => {
proxy?.$tab.closePage(route);
proxy?.$tab.openPage('/materials/purchaseDoc/indexEdit', '审核采购联系单', {
id: row.id,
type: 'update'
});
};
onMounted(() => {
getList();
getSupplierList();
getBatchList();
});
//监听项目id刷新数据
const listeningProject = watch(
() => currentProject.value?.id,
(nid, oid) => {
queryParams.value.projectId = nid;
form.value.projectId = nid;
getList();
}
);
onUnmounted(() => {
listeningProject();
});
</script>

View File

@ -0,0 +1,439 @@
<template>
<div class="p-4 bg-gray-50">
<div class="max-w-4xl mx-auto">
<!-- 顶部按钮区域 -->
<el-card class="mb-4 rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md">
<approvalButton
@submitForm="submitForm"
@approvalVerifyOpen="approvalVerifyOpen"
@handleApprovalRecord="handleApprovalRecord"
:buttonLoading="buttonLoading"
:id="form.id"
:status="form.status"
:pageType="routeParams.type"
/>
</el-card>
<!-- 表单区域 -->
<el-card class="rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md overflow-hidden">
<div class="p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-100">
<h3 class="text-lg font-semibold text-gray-800">采购单信息</h3>
</div>
<div class="p-6">
<el-form ref="leaveFormRef" disabled :model="form" label-width="100px" class="space-y-4">
<el-row :gutter="20">
<el-col :span="12" :offset="0"
><el-form-item label="采购单编号" prop="docCode"> <el-input v-model="form.docCode" placeholder="请输入采购单编号" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="供应商" prop="supplier">
<el-select v-model="form.supplier" value-key="id" placeholder="请选择供应商" clearable filterable @change="">
<el-option v-for="item in supplierOptions" :key="item.id" :label="item.name" :value="item.name"> </el-option>
</el-select> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="需求批次号" prop="mrpBaseId">
<el-select v-model="form.mrpBaseId" value-key="id" placeholder="请选择需求批次号" filterable @change="getPlanList">
<el-option v-for="item in batchOptions" :key="item.id" :label="item.planCode" :value="item.id"> </el-option>
</el-select> </el-form-item
></el-col>
<el-col :span="12" :offset="0">
<el-form-item label="需求计划" prop="planId">
<el-select v-model="form.planId" value-key="id" placeholder="请选择需求计划" multiple filterable :disabled="!form.mrpBaseId">
<el-option v-for="item in planList" :key="item.id" :label="item.name" :value="item.id"> </el-option>
</el-select> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="事由" prop="reason"> <el-input v-model="form.reason" placeholder="请输入事由" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0">
<el-form-item label="设备统称" prop="name"> <el-input v-model="form.name" placeholder="请输入设备统称" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="到货日期" prop="arrivalDate">
<el-date-picker clearable v-model="form.arrivalDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择到货日期">
</el-date-picker> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="负责人联系方式" prop="designDirectorTel">
<el-input v-model="form.designDirectorTel" placeholder="请输入设计负责人联系方式" type="number" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="现场联系方式" prop="technicalDirectorTel">
<el-input v-model="form.technicalDirectorTel" placeholder="请输入现场技术负责人联系方式" type="number" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0">
<el-form-item label="收货地址" prop="receivingAddress">
<el-input v-model="form.receivingAddress" placeholder="请输入收货地址" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0">
<el-form-item label="联系人" prop="contacts"> <el-input v-model="form.contacts" placeholder="请输入联系人" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="项目负责人" prop="projectDirector">
<el-input v-model="form.projectDirector" placeholder="请输入项目负责人" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="采购经办人" prop="purchasingAgent">
<el-input v-model="form.purchasingAgent" placeholder="请输入采购经办人" /> </el-form-item
></el-col>
<el-col :span="12" :offset="0"
><el-form-item label="日期" prop="preparedDate">
<el-date-picker clearable v-model="form.preparedDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择日期">
</el-date-picker> </el-form-item
></el-col>
</el-row>
</el-form>
</div>
</el-card>
<!-- 提交组件 -->
<submitVerify ref="submitVerifyRef" :task-variables="taskVariables" @submit-callback="submitCallback" />
<approvalRecord ref="approvalRecordRef"></approvalRecord>
<!-- 流程选择对话框 -->
<el-dialog
draggable
v-model="dialogVisible.visible"
:title="dialogVisible.title"
:before-close="handleClose"
width="500"
class="rounded-lg shadow-lg"
>
<div class="p-4">
<p class="text-gray-600 mb-4">请选择要启动的流程</p>
<el-select v-model="flowCode" placeholder="请选择流程" style="width: 100%">
<el-option v-for="item in flowCodeOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
<template #footer>
<div class="dialog-footer p-4 border-t border-gray-100 flex justify-end space-x-3">
<el-button @click="handleClose" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors"
>取消</el-button
>
<el-button type="primary" @click="submitFlow()" class="px-4 py-2 bg-primary text-white rounded-md hover:bg-primary/90 transition-colors"
>确认</el-button
>
</div>
</template>
</el-dialog>
</div>
</div>
</template>
<script setup name="Leave" lang="ts">
import { LeaveForm } from '@/api/workflow/leave/types';
import { startWorkFlow } from '@/api/workflow/task';
import SubmitVerify from '@/components/Process/submitVerify.vue';
import ApprovalRecord from '@/components/Process/approvalRecord.vue';
import ApprovalButton from '@/components/Process/approvalButton.vue';
import { StartProcessBo } from '@/api/workflow/workflowCommon/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { useUserStoreHook } from '@/store/modules/user';
import { getDrawing } from '@/api/design/drawing';
import { updateDesignChange, getDesignChange } from '@/api/design/designChange';
import { getPurchaseDoc } from '@/api/materials/purchaseDoc';
import { getBatch } from '@/api/materials/batchPlan';
// 获取用户 store
const userStore = useUserStoreHook();
// 从 store 中获取项目列表和当前选中的项目
const currentProject = computed(() => userStore.selectedProject);
const buttonLoading = ref(false);
const loading = ref(true);
//路由参数
const routeParams = ref<Record<string, any>>({});
const flowCodeOptions = [
{
value: currentProject.value?.id + '_purchaseDoc',
label: '采购单审批'
}
];
const flowCode = ref<string>('');
const status = ref<string>('');
const dialogVisible = reactive<DialogOption>({
visible: false,
title: '流程定义'
});
//提交组件
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
//审批记录组件
const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
//按钮组件
const approvalButtonRef = ref<InstanceType<typeof ApprovalButton>>();
const leaveFormRef = ref<ElFormInstance>();
const dialog = reactive({
visible: false,
title: '',
isEdit: false
});
const submitFormData = ref<StartProcessBo>({
businessId: '',
flowCode: '',
variables: {}
});
const taskVariables = ref<Record<string, any>>({});
const initFormData = {
id: undefined,
projectId: currentProject.value?.id,
docCode: undefined,
supplier: undefined,
reason: undefined,
name: undefined,
arrivalDate: undefined,
designDirectorTel: undefined,
technicalDirectorTel: undefined,
receivingAddress: undefined,
contacts: undefined,
associationList: [],
projectDirector: undefined,
purchasingAgent: undefined,
preparedDate: undefined,
feedbackUrl: undefined,
signingUnit: undefined,
signingPerson: undefined,
signingDate: undefined,
status: undefined
};
const data = reactive({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
projectId: currentProject.value?.id,
fileName: undefined,
fileType: undefined,
fileSuffix: undefined,
fileStatus: undefined,
originalName: undefined,
newest: undefined,
params: {}
}
});
const handleClose = () => {
dialogVisible.visible = false;
flowCode.value = '';
buttonLoading.value = false;
};
const { form, rules } = toRefs(data);
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
leaveFormRef.value?.resetFields();
};
/** 获取详情 */
const getInfo = () => {
loading.value = true;
buttonLoading.value = false;
nextTick(async () => {
const res = await getPurchaseDoc(routeParams.value.id);
Object.assign(form.value, res.data);
getPlanList();
form.value.planId = form.value.associationList?.map((item: any) => item.planId);
loading.value = false;
buttonLoading.value = false;
});
};
const planList = ref([]);
const getPlanList = async () => {
form.value.planId = '';
const res = await getBatch({
pageNum: 1,
pageSize: 10,
mrpBaseId: undefined,
projectId: currentProject.value?.id,
mrpBaseId: form.value.mrpBaseId
});
planList.value = res.rows;
};
/** 提交按钮 */
const submitForm = (status1: string) => {
status.value = status1;
dialog.visible = false;
submit(status.value, form.value);
};
const submitFlow = async () => {
handleStartWorkFlow(form.value);
dialogVisible.visible = false;
};
//提交申请
const handleStartWorkFlow = async (data: LeaveForm) => {
try {
submitFormData.value.flowCode = flowCode.value;
submitFormData.value.businessId = data.id;
//流程变量
taskVariables.value = {
// leave4/5 使用的流程变量
userList: ['1', '3', '4']
};
submitFormData.value.variables = taskVariables.value;
const resp = await startWorkFlow(submitFormData.value);
if (submitVerifyRef.value) {
buttonLoading.value = false;
submitVerifyRef.value.openDialog(resp.data.taskId);
}
} finally {
buttonLoading.value = false;
}
};
//审批记录
const handleApprovalRecord = () => {
approvalRecordRef.value.init(form.value.id);
};
//提交回调
const submitCallback = async () => {
await proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1);
};
//审批
const approvalVerifyOpen = async () => {
submitVerifyRef.value.openDialog(routeParams.value.taskId, true, routeParams.value.businessId);
// submitVerifyRef.value.openDialog(routeParams.value.taskId);
};
// 图纸上传成功之后 开始提交
const submit = async (status, data) => {
form.value = data;
if (status === 'draft') {
buttonLoading.value = false;
proxy?.$modal.msgSuccess('暂存成功');
proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1);
} else {
if ((form.value.status === 'draft' && (flowCode.value === '' || flowCode.value === null)) || routeParams.value.type === 'add') {
flowCode.value = flowCodeOptions[0].value;
dialogVisible.visible = true;
return;
}
//说明启动过先随意穿个参数
if (flowCode.value === '' || flowCode.value === null) {
flowCode.value = 'xx';
}
console.log(data);
await handleStartWorkFlow(data);
}
};
onMounted(() => {
nextTick(async () => {
routeParams.value = proxy.$route.query;
reset();
loading.value = false;
if (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval') {
getInfo();
}
});
});
</script>
<style scoped lang="scss">
/* 全局样式 */
:root {
--primary: #409eff;
--primary-light: #66b1ff;
--primary-dark: #3a8ee6;
--success: #67c23a;
--warning: #e6a23c;
--danger: #f56c6c;
--info: #909399;
}
/* 表单样式优化 */
.el-form-item {
.el-form-item__label {
color: #606266;
font-weight: 500;
}
.el-input__inner,
.el-select .el-input__inner {
border-radius: 4px;
transition:
border-color 0.2s,
box-shadow 0.2s;
&:focus {
border-color: var(--primary-light);
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1);
}
}
.el-textarea__inner {
border-radius: 4px;
transition:
border-color 0.2s,
box-shadow 0.2s;
&:focus {
border-color: var(--primary-light);
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1);
}
}
}
/* 按钮样式优化 */
.el-button {
border-radius: 4px;
transition: all 0.2s;
&.is-primary {
background-color: var(--primary);
border-color: var(--primary);
&:hover {
background-color: var(--primary-light);
border-color: var(--primary-light);
}
&:active {
background-color: var(--primary-dark);
border-color: var(--primary-dark);
}
}
&.is-text {
color: var(--primary);
&:hover {
color: var(--primary-light);
background-color: rgba(64, 158, 255, 0.05);
}
}
}
/* 卡片样式优化 */
.el-card {
transition: all 0.3s ease;
&:hover {
/* transform: translateY(-2px); */
}
}
/* 对话框样式优化 */
.el-dialog {
.el-dialog__header {
background-color: #f5f7fa;
border-bottom: 1px solid #ebeef5;
padding: 15px 20px;
}
.el-dialog__title {
font-size: 16px;
font-weight: 600;
color: #303133;
}
.el-dialog__footer {
padding: 15px 20px;
border-top: 1px solid #ebeef5;
}
}
</style>

View File

@ -0,0 +1,54 @@
<template>
<div class="p-2">
<el-card shadow="always" :body-style="{ padding: '20px' }">
<template #header>
<div>
<span><!-- card title --></span>
</div>
</template>
<!-- card body -->
<el-form :model="form" ref="form" :rules="rules" label-width="80px" :inline="false" size="normal">
<el-row :gutter="20" v-for="item in form.list">
<el-col :span="8" :offset="0">
<el-form-item label="计划">
<el-input v-model="item.planId"></el-input>
</el-form-item>
</el-col>
<el-col :span="8" :offset="0">
<el-form-item label="数量">
<el-input v-model="item.num"></el-input>
</el-form-item>
</el-col>
<el-col :span="8" :offset="0">
<el-form-item label="物流单号">
<el-input v-model="item.ltn"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button type="primary" @click="onSubmit">立即提交</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script lang="ts" setup>
import { useRoute } from 'vue-router';
const route = useRoute();
const form = reactive({
docId: '',
supplier: '',
list: [
{
planId: '',
num: '',
ltn: ''
}
]
});
</script>
<style lang="stylus" scoped></style>