From c8cc1a329b3cb3076958160fa699583892bacffa Mon Sep 17 00:00:00 2001
From: Teo <2642673902@qq.com>
Date: Thu, 21 Aug 2025 01:39:29 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E4=BB=BB=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/patch/index.vue | 101 ++----
src/views/tender/plan/comm/planPage.vue | 245 +++++++++++++++
src/views/tender/plan/index.vue | 389 +-----------------------
3 files changed, 284 insertions(+), 451 deletions(-)
create mode 100644 src/views/tender/plan/comm/planPage.vue
diff --git a/src/views/patch/index.vue b/src/views/patch/index.vue
index 1282df4..b068541 100644
--- a/src/views/patch/index.vue
+++ b/src/views/patch/index.vue
@@ -5,24 +5,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
搜索
重置
@@ -31,7 +16,6 @@
-
@@ -39,21 +23,12 @@
新增
-
- 修改
-
-
- 删除
-
导出
-
@@ -91,22 +66,20 @@
-
+
-
-
- 新增进度
-
+
+ 新增进度
@@ -144,21 +117,12 @@
-
-
-
-
-
-
-
-
-
@@ -181,15 +145,14 @@
-
-
-
- 已自动关联当前选中项目
-
-
+
+
+
+
+
@@ -197,10 +160,10 @@
-
+
-
+
@@ -241,37 +204,17 @@ const userStore = useUserStoreHook();
const currentProject = computed(() => userStore.selectedProject);
const currentProjectId = computed(() => currentProject.value?.id);
// 1. 调整类型定义,匹配接口返回的字段
-const slaveOptions = ref>([]);
-// 在脚本中添加选择变化的处理函数
-const handleSlaveChange = (name) => {
- // 找到选中的用户对象
- const selectedUser = slaveOptions.value.find((item) => item.name === name);
- if (selectedUser) {
- // 自动填充userId到slaveId
- progressForm.slaveId = selectedUser.id;
- } else {
- // 未选中时清空ID
- progressForm.slaveId = '';
- }
-};
-
+const slaveOptions = ref([]);
+const userMap = new Map();
async function initSlaveOptions() {
try {
const response = await getUserName();
- // 确保获取到正确的数组数据(接口返回在data字段中)
- const userDataList = Array.isArray(response?.data) ? response.data : [];
-
- // 转换数据结构,只提取需要的字段(userId作为id,nickName作为name)
- slaveOptions.value = userDataList
- .filter((item) => item?.userId && item?.nickName) // 过滤有效数据
- .map((item) => ({
- id: item.userId, // 使用userId作为选项的id
- name: item.nickName // 使用nickName作为显示名称
- }));
-
- console.log('slaveOptions 已更新:', slaveOptions.value);
+ console.log(response);
+ slaveOptions.value = response.data;
+ slaveOptions.value.forEach((item) => {
+ userMap.set(item.userId, item.nickName);
+ });
} catch (error) {
- console.error('获取用户数据失败:', error);
slaveOptions.value = []; // 错误时重置为空数组
}
}
@@ -344,7 +287,7 @@ const queryFormRef = ref();
const masterFormRef = ref();
const dialog = reactive({ visible: false, title: '' });
-const initFormData: MasterForm = {
+const initFormData = {
id: undefined,
projectId: currentProjectId.value,
taskName: undefined,
@@ -353,7 +296,9 @@ const initFormData: MasterForm = {
act: undefined,
completionProgress: undefined,
taskStatus: undefined,
- remark: undefined
+ remark: undefined,
+ userId: '',
+ userName: ''
};
const data = reactive>({
@@ -372,6 +317,7 @@ const data = reactive>({
},
rules: {
projectId: [{ required: true, message: '请输入项目ID', trigger: 'blur' }],
+ userId: [{ required: true, message: '请选择执行人', trigger: 'blur' }],
taskName: [{ required: true, message: '请输入任务名称', trigger: 'blur' }],
completionProgress: [{ required: true, message: '请输入完成进度', trigger: 'blur' }]
}
@@ -610,6 +556,7 @@ const submitForm = () => {
masterFormRef.value?.validate(async (valid: boolean) => {
if (!valid) return;
buttonLoading.value = true;
+ form.value.userName = userMap.get(form.value.userId);
try {
// 确保提交时使用当前项目ID
if (!form.value.id && currentProjectId.value) {
diff --git a/src/views/tender/plan/comm/planPage.vue b/src/views/tender/plan/comm/planPage.vue
new file mode 100644
index 0000000..b4b156c
--- /dev/null
+++ b/src/views/tender/plan/comm/planPage.vue
@@ -0,0 +1,245 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{ isExpandAll ? '一键收起' : '一键展开' }}
+
+
+
+
+ 导入excel
+
+
+
+
+ 导出excel
+
+
+
+
+
+
+
+
+
+
+
+
+ (scope.row.unitPrice = val)"
+ :precision="2"
+ :step="0.1"
+ :controls="false"
+ v-if="scope.row.quantity && scope.row.quantity != 0"
+ />
+
+
+
+
+ {{ scope.row.price }}
+
+
+
+
+ 修改
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/tender/plan/index.vue b/src/views/tender/plan/index.vue
index 8a0e6f2..0a6ec44 100644
--- a/src/views/tender/plan/index.vue
+++ b/src/views/tender/plan/index.vue
@@ -1,386 +1,27 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 搜索
- 重置
-
-
-
-
-
-
-
-
-
-
- 修改
-
-
- 导出
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ parseTime(scope.row.plannedBiddingTime, '{y}-{m}-{d}') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 已自动关联当前选中项目
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+