合并冲突
This commit is contained in:
@ -5,7 +5,7 @@ VITE_APP_TITLE = 新能源项目管理平台
|
||||
VITE_APP_ENV = 'development'
|
||||
|
||||
# 开发环境
|
||||
VITE_APP_BASE_API = 'http://192.168.110.180:8898'
|
||||
VITE_APP_BASE_API = 'http://192.168.110.159:8898'
|
||||
|
||||
# 无人机接口地址
|
||||
|
||||
|
@ -61,3 +61,24 @@ export const delDrawing = (id: string | number | Array<string | number>) => {
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 查阅
|
||||
* @param id
|
||||
*/
|
||||
export const volumeFileViewer = (data) => {
|
||||
return request({
|
||||
url: '/design/volumeFileViewer',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 查阅记录列表
|
||||
* @param id
|
||||
*/
|
||||
export const volumeFileViewerList = (id) => {
|
||||
return request({
|
||||
url: '/design/volumeFileViewer/list?volumeFileId=' + id,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
34
src/api/materials/overallPlanMaterialSupply/index.ts
Normal file
34
src/api/materials/overallPlanMaterialSupply/index.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
// 获取主数据列表
|
||||
export const obtainMasterDataList = (params: any): AxiosPromise => {
|
||||
return request({
|
||||
url: '/design/totalsupplyplan/queryList',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
};
|
||||
|
||||
// 总供应计划列表
|
||||
export const totalsupplyplan = (params: any): AxiosPromise => {
|
||||
return request({
|
||||
url: '/design/totalsupplyplan/list',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
};
|
||||
// 总供应计划详细信息
|
||||
export const totalSupplyplanDetails = (id: any): AxiosPromise => {
|
||||
return request({
|
||||
url: '/design/totalsupplyplan/' + id,
|
||||
method: 'get',
|
||||
});
|
||||
};
|
||||
// 修改物资-总供应计划
|
||||
export const materialChangeSupplyplan = (data: any): AxiosPromise => {
|
||||
return request({
|
||||
url: '/design/totalsupplyplan',
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
};
|
@ -85,3 +85,13 @@ export const listLink = (data: any) => {
|
||||
params: data
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 通过采购单获取需求
|
||||
* @param id
|
||||
*/
|
||||
export const purchaseDocPlanList = (id) => {
|
||||
return request({
|
||||
url: '/cailiaoshebei/purchaseDoc/planList/' + id,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
41
src/api/materials/usageMaterials/index.ts
Normal file
41
src/api/materials/usageMaterials/index.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
// 查询物资-使用情况列表
|
||||
export const useMaterialsQueryList = (params: any): AxiosPromise => {
|
||||
return request({
|
||||
url: '/cailiaoshebei/physicalsupply/list',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
};
|
||||
|
||||
// 新增物资
|
||||
export const newMaterialsAdd = (data: any): AxiosPromise => {
|
||||
return request({
|
||||
url: '/cailiaoshebei/physicalsupply',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
// 修改物资
|
||||
export const materialsEdit = (data: any): AxiosPromise => {
|
||||
return request({
|
||||
url: '/cailiaoshebei/physicalsupply',
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
};
|
||||
// 删除物资
|
||||
export const materialsDel = (id: any): AxiosPromise => {
|
||||
return request({
|
||||
url: '/cailiaoshebei/physicalsupply/' + id,
|
||||
method: 'delete',
|
||||
});
|
||||
};
|
||||
// 获取物资详情
|
||||
export const queryMaterialsInfo = (id: any): AxiosPromise => {
|
||||
return request({
|
||||
url: '/cailiaoshebei/physicalsupply/' + id,
|
||||
method: 'get',
|
||||
});
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="p-6 bg-gray-50 condition">
|
||||
<div class="p-6 bg-gray-50 Professional">
|
||||
<transition>
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="never">
|
||||
@ -203,10 +203,22 @@ const handleFile = async (row) => {
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
() => currentProject.value?.id,
|
||||
(nid, oid) => {
|
||||
queryParams.value.projectId = nid;
|
||||
getList();
|
||||
}
|
||||
);
|
||||
|
||||
onUnmounted(() => {
|
||||
listeningProject();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.condition {
|
||||
.Professional {
|
||||
.el-tabs__header {
|
||||
height: 84vh !important;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
<!-- 表单区域 -->
|
||||
<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>
|
||||
<h3 class="text-lg font-semibold text-gray-800">物资设备清单</h3>
|
||||
</div>
|
||||
<div class="p-6">
|
||||
<el-form
|
||||
|
@ -26,14 +26,7 @@
|
||||
<el-table-column label="操作">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Download" @click="onExport(scope.row.fileUrl)">下载</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
link
|
||||
icon="edit"
|
||||
v-show="scope.row.status == 'draft' || scope.row.status == 'waiting'"
|
||||
@click="onUpdate(scope.row)"
|
||||
>审核</el-button
|
||||
>
|
||||
<el-button type="success" link icon="edit" v-show="scope.row.status == 'draft'" @click="onUpdate(scope.row)">审核</el-button>
|
||||
<el-button link type="warning" v-show="scope.row.status != 'draft'" icon="View" @click="onView(scope.row)">查看流程</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -62,13 +55,11 @@ const props = defineProps({
|
||||
type: Number
|
||||
}
|
||||
});
|
||||
const uploadParams = computed(() => {
|
||||
return {
|
||||
catalogueId: props.catalogueId,
|
||||
projectId: currentProject.value?.id
|
||||
};
|
||||
});
|
||||
|
||||
const uploadParams = ref({
|
||||
catalogueId: '',
|
||||
projectId: currentProject.value?.id
|
||||
});
|
||||
const total = ref(0);
|
||||
const data = reactive({
|
||||
queryParams: {
|
||||
@ -85,7 +76,7 @@ const data = reactive({
|
||||
changeReason: undefined,
|
||||
status: undefined,
|
||||
params: {},
|
||||
catalogueId: props.catalogueId
|
||||
catalogueId: undefined
|
||||
}
|
||||
});
|
||||
const { queryParams } = toRefs(data);
|
||||
@ -153,6 +144,14 @@ const onExport = (fileUrl) => {
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
const getInfo = (id) => {
|
||||
queryParams.value.catalogueId = id;
|
||||
uploadParams.value.catalogueId = id;
|
||||
getList();
|
||||
};
|
||||
defineExpose({
|
||||
getInfo
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -1,40 +1,58 @@
|
||||
<template>
|
||||
<div class="p-6 bg-gray-50 condition">
|
||||
<el-tabs v-model="activeName" type="border-card" :tab-position="tabPosition" class="demo-tabs" @tab-click="handleClick">
|
||||
<el-tab-pane :label="item.catalogueName" :name="item.id" v-for="(item, i) of FolderList" :key="i">
|
||||
<div style="height: 80vh; background: #f0f8ff9e">
|
||||
<filePage :catalogueId="item.id"></filePage>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div class="file-category">
|
||||
<span style="color: #757575; display: inline-block; margin-bottom: 15px">文件分类</span>
|
||||
<!-- 优化了图标与文字的对齐和间距 -->
|
||||
<div v-for="(item, i) of FolderList" :key="i" :class="{ active: currentActive === i }" @click="handleClick(item, i)" class="category-item">
|
||||
<el-icon :size="20" class="folder-icon">
|
||||
<Folder />
|
||||
</el-icon>
|
||||
<span class="folder-name">
|
||||
{{ item.catalogueName }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="boxs">
|
||||
<filePage :catalogueId="catalogueId" ref="filePageRef"></filePage>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="DataCollectionForm" lang="ts">
|
||||
import { ref, reactive, computed, onMounted } from 'vue';
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import type { TabsPaneContext, TabsInstance } from 'element-plus';
|
||||
import { collectCatalogueList } from '@/api/design/condition';
|
||||
import filePage from './comm/filePage.vue';
|
||||
const tabPosition = ref<TabsInstance['tabPosition']>('left');
|
||||
const filePageRef = ref<typeof filePage | null>(null);
|
||||
const activeName = ref('');
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const FolderList = ref([]);
|
||||
const handleClick = (tab: TabsPaneContext, event: Event) => {
|
||||
console.log(tab, event);
|
||||
};
|
||||
const catalogueId = ref(0);
|
||||
// 查询收资清单目录列表
|
||||
const getList = async () => {
|
||||
let res = await collectCatalogueList({ projectId: currentProject.value?.id });
|
||||
if (res.code == 200) {
|
||||
FolderList.value = res.rows;
|
||||
activeName.value = res.rows[0].id; //默认第一个
|
||||
catalogueId.value = res.rows[0].id; //默认第一个
|
||||
nextTick(() => {
|
||||
filePageRef.value?.getInfo(catalogueId.value); //重新加载当前页
|
||||
});
|
||||
}
|
||||
};
|
||||
// 当前激活项的索引
|
||||
const currentActive = ref(0);
|
||||
|
||||
// 点击事件处理函数
|
||||
const handleClick = (item, index) => {
|
||||
currentActive.value = index;
|
||||
catalogueId.value = item.id;
|
||||
nextTick(() => {
|
||||
filePageRef.value?.getInfo(item.id); //重新加载当前页
|
||||
});
|
||||
};
|
||||
// 页面挂载时初始化数据
|
||||
onMounted(() => {
|
||||
getList();
|
||||
@ -43,8 +61,96 @@ onMounted(() => {
|
||||
|
||||
<style lang="scss">
|
||||
.condition {
|
||||
display: flex;
|
||||
.el-tabs__header {
|
||||
height: 84vh !important;
|
||||
height: 90vh !important;
|
||||
}
|
||||
.file-category {
|
||||
width: 200px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* 移除固定宽度,让容器根据内容自适应 */
|
||||
background-color: #ffffff;
|
||||
padding: 10px;
|
||||
border-radius: 6px;
|
||||
/* 限制最大宽度,防止内容过长 */
|
||||
/* max-width: 200px; */
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.file-category > div {
|
||||
cursor: pointer;
|
||||
padding: 8px 12px;
|
||||
margin-bottom: 4px;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
/* 文本不换行,确保宽度由内容决定 */
|
||||
white-space: nowrap;
|
||||
transition: all 0.2s ease;
|
||||
> span {
|
||||
margin-left: 6px;
|
||||
/* color: #676767;
|
||||
font-size: 18px; */
|
||||
}
|
||||
}
|
||||
|
||||
.file-category {
|
||||
width: 200px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #ffffff;
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
margin-right: 10px;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
// 分类项样式优化
|
||||
.category-item {
|
||||
cursor: pointer;
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 4px;
|
||||
border-radius: 6px;
|
||||
display: inline-flex;
|
||||
align-items: center; /* 垂直居中对齐 */
|
||||
white-space: nowrap;
|
||||
transition: all 0.25s ease;
|
||||
font-size: 14px;
|
||||
color: #334155;
|
||||
line-height: 1; /* 确保行高一致 */
|
||||
|
||||
&:hover {
|
||||
background-color: #f1f5f9;
|
||||
transform: translateX(2px);
|
||||
}
|
||||
}
|
||||
|
||||
// 图标样式
|
||||
.folder-icon {
|
||||
color: #94a3b8;
|
||||
transition: color 0.25s ease;
|
||||
}
|
||||
|
||||
// 文件夹名称样式
|
||||
.folder-name {
|
||||
margin-left: 8px; /* 增加图标与文字间距 */
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: calc(100% - 30px); /* 限制最大宽度,防止溢出 */
|
||||
}
|
||||
|
||||
// 活跃状态样式
|
||||
.category-item.active {
|
||||
background-color: #eff6ff;
|
||||
color: #2563eb;
|
||||
font-weight: 500;
|
||||
|
||||
.folder-icon {
|
||||
color: #2563eb;
|
||||
}
|
||||
}
|
||||
.boxs {
|
||||
width: calc(100% - 220px);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -60,7 +60,7 @@
|
||||
<dict-tag v-if="scope.row.fileId != null" :options="wf_business_status" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="变更文件" align="center" prop="remark" width="150">
|
||||
<el-table-column label="变更文件" align="center" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
@ -79,22 +79,33 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="变更内容" align="center" prop="changeContent" width="150" />
|
||||
<el-table-column label="备注" align="center" prop="remark" width="150" />
|
||||
<el-table-column label="操作" fixed="right" width="340">
|
||||
<el-table-column label="操作" fixed="right" width="300">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link icon="Upload" @click="handleAddChange(scope.row)" v-if="!scope.row.fileId">上传</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
icon="Upload"
|
||||
@click="handleAddChange(scope.row)"
|
||||
v-if="scope.row.status == 'draft' || scope.row.status == 'back'"
|
||||
>上传</el-button
|
||||
>
|
||||
<el-button type="success" link icon="View" v-if="scope.row.status != 'draft'" @click="handleViewInfo(scope.row)">查看</el-button>
|
||||
<el-button type="success" link icon="View" @click="handleViewDetail(scope.row)">通知单</el-button>
|
||||
<!-- <el-tooltip content="查看文档" placement="top">
|
||||
<el-button link type="primary" icon="Document" @click="handleView(scope.row)"></el-button>
|
||||
</el-tooltip> -->
|
||||
<el-button type="warning" link icon="View" v-if="scope.row.status != 'draft'" @click="handleViewHistory(scope.row)">查看单据</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
link
|
||||
icon="View"
|
||||
v-if="scope.row.status == 'draft' || scope.row.status == 'termination'"
|
||||
@click="handleViewHistory(scope.row)"
|
||||
>查看单据</el-button
|
||||
>
|
||||
</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>
|
||||
<wordDetial ref="wordDetialRef"></wordDetial>
|
||||
<el-dialog title="文件列表" v-model="viewVisible" width="500px">
|
||||
<el-dialog draggable title="文件列表" v-model="viewVisible" width="500px">
|
||||
<el-table v-if="fileList.length > 0" :data="fileList" style="width: 100%" border>
|
||||
<el-table-column prop="fileName" label="文件名称" align="center">
|
||||
<template #default="scope">
|
||||
|
@ -236,7 +236,10 @@ const data = reactive({
|
||||
newest: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {}
|
||||
rules: {
|
||||
// 卷册号
|
||||
volumeNo: [{ required: true, message: '请请选择卷册号', trigger: 'change' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { form, rules } = toRefs(data);
|
||||
|
@ -1,32 +1,6 @@
|
||||
<template>
|
||||
<el-table v-loading="loading" :data="drawingList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="版本号" align="center" prop="versionNumber" width="100" />
|
||||
<el-table-column label="文件名称" align="center" prop="fileName">
|
||||
<template #default="scope">
|
||||
<span style="color: #409eff" @click="handleView(scope.row)">{{ scope.row.fileName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="图纸类型" align="center" prop="fileType" width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="drawing_file_type" :value="scope.row.fileType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="原文件名" align="center" prop="originalName" />
|
||||
<el-table-column label="是否最新" align="center" prop="newest">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
<el-tag type="primary" v-if="scope.row.newest == '1'">是</el-tag>
|
||||
<el-tag type="success" v-else>否</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="流程状态" min-width="70">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="wf_business_status" :value="scope.row.status"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="上传时间" align="center" prop="createTime" /> -->
|
||||
<el-table v-loading="loading" :data="drawingList">
|
||||
<el-table-column type="index" label="序号" width="80" align="center" />
|
||||
<el-table-column label="子项名称" align="center" prop="designSubitem" />
|
||||
<el-table-column label="专业" align="center" prop="specialty">
|
||||
<template #default="scope">
|
||||
@ -43,39 +17,33 @@
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding " width="240">
|
||||
<template #default="scope">
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPermi="['design:drawing:remove']" size="small" type="primary" icon="Download" @click="handleDownload(scope.row)"
|
||||
>下载</el-button
|
||||
>
|
||||
</el-col>
|
||||
<!-- <el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5" v-if="scope.row.status === 'draft' || scope.row.status === 'cancel' || scope.row.status === 'back'">
|
||||
<el-button v-hasPermi="['design:drawing:edit']" size="small" type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5" v-if="scope.row.status === 'draft' || scope.row.status === 'cancel' || scope.row.status === 'back'">
|
||||
<el-button v-hasPermi="['design:drawing:remove']" size="small" type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" size="small" icon="View" v-if="scope.row.status != 'draft'" @click="handleViewInfo(scope.row)">查看</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5" v-if="scope.row.status === 'waiting'">
|
||||
<el-button size="small" type="primary" icon="Notification" @click="handleCancelProcessApply(scope.row.id)">撤销</el-button>
|
||||
</el-col>
|
||||
</el-row> -->
|
||||
<el-button v-hasPermi="['design:drawing:remove']" size="small" type="primary" icon="Download" @click="handleDownload(scope.row)"
|
||||
>下载</el-button
|
||||
>
|
||||
<el-button size="small" type="primary" icon="view" @click="handleViewHis(scope.row)">查阅记录</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-dialog draggable title="文件列表" v-model="viewVisible" width="500px">
|
||||
<el-table :data="histroyList" style="width: 100%" border>
|
||||
<el-table-column type="index" label="序号" align="center" width="80"> </el-table-column>
|
||||
<el-table-column prop="userName" label="用户名称" align="center"> </el-table-column>
|
||||
<el-table-column prop="createTime" label="查阅时间" align="center"> </el-table-column>
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<span>
|
||||
<el-button type="primary" @click="viewVisible = false">关闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, defineProps, defineEmits } from 'vue';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
import { volumeFileViewer, volumeFileViewerList } from '@/api/design/drawing';
|
||||
|
||||
const { design_state, wf_business_status, des_user_major } = toRefs(proxy?.useDict('design_state', 'wf_business_status', 'des_user_major'));
|
||||
const { des_user_major } = toRefs(proxy?.useDict('des_user_major'));
|
||||
|
||||
const props = defineProps({
|
||||
drawingList: {
|
||||
@ -95,6 +63,8 @@ const props = defineProps({
|
||||
required: true
|
||||
}
|
||||
});
|
||||
const viewVisible = ref(false);
|
||||
const histroyList = ref([]);
|
||||
|
||||
const emits = defineEmits(['selection-change', 'view', 'update', 'delete', 'view-info', 'cancel-process-apply']);
|
||||
|
||||
@ -121,8 +91,19 @@ const handleViewInfo = (row) => {
|
||||
const handleCancelProcessApply = (id) => {
|
||||
emits('cancel-process-apply', id);
|
||||
};
|
||||
|
||||
const handleViewHis = async (row) => {
|
||||
viewVisible.value = true;
|
||||
let res = await volumeFileViewerList(row.volumeFileId);
|
||||
if (res.code == 200) {
|
||||
histroyList.value = res.rows;
|
||||
}
|
||||
};
|
||||
const handleDownload = (row) => {
|
||||
getCheck(row);
|
||||
proxy?.$download.oss(row.fileUrl);
|
||||
};
|
||||
// 调用查阅接口
|
||||
const getCheck = async (row) => {
|
||||
volumeFileViewer({ volumeFileId: row.volumeFileId });
|
||||
};
|
||||
</script>
|
||||
|
@ -7,11 +7,6 @@
|
||||
<el-form-item label="文件名称" prop="fileName">
|
||||
<el-input v-model="queryParams.fileName" placeholder="请输入文件名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="文件类型" prop="fileType">
|
||||
<el-select v-model="queryParams.fileType" placeholder="请选择文件类型" clearable>
|
||||
<el-option v-for="dict in drawing_file_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="原文件名" prop="originalName">
|
||||
<el-input v-model="queryParams.originalName" placeholder="请输入原文件名" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
@ -32,56 +27,9 @@
|
||||
<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="['design:drawing:add']">上传图纸</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
<!-- <el-tabs type="border-card" v-model="activeName" class="demo-tabs" @tab-click="handleClick">
|
||||
<el-tab-pane label="过程图纸" name="1">
|
||||
<DrawingTable
|
||||
:drawingList="drawingList"
|
||||
:loading="loading"
|
||||
:drawing_file_type="drawing_file_type"
|
||||
:wf_business_status="wf_business_status"
|
||||
@selection-change="handleSelectionChange"
|
||||
@view="handleView"
|
||||
@update="handleUpdate"
|
||||
@delete="handleDelete"
|
||||
@view-info="handleViewInfo"
|
||||
@cancel-process-apply="handleCancelProcessApply"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="蓝图" name="2">
|
||||
<DrawingTable
|
||||
:drawingList="drawingList"
|
||||
:loading="loading"
|
||||
:drawing_file_type="drawing_file_type"
|
||||
:wf_business_status="wf_business_status"
|
||||
@selection-change="handleSelectionChange"
|
||||
@view="handleView"
|
||||
@update="handleUpdate"
|
||||
@delete="handleDelete"
|
||||
@view-info="handleViewInfo"
|
||||
@cancel-process-apply="handleCancelProcessApply"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="变更图纸" name="3">
|
||||
<DrawingTable
|
||||
:drawingList="drawingList"
|
||||
:loading="loading"
|
||||
:drawing_file_type="drawing_file_type"
|
||||
:wf_business_status="wf_business_status"
|
||||
@selection-change="handleSelectionChange"
|
||||
@view="handleView"
|
||||
@update="handleUpdate"
|
||||
@delete="handleDelete"
|
||||
@view-info="handleViewInfo"
|
||||
@cancel-process-apply="handleCancelProcessApply"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs> -->
|
||||
<DrawingTable
|
||||
:drawingList="drawingList"
|
||||
:loading="loading"
|
||||
@ -168,17 +116,6 @@ const handleSelectionChange = (selection: DrawingVO[]) => {
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
proxy.$tab.closePage(proxy.$route);
|
||||
proxy.$router.push({
|
||||
path: `/design-management/drawing/indexEdit`,
|
||||
query: {
|
||||
type: 'add'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: DrawingVO) => {
|
||||
proxy.$tab.closePage(proxy.$route);
|
||||
|
@ -13,7 +13,6 @@
|
||||
: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">
|
||||
|
@ -319,6 +319,18 @@ function importExcel(options) {
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
() => currentProject.value?.id,
|
||||
(nid, oid) => {
|
||||
queryParams.value.projectId = nid;
|
||||
getList();
|
||||
}
|
||||
);
|
||||
|
||||
onUnmounted(() => {
|
||||
listeningProject();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.drawingreview {
|
||||
|
@ -25,7 +25,7 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['design:volumeCatalog:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- <el-col :span="1.5">
|
||||
<file-upload
|
||||
v-model="form.file"
|
||||
isImportInfo
|
||||
@ -41,7 +41,7 @@
|
||||
>
|
||||
<el-button type="warning" plain icon="Upload">导入</el-button>
|
||||
</file-upload>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
@ -79,7 +79,7 @@
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
v-if="scope.row.auditStatus != 'finish' && scope.row.auditStatus != 'termination'"
|
||||
v-if="scope.row.auditStatus != 'finish' && scope.row.auditStatus != 'termination' && scope.row.auditStatus != 'waiting'"
|
||||
icon="Edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['design:volumeCatalog:edit']"
|
||||
@ -111,7 +111,12 @@
|
||||
v-hasPermi="['out:monthPlan:remove']"
|
||||
>查看流程</el-button
|
||||
>
|
||||
<el-button type="warning" link icon="View" v-if="scope.row.auditType != 'draft'" @click="handleViewHistory(scope.row)"
|
||||
<el-button
|
||||
type="warning"
|
||||
link
|
||||
icon="View"
|
||||
v-if="scope.row.auditType == 'back' || scope.row.auditStatus == 'termination'"
|
||||
@click="handleViewHistory(scope.row)"
|
||||
>查看单据</el-button
|
||||
>
|
||||
</template>
|
||||
@ -135,11 +140,11 @@
|
||||
<el-option v-for="item in userAppList" :key="item.userId" :label="item.userName" :value="item.userId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设计状态" prop="designState">
|
||||
<!-- <el-form-item label="设计状态" prop="designState">
|
||||
<el-select v-model="form.designState" placeholder="请选择设计状态">
|
||||
<el-option :value="item.value" v-for="item in design_state" :key="item.value" :label="item.label" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="计划出图时间" prop="plannedCompletion">
|
||||
<el-date-picker v-model="form.plannedCompletion" type="date" value-format="YYYY-MM-DD" placeholder="请选择计划出图时间" />
|
||||
</el-form-item>
|
||||
@ -172,7 +177,7 @@
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
<!-- 查看文件列表 -->
|
||||
<el-dialog title="文件列表" v-model="viewVisible" width="45%">
|
||||
<el-dialog draggable title="文件列表" v-model="viewVisible" width="45%">
|
||||
<el-table v-if="fileList.length > 0" :data="fileList" style="width: 100%" border>
|
||||
<el-table-column prop="fileName" label="文件" align="center">
|
||||
<template #default="scope">
|
||||
@ -210,7 +215,7 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog title="单据" v-model="dialogHistory" width="800px">
|
||||
<el-dialog draggable title="单据" v-model="dialogHistory" width="800px">
|
||||
<histroy ref="histroyRef"></histroy>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
@ -71,9 +71,9 @@
|
||||
<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-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> -->
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button
|
||||
link
|
||||
@ -89,39 +89,48 @@
|
||||
<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-dialog draggable :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="请输入表单编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12"
|
||||
><el-form-item label="采购单编号" prop="docId"
|
||||
><el-select @change="handleSelect" v-model="form.docId" filterable placeholder="请选择采购单" style="width: 100%">
|
||||
<el-option v-for="item in purchaseDocList" :key="item.id" :label="item.docCode" :value="item.id"></el-option> </el-select
|
||||
></el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供货单位" prop="supplierUnit">
|
||||
<el-input disabled v-model="form.supplierUnit" 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="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="请输入内容" />
|
||||
@ -131,7 +140,7 @@
|
||||
<div class="detail">
|
||||
<div class="detail-header">
|
||||
<span>数量验收</span>
|
||||
<el-button type="primary" link @click="addItem" icon="Plus">添加一行</el-button>
|
||||
<!-- <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>
|
||||
@ -168,7 +177,7 @@
|
||||
:prop="`itemList.${index}.quantity`"
|
||||
:rules="{ required: true, message: '数量不能为空', trigger: 'blur' }"
|
||||
>
|
||||
<el-input v-model="item.quantity" placeholder="请输入数量" />
|
||||
<el-input type="number" v-model="item.quantity" placeholder="请输入数量" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@ -177,7 +186,7 @@
|
||||
:prop="`itemList.${index}.acceptedQuantity`"
|
||||
:rules="{ required: true, message: '验收数量不能为空', trigger: 'blur' }"
|
||||
>
|
||||
<el-input v-model="item.acceptedQuantity" placeholder="请输入验收" />
|
||||
<el-input type="number" v-model="item.acceptedQuantity" placeholder="请输入验收" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@ -186,7 +195,8 @@
|
||||
:prop="`itemList.${index}.shortageQuantity`"
|
||||
:rules="{ required: true, message: '缺件数量不能为空', trigger: 'blur' }"
|
||||
>
|
||||
<el-input v-model="item.shortageQuantity" placeholder="请输入缺件" />
|
||||
<el-input type="number" v-model="item.shortageQuantity" placeholder="自动计算(数量-验收数量)" readonly />
|
||||
<span class="tips">*自动计算(数量-验收数量)</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@ -194,16 +204,15 @@
|
||||
<el-input v-model="item.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="form.itemList.length > 1">
|
||||
<!-- <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-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" />
|
||||
@ -264,6 +273,8 @@ import {
|
||||
import { MaterialReceiveVO, MaterialReceiveQuery, MaterialReceiveForm } from '@/api/materials/materialReceive/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import wordllReceive from './word/index.vue';
|
||||
import { listPurchaseDoc, purchaseDocPlanList } from '@/api/materials/purchaseDoc';
|
||||
import { watch } from 'vue';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { storage_type } = toRefs<any>(proxy?.useDict('storage_type'));
|
||||
@ -283,7 +294,8 @@ const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const materialReceiveFormRef = ref<ElFormInstance>();
|
||||
|
||||
const purchaseDocList = ref([]); //物资采购单
|
||||
const purchaseMap = new Map();
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
@ -310,6 +322,8 @@ const getInitFormData = () => {
|
||||
licenseCountFileId: undefined,
|
||||
storageType: [],
|
||||
remark: undefined,
|
||||
docId: undefined,
|
||||
docCode: undefined,
|
||||
itemList: [
|
||||
{
|
||||
name: undefined,
|
||||
@ -324,7 +338,7 @@ const getInitFormData = () => {
|
||||
};
|
||||
};
|
||||
const initFormData: MaterialReceiveForm = {};
|
||||
const data = reactive<PageData<MaterialReceiveForm, MaterialReceiveQuery>>({
|
||||
const data = reactive({
|
||||
form: getInitFormData(),
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@ -389,6 +403,10 @@ const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = '添加物料接收单';
|
||||
// 为初始条目添加监听
|
||||
if (form.value.itemList.length > 0) {
|
||||
watchItemChanges(0);
|
||||
}
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
@ -397,11 +415,17 @@ const handleUpdate = async (row?: MaterialReceiveVO) => {
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getMaterialReceive(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
if (form.value.storageType.length) {
|
||||
if (form.value.storageType && form.value.storageType.length) {
|
||||
form.value.storageType = form.value.storageType.split(',');
|
||||
} else {
|
||||
form.value.storageType = [];
|
||||
}
|
||||
|
||||
// 为每个条目添加监听
|
||||
form.value.itemList.forEach((_, index) => {
|
||||
watchItemChanges(index);
|
||||
});
|
||||
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改物料接收单';
|
||||
};
|
||||
@ -432,9 +456,10 @@ const handleDelete = async (row?: MaterialReceiveVO) => {
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
// 添加数量验收条目
|
||||
const addItem = () => {
|
||||
form.value.itemList.push({
|
||||
const newItem = {
|
||||
name: undefined,
|
||||
specification: undefined,
|
||||
unit: undefined,
|
||||
@ -442,7 +467,25 @@ const addItem = () => {
|
||||
acceptedQuantity: undefined,
|
||||
shortageQuantity: undefined,
|
||||
remark: undefined
|
||||
});
|
||||
};
|
||||
form.value.itemList.push(newItem);
|
||||
// 监听新条目数据变化
|
||||
watchItemChanges(form.value.itemList.length - 1);
|
||||
};
|
||||
|
||||
// 监听条目数据变化,自动计算缺件数量
|
||||
const watchItemChanges = (index: number) => {
|
||||
watch(
|
||||
() => [form.value.itemList[index].quantity, form.value.itemList[index].acceptedQuantity],
|
||||
([quantity, acceptedQuantity]) => {
|
||||
// 确保数量和验收数量都是数字
|
||||
const qty = Number(quantity) || 0;
|
||||
const acceptedQty = Number(acceptedQuantity) || 0;
|
||||
// 计算缺件数量(数量 - 验收数量)
|
||||
form.value.itemList[index].shortageQuantity = qty - acceptedQty;
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
};
|
||||
|
||||
// 删除数量验收条目
|
||||
@ -453,14 +496,67 @@ const removeItem = (index: number) => {
|
||||
proxy?.$modal.msgWarning('至少需要保留一条数量验收记录');
|
||||
}
|
||||
};
|
||||
|
||||
const handleView = (row) => {
|
||||
// 查看详情
|
||||
wordllReceiveRef.value?.openDialog(row);
|
||||
};
|
||||
|
||||
/** 查询物资-采购联系单列表 */
|
||||
const getlistPurchase = async () => {
|
||||
const res = await listPurchaseDoc({
|
||||
projectId: currentProject.value?.id,
|
||||
status: 'finish'
|
||||
});
|
||||
purchaseDocList.value = res.rows;
|
||||
if (purchaseDocList.value && purchaseDocList.value.length > 0) {
|
||||
purchaseDocList.value.forEach((item) => {
|
||||
purchaseMap.set(item.id, item);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 通过采购单获取需求信息
|
||||
const getdemandInfo = async (docId: string) => {
|
||||
let res = await purchaseDocPlanList(docId);
|
||||
if (res.code == 200) {
|
||||
// 需求表单赋值
|
||||
form.value.itemList = [];
|
||||
res.data.forEach((item, index) => {
|
||||
let obj = {
|
||||
quantity: item.demandQuantity,
|
||||
acceptedQuantity: 0,
|
||||
shortageQuantity: item.demandQuantity, // 初始化缺件数量为总数量
|
||||
planId: item.id,
|
||||
...item
|
||||
};
|
||||
obj.id = null;
|
||||
form.value.itemList.push(obj);
|
||||
// 监听每个条目的变化
|
||||
watchItemChanges(form.value.itemList.length - 1);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleSelect = (val) => {
|
||||
// 选择设备
|
||||
let obj = purchaseMap.get(val);
|
||||
getdemandInfo(val);
|
||||
form.value.docCode = obj?.docCode || '';
|
||||
form.value.supplierUnit = obj?.supplier || '';
|
||||
form.value.materialName = obj?.name || '';
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
getlistPurchase();
|
||||
// 为初始条目添加监听
|
||||
if (form.value.itemList.length > 0) {
|
||||
watchItemChanges(0);
|
||||
}
|
||||
});
|
||||
//监听项目id刷新数据
|
||||
|
||||
// 监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
() => currentProject.value?.id,
|
||||
(nid, oid) => {
|
||||
@ -508,4 +604,10 @@ onUnmounted(() => {
|
||||
justify-content: flex-end;
|
||||
padding-top: 6px;
|
||||
}
|
||||
|
||||
.tips {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
margin-left: 8px;
|
||||
}
|
||||
</style>
|
||||
|
BIN
src/views/materials/materialsEquipment/partyA.rar
Normal file
BIN
src/views/materials/materialsEquipment/partyA.rar
Normal file
Binary file not shown.
@ -1,16 +1,314 @@
|
||||
<template>
|
||||
<div>init</div>
|
||||
<div class="overall-plan-material-supply">
|
||||
<!-- tabPosition="left" -->
|
||||
<el-card shadow="always">
|
||||
<el-form :inline="true">
|
||||
<el-form-item v-if="state.masterData.status == 'draft'">
|
||||
<el-button type="primary" icon="edit" @click="clickApprovalSheet1()">审批</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="state.masterData.status == 'waiting' || state.masterData.status == 'finish'">
|
||||
<el-button icon="view" @click="lookApprovalFlow()" type="warning">查看流程</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-table :data="state.tableData" v-loading="state.loading.list" stripe
|
||||
style="width: 100%; margin-bottom: 20px; height: calc(100vh - 230px)" row-key="id" border>
|
||||
<el-table-column prop="num" label="编号" />
|
||||
<el-table-column prop="name" label="工程或费用名称" />
|
||||
<el-table-column prop="unit" label="单位" />
|
||||
<el-table-column prop="quantity" label="数量" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column label="操作">
|
||||
<template #default="{ row }">
|
||||
<el-button :disabled="state.masterData.status == 'waiting' || state.masterData.status == 'finish'" type="primary" @click="editApprovalSheet(row)">修改</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 编辑 -->
|
||||
<el-dialog v-model="visible" title="修改物料信息" :width="800" :close-on-click-modal="false" @close="handleClose">
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="120px" class="space-y-4">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="批次号" prop="batchNumber">
|
||||
<el-input disabled v-model="formData.batchNumber" placeholder="请输入批次号" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="品牌" prop="brand">
|
||||
<el-input v-model="formData.brand" placeholder="请输入品牌" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 物料属性区域 -->
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="材质" prop="texture">
|
||||
<el-input v-model="formData.texture" placeholder="请输入材质" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="质量标准" prop="qualityStandard">
|
||||
<el-input v-model="formData.qualityStandard" placeholder="请输入质量标准" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 日期与状态区域 -->
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="使用部位" prop="partUsed">
|
||||
<el-input v-model="formData.partUsed" placeholder="请输入使用部位" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="交货地点" prop="deliveryPoints">
|
||||
<el-input v-model="formData.deliveryPoints" placeholder="请输入交货地点" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 其他信息区域 -->
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="预计使用日期" prop="dateService">
|
||||
<el-date-picker v-model="formData.dateService" type="date" placeholder="选择预计使用日期"
|
||||
format="YYYY-MM-DD" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注信息" type="textarea" rows="3" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
<script setup name="billofQuantities">
|
||||
import { ref, reactive, onMounted, computed, getCurrentInstance } from 'vue';
|
||||
import { obtainMasterDataList, totalsupplyplan, totalSupplyplanDetails, materialChangeSupplyplan } from '@/api/materials/overallPlanMaterialSupply/index';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
const userStore = useUserStoreHook();
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const { proxy } = getCurrentInstance();
|
||||
const visible = ref(false);
|
||||
const formRef = ref(null);
|
||||
const state = reactive({
|
||||
tableData: [],
|
||||
queryForm: {
|
||||
projectId: currentProject.value?.id,
|
||||
versions: '',
|
||||
sheet: '',
|
||||
pageSize: 20,
|
||||
pageNum: 1
|
||||
},
|
||||
loading: {
|
||||
versions: false,
|
||||
sheets: false,
|
||||
list: false
|
||||
},
|
||||
// 主id
|
||||
masterData: {}
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
// todo
|
||||
return {};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
batchNumber: '',
|
||||
brand: '',
|
||||
compileDate: '',
|
||||
dateService: '',
|
||||
deliveryPoints: '',
|
||||
id: undefined,
|
||||
name: '',
|
||||
num: '',
|
||||
partUsed: '',
|
||||
planNumber: '',
|
||||
projectId: undefined,
|
||||
qualityStandard: '',
|
||||
quantity: 0,
|
||||
remark: '',
|
||||
specification: '',
|
||||
status: '',
|
||||
texture: '',
|
||||
unit: ''
|
||||
});
|
||||
// 表单验证规则
|
||||
const formRules = reactive({
|
||||
name: [
|
||||
{ required: true, message: '请输入名称', trigger: 'blur' },
|
||||
{ max: 100, message: '名称长度不能超过100个字符', trigger: 'blur' }
|
||||
],
|
||||
num: [
|
||||
{ required: true, message: '请输入编号', trigger: 'blur' },
|
||||
{ max: 50, message: '编号长度不能超过50个字符', trigger: 'blur' }
|
||||
],
|
||||
quantity: [
|
||||
{ required: true, message: '请输入数量', trigger: 'blur' },
|
||||
{ type: 'number', min: 0, message: '数量不能为负数', trigger: 'blur' }
|
||||
],
|
||||
compileDate: [
|
||||
{ required: true, message: '请选择编制日期', trigger: 'change' }
|
||||
]
|
||||
});
|
||||
// 获取主表数据
|
||||
async function getMasterDataList() {
|
||||
try {
|
||||
// 获取主数据列表
|
||||
state.loading.list = true;
|
||||
const masterDataRes = await obtainMasterDataList({
|
||||
projectId: currentProject.value?.id
|
||||
});
|
||||
|
||||
<style lang="stylus" scoped></style>
|
||||
const { data: masterData } = masterDataRes;
|
||||
console.log('masterData', masterData);
|
||||
|
||||
if (!masterData[0].id) {
|
||||
console.warn('未获取到有效的主数据ID');
|
||||
state.tableData = [];
|
||||
return;
|
||||
}
|
||||
state.masterData = masterData[0];
|
||||
|
||||
// 获取供应计划
|
||||
const supplyPlanRes = await totalsupplyplan({ id: masterData[0].id });
|
||||
|
||||
// 处理结果
|
||||
if (supplyPlanRes.list == null) {
|
||||
state.tableData = supplyPlanRes.rows || [];
|
||||
console.log('state.tableData', state.tableData);
|
||||
} else {
|
||||
// 根据实际业务逻辑处理有list的情况
|
||||
state.tableData = [];
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('获取主数据列表失败:', error);
|
||||
// 错误情况下给默认值,避免页面出错
|
||||
state.tableData = [];
|
||||
} finally {
|
||||
state.loading.list = false;
|
||||
}
|
||||
}
|
||||
// 获取详情
|
||||
// 修改获取详情的方法
|
||||
async function totalSupplyplanDetail(id) {
|
||||
try {
|
||||
const result = await totalSupplyplanDetails(id);
|
||||
if (result?.code === 200) {
|
||||
const detailData = result.data || {};
|
||||
// 1. 清空原有表单数据
|
||||
Object.keys(formData).forEach(key => {
|
||||
formData[key] = undefined;
|
||||
});
|
||||
// 2. 处理日期格式(假设接口返回的是Date对象或ISO字符串)
|
||||
const formatDate = (date) => {
|
||||
if (!date) return '';
|
||||
// 若为字符串,先转为Date对象
|
||||
const d = typeof date === 'string' ? new Date(date) : date;
|
||||
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
|
||||
};
|
||||
// 3. 合并数据到formData(响应式赋值)
|
||||
Object.assign(formData, {
|
||||
...detailData,
|
||||
// 单独处理日期字段,转为表单可识别的字符串格式
|
||||
compileDate: formatDate(detailData.compileDate),
|
||||
dateService: formatDate(detailData.dateService)
|
||||
});
|
||||
console.log('表单数据已更新:', formData);
|
||||
} else {
|
||||
ElMessage.error(`获取详情失败: ${result?.msg || '未知错误'}`);
|
||||
}
|
||||
} catch (err) {
|
||||
ElMessage.error(`接口请求失败: ${err.message}`);
|
||||
console.error('详情接口错误:', err);
|
||||
} finally {
|
||||
state.loading.list = false;
|
||||
}
|
||||
}
|
||||
// 修改
|
||||
function editApprovalSheet(row) {
|
||||
console.log(row);
|
||||
totalSupplyplanDetail(row.id)
|
||||
visible.value = true;
|
||||
}
|
||||
// 提交表单
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
// 表单验证
|
||||
await formRef.value.validate();
|
||||
// 触发提交事件
|
||||
console.log('submitData:', formData);
|
||||
editMaterialSupply(formData);
|
||||
handleClose();
|
||||
} catch (error) {
|
||||
// 验证失败不提交
|
||||
console.error('表单验证失败:', error);
|
||||
return;
|
||||
}
|
||||
};
|
||||
// 修改物资
|
||||
function editMaterialSupply(formData) {
|
||||
materialChangeSupplyplan(formData).then(res => {
|
||||
if (res.code === 200) {
|
||||
ElMessage.success('修改成功');
|
||||
} else {
|
||||
ElMessage.error('修改失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const handleClose = () => {
|
||||
visible.value = false;
|
||||
// 清空表单数据
|
||||
Object.keys(formData).forEach(key => {
|
||||
formData[key] = undefined;
|
||||
});
|
||||
// 重置表单验证状态
|
||||
formRef.value?.resetFields();
|
||||
};
|
||||
|
||||
// 审批
|
||||
function clickApprovalSheet1() {
|
||||
proxy.$tab.closePage(proxy.$route);
|
||||
proxy.$router.push({
|
||||
path: `/materials/overallPlanMaterialSupply/indexEdit`,
|
||||
query: {
|
||||
id: state.masterData.id,
|
||||
type: 'update'
|
||||
}
|
||||
});
|
||||
}
|
||||
// 审核流程
|
||||
function lookApprovalFlow() {
|
||||
proxy.$router.push({
|
||||
path: `/materials/overallPlanMaterialSupply/indexEdit`,
|
||||
query: {
|
||||
id: state.masterData.id,
|
||||
type: 'view'
|
||||
}
|
||||
});
|
||||
}
|
||||
onMounted(() => {
|
||||
getMasterDataList();
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
.overall-plan-material-supply {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.space-y-4>.el-row {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.space-y-4>.el-row:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
|
390
src/views/materials/overallPlanMaterialSupply/indexEdit.vue
Normal file
390
src/views/materials/overallPlanMaterialSupply/indexEdit.vue
Normal file
@ -0,0 +1,390 @@
|
||||
<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" v-loading="loading" :disabled="routeParams.type === 'view' || routeParams.type === 'update'" :model="form"
|
||||
:rules="rules" label-width="100px" class="space-y-4">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="批次号" prop="batchNumber">
|
||||
<el-input disabled v-model="form.batchNumber" placeholder="请输入批次号" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="品牌" prop="brand">
|
||||
<el-input v-model="form.brand" placeholder="请输入品牌" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="材质" prop="texture">
|
||||
<el-input v-model="form.texture" placeholder="请输入材质" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="质量标准" prop="qualityStandard">
|
||||
<el-input v-model="form.qualityStandard" placeholder="请输入质量标准" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="使用部位" prop="partUsed">
|
||||
<el-input v-model="form.partUsed" placeholder="请输入使用部位" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="交货地点" prop="deliveryPoints">
|
||||
<el-input v-model="form.deliveryPoints" placeholder="请输入交货地点" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="预计使用日期" prop="dateService">
|
||||
<el-date-picker v-model="form.dateService" type="date" placeholder="选择预计使用日期" format="YYYY-MM-DD" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注信息" type="textarea" rows="3" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form> -->
|
||||
<el-table :data="tableData" v-loading="loading" row-key="id" border>
|
||||
<el-table-column prop="num" label="编号" />
|
||||
<el-table-column prop="name" label="名称" />
|
||||
<el-table-column prop="specification" label="规格" />
|
||||
<el-table-column prop="unit" label="单位" />
|
||||
<el-table-column prop="quantity" label="数量" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
</el-table>
|
||||
</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, LeaveQuery, LeaveVO } 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';
|
||||
const { design_change_reason_type } = toRefs<any>(proxy?.useDict('design_change_reason_type'));
|
||||
import { totalsupplyplan,obtainMasterDataList } from '@/api/materials/overallPlanMaterialSupply/index';
|
||||
// 获取用户 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 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 flowCodeOptions = [
|
||||
{
|
||||
value: currentProject.value?.id + '_totalsupplyplan',
|
||||
label: '物资总计划审核'
|
||||
}
|
||||
];
|
||||
|
||||
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 = {
|
||||
batchNumber: '',
|
||||
brand: '',
|
||||
compileDate: '',
|
||||
dateService: '',
|
||||
deliveryPoints: '',
|
||||
id: undefined,
|
||||
name: '',
|
||||
num: '',
|
||||
partUsed: '',
|
||||
planNumber: '',
|
||||
projectId: undefined,
|
||||
qualityStandard: '',
|
||||
quantity: 0,
|
||||
remark: '',
|
||||
specification: '',
|
||||
status: '',
|
||||
texture: '',
|
||||
unit: ''
|
||||
};
|
||||
const data = reactive({
|
||||
form: { ...initFormData },
|
||||
tableData: [],
|
||||
rules: {}
|
||||
});
|
||||
|
||||
const handleClose = () => {
|
||||
dialogVisible.visible = false;
|
||||
flowCode.value = '';
|
||||
buttonLoading.value = false;
|
||||
};
|
||||
const { form, rules, tableData } = toRefs(data);
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
leaveFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 获取详情 */
|
||||
const getInfo = () => {
|
||||
loading.value = true;
|
||||
buttonLoading.value = false;
|
||||
nextTick(async () => {
|
||||
const masterDataRes = await obtainMasterDataList({ projectId: currentProject.value?.id });
|
||||
const res = await totalsupplyplan(routeParams.value.id);
|
||||
console.log('res.data', masterDataRes);
|
||||
Object.assign(form.value, masterDataRes?.data[0]);
|
||||
// console.log('form', form.value);
|
||||
tableData.value = res.rows;
|
||||
loading.value = false;
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = (status1: string) => {
|
||||
status.value = status1;
|
||||
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);
|
||||
};
|
||||
// 图纸上传成功之后 开始提交
|
||||
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';
|
||||
}
|
||||
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();
|
||||
console.log('routeParams.value', routeParams.value);
|
||||
}
|
||||
});
|
||||
});
|
||||
</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>
|
626
src/views/materials/usageMaterials/material/index.vue
Normal file
626
src/views/materials/usageMaterials/material/index.vue
Normal file
@ -0,0 +1,626 @@
|
||||
<template>
|
||||
<div class="min-h-screen bg-gray-50 flex flex-col">
|
||||
<!-- 主要内容区 -->
|
||||
<main class="flex-1 p-6">
|
||||
<!-- 操作栏 -->
|
||||
<div class="bg-white rounded-lg shadow-sm p-4 mb-6 transition-all duration-300 hover:shadow-md">
|
||||
<div class="flex flex-wrap items-center justify-between gap-4">
|
||||
<!-- <div class="flex flex-wrap items-center gap-4">
|
||||
<el-select
|
||||
v-model="searchForm.findType"
|
||||
placeholder="选择查询类型"
|
||||
class="w-[180px]"
|
||||
@change="handleSearch"
|
||||
>
|
||||
<el-option label="采购" value="1"></el-option>
|
||||
<el-option label="材料" value="2"></el-option>
|
||||
<el-option label="查询所有" value="3"></el-option>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-model="searchForm.keyword"
|
||||
placeholder="输入材料名称或供应商搜索"
|
||||
class="w-[250px]"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
>
|
||||
<template #append>
|
||||
<el-button icon="Search" @click="handleSearch"></el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</div> -->
|
||||
<!-- 操作按钮 -->
|
||||
<div class="flex gap-2">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
class="transition-all duration-200 hover:shadow-md"
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Refresh"
|
||||
@click="refreshData"
|
||||
class="transition-all duration-200 hover:shadow-md"
|
||||
>
|
||||
刷新
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<div class="bg-white rounded-lg shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md">
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
:header-cell-style="{ 'background-color': '#f5f7fa', 'font-weight': 'bold' }"
|
||||
:row-class-name="tableRowClassName"
|
||||
@row-dblclick="handleRowDblClick"
|
||||
>
|
||||
<el-table-column prop="id" label="ID" width="80" align="center"></el-table-column>
|
||||
<el-table-column prop="name" label="材料名称" min-width="150"></el-table-column>
|
||||
<el-table-column prop="specification" label="规格" min-width="120"></el-table-column>
|
||||
<el-table-column prop="supplier" label="供应商" min-width="150"></el-table-column>
|
||||
<el-table-column
|
||||
prop="findType"
|
||||
label="类型"
|
||||
width="100"
|
||||
align="center"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.findType === '1' ? 'success' : 'info'">
|
||||
{{ scope.row.findType === '1' ? '采购' : '材料' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="installationQuantity" label="安装量" width="100" align="center"></el-table-column>
|
||||
<el-table-column
|
||||
prop="contractSigning"
|
||||
label="合同签订时间"
|
||||
width="180"
|
||||
align="center"
|
||||
>
|
||||
<template #default="scope">
|
||||
{{ formatDate(scope.row.contractSigning) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="createTime"
|
||||
label="创建时间"
|
||||
width="180"
|
||||
align="center"
|
||||
>
|
||||
<template #default="scope">
|
||||
{{ formatDate(scope.row.createTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
width="180"
|
||||
align="center"
|
||||
fixed="right"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
size="small"
|
||||
icon="Edit"
|
||||
@click="handleEdit(scope.row)"
|
||||
class="text-blue-600 hover:text-blue-800 transition-colors"
|
||||
></el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
class="text-red-600 hover:text-red-800 transition-colors"
|
||||
></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<div class="flex items-center justify-between p-4 border-t">
|
||||
<div class="text-gray-500 text-sm">
|
||||
共 {{ total }} 条记录,当前显示第 {{ (currentPage - 1) * pageSize + 1 }} 至 {{ Math.min(currentPage * pageSize, total) }} 条
|
||||
</div>
|
||||
<el-pagination
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="total"
|
||||
layout="prev, pager, next, jumper, sizes"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- 底部信息 -->
|
||||
<footer class="bg-white border-t border-gray-200 py-3 px-6 text-center text-gray-500 text-sm">
|
||||
© 2023 材料/采购管理系统 - 版权所有
|
||||
</footer>
|
||||
|
||||
<!-- 新增/编辑对话框 -->
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="dialogType === 'add' ? '新增记录' : '编辑记录'"
|
||||
:width="dialogWidth"
|
||||
:fullscreen="isFullscreen"
|
||||
:before-close="handleDialogClose"
|
||||
>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="120px"
|
||||
class="space-y-4"
|
||||
>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="材料名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入材料名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规格" prop="specification">
|
||||
<el-input v-model="formData.specification" placeholder="请输入规格"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供应商" prop="supplier">
|
||||
<el-input v-model="formData.supplier" placeholder="请输入供应商"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="类型" prop="findType">
|
||||
<el-radio-group v-model="formData.findType">
|
||||
<el-radio label="1">采购</el-radio>
|
||||
<el-radio label="2">材料</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="安装量" prop="installationQuantity">
|
||||
<el-input v-model="formData.installationQuantity" placeholder="请输入安装量"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="安装比例" prop="installationRatio">
|
||||
<el-input v-model="formData.installationRatio" placeholder="请输入安装比例" suffix="%"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同签订时间" prop="contractSigning">
|
||||
<el-date-picker
|
||||
v-model="formData.contractSigning"
|
||||
type="datetime"
|
||||
placeholder="选择合同签订时间"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="生产周期(天)" prop="productionPhase">
|
||||
<el-input v-model.number="formData.productionPhase" placeholder="请输入生产周期" type="number"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="运算周期(天)" prop="executionCycle">
|
||||
<el-input v-model.number="formData.executionCycle" placeholder="请输入运算周期" type="number"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="项目ID" prop="projectId">
|
||||
<el-input v-model.number="formData.projectId" placeholder="请输入项目ID" type="number"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="供货要求" prop="supplyRequirements">
|
||||
<el-input
|
||||
v-model="formData.supplyRequirements"
|
||||
placeholder="请输入供货要求"
|
||||
type="textarea"
|
||||
rows="3"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="采购提交状态" prop="purchaseSubmission">
|
||||
<el-select v-model="formData.purchaseSubmission" placeholder="请选择">
|
||||
<el-option label="已提交" value="已提交"></el-option>
|
||||
<el-option label="未提交" value="未提交"></el-option>
|
||||
<el-option label="处理中" value="处理中"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="材料提交状态" prop="submissionMaterials">
|
||||
<el-select v-model="formData.submissionMaterials" placeholder="请选择">
|
||||
<el-option label="已提交" value="已提交"></el-option>
|
||||
<el-option label="未提交" value="未提交"></el-option>
|
||||
<el-option label="处理中" value="处理中"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
placeholder="请输入备注信息"
|
||||
type="textarea"
|
||||
rows="3"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 隐藏的创建和更新信息 -->
|
||||
<el-form-item prop="id" class="hidden">
|
||||
<el-input v-model="formData.id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="createTime" class="hidden">
|
||||
<el-input v-model="formData.createTime"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<div class="flex justify-end gap-2">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="handleSave"
|
||||
:loading="saveLoading"
|
||||
>
|
||||
保存
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 删除确认对话框 -->
|
||||
<el-dialog
|
||||
v-model="deleteDialogVisible"
|
||||
title="确认删除"
|
||||
width="300px"
|
||||
:show-close="false"
|
||||
>
|
||||
<div class="text-center py-4">
|
||||
<el-icon class="text-orange-500 text-4xl mb-3"><WarningFilled /></el-icon>
|
||||
<p>确定要删除这条记录吗?</p>
|
||||
<p class="text-gray-500 text-sm mt-2">此操作不可撤销,请谨慎操作</p>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="flex justify-center gap-2">
|
||||
<el-button @click="deleteDialogVisible = false">取消</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
@click="confirmDelete"
|
||||
:loading="deleteLoading"
|
||||
>
|
||||
确认删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, computed, toRaw } from 'vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { WarningFilled } from '@element-plus/icons-vue';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
const userStore = useUserStoreHook();
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const { proxy } = getCurrentInstance();
|
||||
import { useMaterialsQueryList,newMaterialsAdd,materialsEdit,materialsDel,queryMaterialsInfo} from "@/api/materials/usageMaterials/index";
|
||||
// 表格数据相关
|
||||
const tableData = ref([]);
|
||||
const total = ref(0);
|
||||
const currentPage = ref(1);
|
||||
const pageSize = ref(10);
|
||||
const loading = ref(false);
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
findType: '3', // 默认查询所有
|
||||
keyword: ''
|
||||
});
|
||||
|
||||
// 对话框相关
|
||||
const dialogVisible = ref(false);
|
||||
const dialogType = ref('add'); // add 或 edit
|
||||
const dialogWidth = ref('70%');
|
||||
const isFullscreen = ref(false);
|
||||
const deleteDialogVisible = ref(false);
|
||||
const formRef = ref(null);
|
||||
const saveLoading = ref(false);
|
||||
const deleteLoading = ref(false);
|
||||
const currentRow = ref(null);
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
specification: '',
|
||||
supplier: '',
|
||||
findType: '1', // 默认采购
|
||||
installationQuantity: '',
|
||||
installationRatio: '',
|
||||
contractSigning: '',
|
||||
productionPhase: null,
|
||||
executionCycle: null,
|
||||
projectId: null,
|
||||
supplyRequirements: '',
|
||||
purchaseSubmission: '',
|
||||
submissionMaterials: '',
|
||||
remark: '',
|
||||
createTime: '',
|
||||
createBy: null,
|
||||
updateTime: '',
|
||||
updateBy: null
|
||||
});
|
||||
|
||||
// 表单验证规则
|
||||
const formRules = reactive({
|
||||
name: [
|
||||
{ required: true, message: '请输入材料名称', trigger: 'blur' },
|
||||
{ max: 50, message: '材料名称不能超过50个字符', trigger: 'blur' }
|
||||
],
|
||||
supplier: [
|
||||
{ required: true, message: '请输入供应商', trigger: 'blur' },
|
||||
{ max: 100, message: '供应商名称不能超过100个字符', trigger: 'blur' }
|
||||
],
|
||||
findType: [
|
||||
{ required: true, message: '请选择类型', trigger: 'change' }
|
||||
]
|
||||
});
|
||||
|
||||
// 初始化页面
|
||||
onMounted(() => {
|
||||
fetchData();
|
||||
});
|
||||
|
||||
// 格式化日期
|
||||
const formatDate = (dateString) => {
|
||||
if (!dateString) return '-';
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleString('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit'
|
||||
}).replace(',', ' ');
|
||||
};
|
||||
|
||||
// 表格行样式
|
||||
const tableRowClassName = ({ row, rowIndex }) => {
|
||||
return rowIndex % 2 === 0 ? 'bg-white' : 'bg-gray-50';
|
||||
};
|
||||
|
||||
// 获取数据
|
||||
const fetchData = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await useMaterialsQueryList({
|
||||
projectId: currentProject.value?.id,
|
||||
findType:2
|
||||
});
|
||||
|
||||
tableData.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
} catch (error) {
|
||||
ElMessage.error('获取数据失败:' + error.message);
|
||||
console.error(error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 搜索
|
||||
const handleSearch = () => {
|
||||
currentPage.value = 1; // 重置到第一页
|
||||
fetchData();
|
||||
};
|
||||
|
||||
// 刷新数据
|
||||
const refreshData = () => {
|
||||
fetchData();
|
||||
ElMessage.success('数据已刷新');
|
||||
};
|
||||
|
||||
// 分页大小改变
|
||||
const handleSizeChange = (val) => {
|
||||
pageSize.value = val;
|
||||
currentPage.value = 1;
|
||||
fetchData();
|
||||
};
|
||||
|
||||
// 当前页改变
|
||||
const handleCurrentChange = (val) => {
|
||||
currentPage.value = val;
|
||||
fetchData();
|
||||
};
|
||||
|
||||
// 新增
|
||||
const handleAdd = () => {
|
||||
dialogType.value = 'add';
|
||||
resetForm();
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
|
||||
// 编辑
|
||||
const handleEdit = (row) => {
|
||||
dialogType.value = 'edit';
|
||||
currentRow.value = row;
|
||||
resetForm();
|
||||
|
||||
// 填充表单数据
|
||||
Object.keys(formData).forEach(key => {
|
||||
if (row.hasOwnProperty(key)) {
|
||||
formData[key] = row[key];
|
||||
}
|
||||
});
|
||||
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
|
||||
// 双击行编辑
|
||||
const handleRowDblClick = (row) => {
|
||||
handleEdit(row);
|
||||
};
|
||||
|
||||
// 删除
|
||||
const handleDelete = (row) => {
|
||||
currentRow.value = row;
|
||||
deleteDialogVisible.value = true;
|
||||
};
|
||||
|
||||
// 确认删除
|
||||
const confirmDelete = async () => {
|
||||
if (!currentRow.value) return;
|
||||
|
||||
deleteLoading.value = true;
|
||||
try {
|
||||
// 模拟API请求
|
||||
await new Promise(resolve => setTimeout(resolve, 500));
|
||||
|
||||
// 从表格中移除数据
|
||||
tableData.value = tableData.value.filter(item => item.id !== currentRow.value.id);
|
||||
total.value--;
|
||||
|
||||
deleteDialogVisible.value = false;
|
||||
ElMessage.success('删除成功');
|
||||
} catch (error) {
|
||||
ElMessage.error('删除失败:' + error.message);
|
||||
console.error(error);
|
||||
} finally {
|
||||
deleteLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 保存
|
||||
const handleSave = async () => {
|
||||
// 表单验证
|
||||
if (!formRef.value) return;
|
||||
const valid = await formRef.value.validate();
|
||||
if (!valid) return;
|
||||
|
||||
saveLoading.value = true;
|
||||
try {
|
||||
// 模拟API请求
|
||||
await new Promise(resolve => setTimeout(resolve, 800));
|
||||
|
||||
const form = toRaw(formData);
|
||||
|
||||
if (dialogType.value === 'add') {
|
||||
// 新增
|
||||
const newId = Math.max(...tableData.value.map(item => item.id), 0) + 1;
|
||||
const newItem = {
|
||||
...form,
|
||||
id: newId,
|
||||
createTime: new Date().toISOString().slice(0, 19).replace('T', ' '),
|
||||
createBy: 1, // 假设当前用户ID为1
|
||||
updateTime: null,
|
||||
updateBy: null
|
||||
};
|
||||
tableData.value.unshift(newItem);
|
||||
total.value++;
|
||||
ElMessage.success('新增成功');
|
||||
} else {
|
||||
// 编辑
|
||||
const index = tableData.value.findIndex(item => item.id === form.id);
|
||||
if (index !== -1) {
|
||||
tableData.value[index] = {
|
||||
...form,
|
||||
updateTime: new Date().toISOString().slice(0, 19).replace('T', ' '),
|
||||
updateBy: 1 // 假设当前用户ID为1
|
||||
};
|
||||
ElMessage.success('更新成功');
|
||||
}
|
||||
}
|
||||
|
||||
dialogVisible.value = false;
|
||||
} catch (error) {
|
||||
ElMessage.error('保存失败:' + error.message);
|
||||
console.error(error);
|
||||
} finally {
|
||||
saveLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 重置表单
|
||||
const resetForm = () => {
|
||||
if (formRef.value) {
|
||||
formRef.value.resetFields();
|
||||
}
|
||||
|
||||
// 重置表单数据
|
||||
Object.keys(formData).forEach(key => {
|
||||
formData[key] = '';
|
||||
});
|
||||
|
||||
// 设置默认值
|
||||
formData.findType = '1';
|
||||
formData.id = '';
|
||||
};
|
||||
|
||||
// 关闭对话框
|
||||
const handleDialogClose = () => {
|
||||
resetForm();
|
||||
dialogVisible.value = false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 自定义表格行悬停样式 */
|
||||
::v-deep .el-table__row:hover > td {
|
||||
background-color: #f0f7ff !important;
|
||||
}
|
||||
|
||||
/* 表单间距优化 */
|
||||
::v-deep .el-form-item {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
/* 对话框动画 */
|
||||
::v-deep .el-dialog__wrapper {
|
||||
backdrop-filter: blur(2px);
|
||||
}
|
||||
|
||||
/* 按钮样式优化 */
|
||||
::v-deep .el-button--primary {
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
::v-deep .el-button--primary:hover {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
</style>
|
176
src/views/materials/usageMaterials/purchase/index.vue
Normal file
176
src/views/materials/usageMaterials/purchase/index.vue
Normal file
@ -0,0 +1,176 @@
|
||||
<template>
|
||||
<div class="overall-plan-material-supply">
|
||||
<!-- tabPosition="left" -->
|
||||
<el-card shadow="always">
|
||||
<el-form :inline="true">
|
||||
<el-form-item v-if="state.masterData.status == 'draft'">
|
||||
<el-button type="primary" icon="edit" @click="clickApprovalSheet1()">审批</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="state.masterData.status == 'waiting' || state.masterData.status == 'finish'">
|
||||
<el-button icon="view" @click="lookApprovalFlow()" type="warning">查看流程</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-table :data="state.tableData" v-loading="state.loading.list" stripe
|
||||
style="width: 100%; margin-bottom: 20px; height: calc(100vh - 230px)" row-key="id" border>
|
||||
<el-table-column prop="num" label="编号" />
|
||||
<el-table-column prop="name" label="工程或费用名称" />
|
||||
<el-table-column prop="unit" label="单位" />
|
||||
<el-table-column prop="quantity" label="数量" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column label="操作">
|
||||
<template #default="{ row }">
|
||||
<el-button :disabled="state.masterData.status == 'waiting' || state.masterData.status == 'finish'" type="primary" @click="editApprovalSheet(row)">修改</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 编辑 -->
|
||||
<el-dialog v-model="visible" title="修改物料信息" :width="800" :close-on-click-modal="false" @close="handleClose">
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="120px" class="space-y-4">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="批次号" prop="batchNumber">
|
||||
<el-input disabled v-model="formData.batchNumber" placeholder="请输入批次号" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="品牌" prop="brand">
|
||||
<el-input v-model="formData.brand" placeholder="请输入品牌" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 物料属性区域 -->
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="材质" prop="texture">
|
||||
<el-input v-model="formData.texture" placeholder="请输入材质" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="质量标准" prop="qualityStandard">
|
||||
<el-input v-model="formData.qualityStandard" placeholder="请输入质量标准" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 日期与状态区域 -->
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="使用部位" prop="partUsed">
|
||||
<el-input v-model="formData.partUsed" placeholder="请输入使用部位" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="交货地点" prop="deliveryPoints">
|
||||
<el-input v-model="formData.deliveryPoints" placeholder="请输入交货地点" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 其他信息区域 -->
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="预计使用日期" prop="dateService">
|
||||
<el-date-picker v-model="formData.dateService" type="date" placeholder="选择预计使用日期"
|
||||
format="YYYY-MM-DD" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注信息" type="textarea" rows="3" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="billofQuantities">
|
||||
import { ref, reactive, onMounted, computed, getCurrentInstance } from 'vue';
|
||||
import { obtainMasterDataList, totalsupplyplan, totalSupplyplanDetails, materialChangeSupplyplan } from '@/api/materials/overallPlanMaterialSupply/index';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
const userStore = useUserStoreHook();
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const { proxy } = getCurrentInstance();
|
||||
const visible = ref(false);
|
||||
const formRef = ref(null);
|
||||
const state = reactive({
|
||||
tableData: [],
|
||||
queryForm: {
|
||||
projectId: currentProject.value?.id,
|
||||
versions: '',
|
||||
sheet: '',
|
||||
pageSize: 20,
|
||||
pageNum: 1
|
||||
},
|
||||
loading: {
|
||||
versions: false,
|
||||
sheets: false,
|
||||
list: false
|
||||
},
|
||||
// 主id
|
||||
masterData: {}
|
||||
|
||||
});
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
batchNumber: '',
|
||||
brand: '',
|
||||
compileDate: '',
|
||||
dateService: '',
|
||||
deliveryPoints: '',
|
||||
id: undefined,
|
||||
name: '',
|
||||
num: '',
|
||||
partUsed: '',
|
||||
planNumber: '',
|
||||
projectId: undefined,
|
||||
qualityStandard: '',
|
||||
quantity: 0,
|
||||
remark: '',
|
||||
specification: '',
|
||||
status: '',
|
||||
texture: '',
|
||||
unit: ''
|
||||
});
|
||||
// 表单验证规则
|
||||
const formRules = reactive({
|
||||
name: [
|
||||
{ required: true, message: '请输入名称', trigger: 'blur' },
|
||||
{ max: 100, message: '名称长度不能超过100个字符', trigger: 'blur' }
|
||||
],
|
||||
num: [
|
||||
{ required: true, message: '请输入编号', trigger: 'blur' },
|
||||
{ max: 50, message: '编号长度不能超过50个字符', trigger: 'blur' }
|
||||
],
|
||||
quantity: [
|
||||
{ required: true, message: '请输入数量', trigger: 'blur' },
|
||||
{ type: 'number', min: 0, message: '数量不能为负数', trigger: 'blur' }
|
||||
],
|
||||
compileDate: [
|
||||
{ required: true, message: '请选择编制日期', trigger: 'change' }
|
||||
]
|
||||
});
|
||||
// 获取主表数据
|
||||
onMounted(() => {
|
||||
getMasterDataList();
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
.overall-plan-material-supply {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.space-y-4>.el-row {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.space-y-4>.el-row:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user