From b58f53769f004fb0ba6b5aedf55ef602850c7c97 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期日, 20 九月 2026 15:46:05 +0800
Subject: [PATCH] 天津豹鸣app 1.部署修改
---
src/pages/projectManagement/project/index.vue | 357 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 357 insertions(+), 0 deletions(-)
diff --git a/src/pages/projectManagement/project/index.vue b/src/pages/projectManagement/project/index.vue
new file mode 100644
index 0000000..981fc18
--- /dev/null
+++ b/src/pages/projectManagement/project/index.vue
@@ -0,0 +1,357 @@
+<template>
+ <view class="sales-account">
+ <PageHeader title="椤圭洰绠$悊"
+ @back="goBack" />
+
+ <view class="search-section">
+ <view class="search-bar">
+ <view class="search-input">
+ <up-input class="search-text"
+ v-model="query.projectNameOrCode"
+ placeholder="璇疯緭鍏ラ」鐩悕绉�/缂栧彿"
+ clearable
+ @change="getList" />
+ </view>
+ <view class="filter-button"
+ @click="showFilter = true">
+ <up-icon name="list"
+ size="24"
+ color="#999"></up-icon>
+ </view>
+ </view>
+ </view>
+
+ <view v-if="projectList.length > 0"
+ class="ledger-list">
+ <view v-for="item in projectList"
+ :key="item.id"
+ class="ledger-item">
+ <view class="item-header">
+ <view class="item-left">
+ <view class="document-icon">
+ <up-icon name="grid"
+ size="16"
+ color="#ffffff"></up-icon>
+ </view>
+ <text class="item-id">{{ item.billNo || "-" }}</text>
+ </view>
+ <up-tag :text="dictLabel(auditOptions, item.auditStatus)"
+ :type="dictTagType(auditOptions, item.auditStatus)"
+ size="mini"
+ shape="circle" />
+ </view>
+ <up-divider></up-divider>
+ <view class="item-details">
+ <view class="detail-row">
+ <text class="detail-label">椤圭洰鍚嶇О</text>
+ <text class="detail-value highlight">{{ item.projectName || "-" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瀹㈡埛鍚嶇О</text>
+ <text class="detail-value">{{ item.customerName || "-" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">绔嬮」鏃ユ湡</text>
+ <text class="detail-value">{{ item.setupDate || "-" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">椤圭洰鏉ユ簮</text>
+ <text class="detail-value">{{ item.projectSource || "-" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">椤圭洰鍒嗙被</text>
+ <text class="detail-value">{{ item.projectClassification || "-" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">璁″垝鐘舵��</text>
+ <text class="detail-value">{{ dictLabel(stageOptions, item.projectStage) || "-" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">椤圭洰閲戦</text>
+ <text class="detail-value">{{ formatAmount(item.projectAmount) }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">閿�鍞悎鍚屾�绘暟</text>
+ <text class="detail-value">{{ item.salesContractCount ?? 0 }}</text>
+ </view>
+ </view>
+ <view class="action-buttons">
+ <up-button class="action-btn"
+ size="small"
+ type="primary"
+ @click="goDetail(item)">璇︽儏</up-button>
+ <up-button class="action-btn"
+ size="small"
+ @click="goEdit(item)">缂栬緫</up-button>
+ <up-button class="action-btn"
+ size="small"
+ @click="goProgress(item)">杩涘害姹囨姤</up-button>
+ <up-button class="action-btn"
+ size="small"
+ @click="goArchive(item)">鏂囨。褰掓。</up-button>
+ <up-button v-if="canSubmit(item)"
+ class="action-btn"
+ size="small"
+ type="success"
+ @click="handleSubmitRow(item)">鎻愪氦</up-button>
+ <up-button v-if="canAudit(item)"
+ class="action-btn"
+ size="small"
+ type="warning"
+ @click="handleAuditRow(item)">瀹℃牳</up-button>
+ <up-button class="action-btn"
+ size="small"
+ type="error"
+ plain
+ @click="handleDelete(item)">鍒犻櫎</up-button>
+ </view>
+ </view>
+ </view>
+ <view v-else
+ class="no-data">
+ <text>鏆傛棤椤圭洰鏁版嵁</text>
+ </view>
+
+ <view class="fab-button"
+ @click="goAdd">
+ <up-icon name="plus"
+ size="28"
+ color="#ffffff"></up-icon>
+ </view>
+
+ <FilterPanel v-model:show="showFilter"
+ :model-value="query"
+ title="椤圭洰绛涢��"
+ :fields="filterFields"
+ @search="onFilterSearch"
+ @reset="onFilterSearch" />
+ </view>
+</template>
+
+<script setup>
+ import { computed, reactive, ref } from "vue";
+ import { onShow } from "@dcloudio/uni-app";
+ import PageHeader from "@/components/PageHeader.vue";
+ import FilterPanel from "@/components/FilterPanel.vue";
+ import { useDict } from "@/utils/dict";
+ import { unwrapList } from "@/utils/list";
+ import {
+ auditProject,
+ delProject,
+ listProject,
+ submitProject,
+ } from "@/api/projectManagement/project";
+ import { toListRow } from "./_utils/mapper";
+ import { dictLabel, dictTagType, toPickerOptions } from "./_utils/dict";
+
+ const { bill_status, project_management, plan_status } = useDict(
+ "bill_status",
+ "project_management",
+ "plan_status"
+ );
+
+ const billOptions = computed(() => toPickerOptions(bill_status.value));
+ const auditOptions = computed(() => toPickerOptions(project_management.value));
+ const stageOptions = computed(() => toPickerOptions(plan_status.value));
+
+ const projectList = ref([]);
+ const showFilter = ref(false);
+
+ // 鍚庣娌℃湁鍗曟嵁鐘舵�侊紙billStatus锛夌殑鏌ヨ鍙傛暟锛岀鐞嗙涔熸槸鎷夊洖鍒楄〃鍚庢湰鍦拌繃婊�
+ const query = reactive({
+ projectNameOrCode: "",
+ customerName: "",
+ salesperson: "",
+ billStatus: "",
+ projectStage: "",
+ auditStatus: "",
+ });
+
+ const filterFields = computed(() => [
+ {
+ prop: "projectNameOrCode",
+ label: "椤圭洰鍚嶇О/缂栧彿",
+ type: "input",
+ placeholder: "璇疯緭鍏ラ」鐩悕绉�/缂栧彿",
+ },
+ {
+ prop: "customerName",
+ label: "瀹㈡埛鍚嶇О",
+ type: "input",
+ placeholder: "璇疯緭鍏ュ鎴峰悕绉�",
+ },
+ {
+ prop: "salesperson",
+ label: "涓氬姟浜哄憳",
+ type: "input",
+ placeholder: "璇疯緭鍏ヤ笟鍔′汉鍛�",
+ },
+ {
+ prop: "billStatus",
+ label: "鍗曟嵁鐘舵��",
+ type: "select",
+ options: billOptions.value,
+ },
+ {
+ prop: "projectStage",
+ label: "璁″垝鐘舵��",
+ type: "select",
+ options: stageOptions.value,
+ },
+ {
+ prop: "auditStatus",
+ label: "瀹℃牳鐘舵��",
+ type: "select",
+ options: auditOptions.value,
+ },
+ ]);
+
+ const goBack = () => uni.navigateBack();
+
+ const goAdd = () => {
+ uni.removeStorageSync("projectDetail");
+ uni.navigateTo({ url: "/pages/projectManagement/project/edit" });
+ };
+
+ const goEdit = item => {
+ uni.setStorageSync("projectDetail", item || {});
+ uni.navigateTo({
+ url: `/pages/projectManagement/project/edit?id=${item.id}`,
+ });
+ };
+
+ const goDetail = item => {
+ uni.setStorageSync("projectDetail", item || {});
+ uni.navigateTo({
+ url: `/pages/projectManagement/project/detail?id=${item.id}`,
+ });
+ };
+
+ const goProgress = item => {
+ uni.setStorageSync("projectDetail", item || {});
+ uni.navigateTo({
+ url: `/pages/projectManagement/project/progress?id=${item.id}`,
+ });
+ };
+
+ const goArchive = item => {
+ uni.navigateTo({
+ url: `/pages/projectManagement/project/archive?id=${item.id}&name=${encodeURIComponent(item.projectName || "")}`,
+ });
+ };
+
+ const formatAmount = amount =>
+ amount === null || amount === undefined || amount === ""
+ ? "-"
+ : `楼${Number(amount).toFixed(2)}`;
+
+ // 鎻愪氦 / 瀹℃牳鏄嚎鎬ф祦绋嬶細鏂板缓(鏃犵姸鎬�) 鈫� 鎻愪氦(reviewStatus 0) 鈫� 瀹℃牳(reviewStatus 1)銆�
+ // 绠$悊绔彟鏈夊弽瀹℃牳锛屾墜鏈虹鎸夌害瀹氫笉鍋氥��
+ const canSubmit = item => String(item?.auditStatus ?? "") === "";
+ const canAudit = item => String(item?.auditStatus) === "0";
+
+ const getList = () => {
+ listProject({
+ noOrName: query.projectNameOrCode || undefined,
+ clientName: query.customerName || undefined,
+ salesmanName: query.salesperson || undefined,
+ reviewStatus: query.auditStatus || undefined,
+ stage: query.projectStage || undefined,
+ current: -1,
+ size: -1,
+ })
+ .then(res => {
+ const rows = unwrapList(res).map(toListRow);
+ projectList.value = query.billStatus
+ ? rows.filter(
+ item => String(item.billStatus) === String(query.billStatus)
+ )
+ : rows;
+ })
+ .catch(() => {
+ uni.showToast({ title: "鏌ヨ澶辫触", icon: "none" });
+ });
+ };
+
+ // FilterPanel 鍙洖鍚愮瓫閫夊�硷紝鍐欏洖 query 鍚庣粺涓�鏌ヨ
+ const onFilterSearch = values => {
+ Object.assign(query, values);
+ getList();
+ };
+
+ const confirmStatusAction = (item, label, content, action) => {
+ uni.showModal({
+ title: `${label}纭`,
+ content,
+ success: res => {
+ if (!res.confirm) return;
+ uni.showLoading({ title: "澶勭悊涓�...", mask: true });
+ action({ id: item.id })
+ .then(() => {
+ uni.showToast({ title: `${label}鎴愬姛`, icon: "success" });
+ getList();
+ })
+ .catch(() => {
+ uni.showToast({ title: `${label}澶辫触`, icon: "none" });
+ })
+ .finally(() => {
+ uni.hideLoading();
+ });
+ },
+ });
+ };
+
+ const handleSubmitRow = item => {
+ if (!item?.id) return;
+ confirmStatusAction(item, "鎻愪氦", "纭鎻愪氦璇ラ」鐩悧锛�", submitProject);
+ };
+
+ const handleAuditRow = item => {
+ if (!item?.id) return;
+ confirmStatusAction(item, "瀹℃牳", "纭瀹℃牳閫氳繃璇ラ」鐩悧锛�", auditProject);
+ };
+
+ const handleDelete = item => {
+ if (!item?.id) return;
+ uni.showModal({
+ title: "鍒犻櫎纭",
+ content: `纭鍒犻櫎椤圭洰銆�${item.projectName || ""}銆嶅悧锛焋,
+ success: res => {
+ if (!res.confirm) return;
+ uni.showLoading({ title: "澶勭悊涓�...", mask: true });
+ delProject([item.id])
+ .then(() => {
+ uni.showToast({ title: "鍒犻櫎鎴愬姛", icon: "success" });
+ getList();
+ })
+ .catch(() => {
+ uni.showToast({ title: "鍒犻櫎澶辫触", icon: "none" });
+ })
+ .finally(() => {
+ uni.hideLoading();
+ });
+ },
+ });
+ };
+
+ onShow(() => {
+ getList();
+ });
+</script>
+
+<style scoped lang="scss">
+ @import "@/styles/sales-common.scss";
+
+ .detail-value {
+ max-width: 70%;
+ word-break: break-all;
+ }
+
+ .action-buttons {
+ flex-wrap: wrap;
+ }
+
+ .action-btn {
+ flex: 0 0 calc(33.33% - 8px);
+ }
+</style>
--
Gitblit v1.9.3