From a9d97b150701e634bdb751eab277696abd136cca Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 16 六月 2026 14:39:47 +0800
Subject: [PATCH] 君歌app 1.依照web端功能修改

---
 src/pages/productionDesign/processManagement/params.vue |  413 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 413 insertions(+), 0 deletions(-)

diff --git a/src/pages/productionDesign/processManagement/params.vue b/src/pages/productionDesign/processManagement/params.vue
new file mode 100644
index 0000000..0fa0bc0
--- /dev/null
+++ b/src/pages/productionDesign/processManagement/params.vue
@@ -0,0 +1,413 @@
+<template>
+  <view class="process-params">
+    <PageHeader :title="processName + ' - 鍙傛暟閰嶇疆'"
+                @back="goBack" />
+    <view class="ledger-list">
+      <view v-if="paramList.length > 0">
+        <view v-for="item in paramList"
+              :key="item.id"
+              class="ledger-item">
+          <view class="item-header">
+            <view class="item-left">
+              <view class="document-icon">
+                <up-icon name="setting-fill"
+                         size="16"
+                         color="#ffffff"></up-icon>
+              </view>
+              <text class="item-id">{{ item.paramName || "-" }}</text>
+            </view>
+          </view>
+          <up-divider></up-divider>
+          <view class="item-details">
+            <view class="detail-row">
+              <text class="detail-label">鏍囧噯鍊�</text>
+              <text class="detail-value highlight">{{ item.standardValue || "-" }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">鍗曚綅</text>
+              <text class="detail-value">{{ item.unit || "-" }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">鍙傛暟绫诲瀷</text>
+              <up-tag :text="getParamTypeText(item.paramType)"
+                      :type="getParamTypeTag(item.paramType)"
+                      size="mini" />
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">鍙栧�兼牸寮�</text>
+              <text class="detail-value">{{ item.paramFormat || "-" }}</text>
+            </view>
+          </view>
+          <view class="action-buttons">
+            <up-button class="action-btn"
+                       size="small"
+                       type="primary"
+                       @click="handleEditParam(item)">缂栬緫</up-button>
+            <up-button class="action-btn"
+                       size="small"
+                       type="error"
+                       @click="handleDeleteParam(item)">鍒犻櫎</up-button>
+          </view>
+        </view>
+      </view>
+      <view v-else
+            class="no-data">
+        <up-empty text="鏆傛棤鍙傛暟閰嶇疆"
+                  icon="account"
+                  iconSize="60"></up-empty>
+      </view>
+    </view>
+    <!-- 娴姩鏂板鎸夐挳 -->
+    <view class="fab-button"
+          @click="openSelectModal">
+      <up-icon name="plus"
+               size="28"
+               color="#ffffff"></up-icon>
+    </view>
+    <!-- 閫夋嫨鍙傛暟寮圭獥 -->
+    <up-modal :show="selectModalVisible"
+              title="閫夋嫨鍙傛暟"
+              width="650rpx"
+              @confirm="handleSelectSubmit"
+              @cancel="selectModalVisible = false"
+              :closeOnClickOverlay="false"
+              showCancelButton>
+      <view class="modal-content">
+        <view class="search-box">
+          <up-input v-model="searchKeyword"
+                    placeholder="鎼滅储鍩虹鍙傛暟鍚嶇О"
+                    clearable
+                    @confirm="handleSearch"
+                    @change="handleSearch" />
+        </view>
+        <scroll-view scroll-y
+                     class="param-scroll-list"
+                     @scrolltolower="loadMoreParams">
+          <view v-for="param in availableParams"
+                :key="param.id"
+                class="param-select-item"
+                :class="{ active: selectedBaseParam?.id === param.id }"
+                @click="selectParam(param)">
+            <view class="param-main">
+              <text class="param-name">{{ param.paramName }}</text>
+              <up-tag :text="getParamTypeText(param.paramType)"
+                      :type="getParamTypeTag(param.paramType)"
+                      size="mini" />
+            </view>
+            <text class="param-code">{{ param.paramCode }}</text>
+          </view>
+          <up-loadmore :status="availablePageStatus" />
+        </scroll-view>
+        <view v-if="selectedBaseParam"
+              class="standard-input-box">
+          <text class="label">鏍囧噯鍊硷細</text>
+          <up-input v-model="selectedStandardValue"
+                    placeholder="璇疯緭鍏ヨ宸ュ簭鐨勬爣鍑嗗��" />
+        </view>
+      </view>
+    </up-modal>
+    <!-- 缂栬緫鍙傛暟鏍囧噯鍊煎脊绐� -->
+    <up-modal :show="editModalVisible"
+              title="缂栬緫鏍囧噯鍊�"
+              width="500rpx"
+              @confirm="handleEditSubmit"
+              @cancel="editModalVisible = false"
+              :closeOnClickOverlay="false"
+              showCancelButton>
+      <view class="modal-content">
+        <view class="edit-info">
+          <text class="edit-label">鍙傛暟锛歿{ currentEditParam?.paramName }}</text>
+          <up-input v-model="currentEditValue"
+                    placeholder="璇疯緭鍏ユ柊鐨勬爣鍑嗗��" />
+        </view>
+      </view>
+    </up-modal>
+  </view>
+</template>
+
+<script setup>
+  import { reactive, ref, onMounted } from "vue";
+  import { onLoad } from "@dcloudio/uni-app";
+  import {
+    getProcessParamList,
+    addProcessParam,
+    editProcessParam,
+    deleteProcessParam,
+    getBaseParamList,
+  } from "@/api/productionManagement/processManagement";
+
+  const processId = ref(null);
+  const processName = ref("");
+  const paramList = ref([]);
+  const loading = ref(false);
+
+  // 閫夋嫨鍙傛暟鐩稿叧
+  const selectModalVisible = ref(false);
+  const availableParams = ref([]);
+  const searchKeyword = ref("");
+  const selectedBaseParam = ref(null);
+  const selectedStandardValue = ref("");
+  const availablePage = reactive({ current: 1, size: 20, total: 0 });
+  const availablePageStatus = ref("loadmore");
+
+  // 缂栬緫鍙傛暟鐩稿叧
+  const editModalVisible = ref(false);
+  const currentEditParam = ref(null);
+  const currentEditValue = ref("");
+
+  const goBack = () => {
+    uni.navigateBack();
+  };
+
+  const getParamList = () => {
+    loading.value = true;
+    getProcessParamList({ technologyOperationId: processId.value })
+      .then(res => {
+        paramList.value = res?.data || [];
+      })
+      .catch(() => {
+        uni.showToast({ title: "鑾峰彇鍒楄〃澶辫触", icon: "none" });
+      })
+      .finally(() => {
+        loading.value = false;
+      });
+  };
+
+  const openSelectModal = () => {
+    searchKeyword.value = "";
+    selectedBaseParam.value = null;
+    selectedStandardValue.value = "";
+    availableParams.value = [];
+    availablePage.current = 1;
+    availablePageStatus.value = "loadmore";
+    selectModalVisible.value = true;
+    loadAvailableParams(true);
+  };
+
+  const handleSearch = () => {
+    availablePage.current = 1;
+    availableParams.value = [];
+    availablePageStatus.value = "loadmore";
+    loadAvailableParams(true);
+  };
+
+  const loadMoreParams = () => {
+    if (
+      availablePageStatus.value === "nomore" ||
+      availablePageStatus.value === "loading"
+    )
+      return;
+    loadAvailableParams(false);
+  };
+
+  const loadAvailableParams = (isReset = false) => {
+    if (availablePageStatus.value === "loading") return;
+    if (isReset) {
+      availablePage.current = 1;
+      availableParams.value = [];
+      availablePageStatus.value = "loading";
+    } else if (availablePageStatus.value === "nomore") {
+      return;
+    } else {
+      availablePageStatus.value = "loading";
+    }
+    getBaseParamList({
+      paramName: searchKeyword.value,
+      current: availablePage.current,
+      size: availablePage.size,
+    })
+      .then(res => {
+        const records = res?.data?.records || res?.records || [];
+        const total = res?.data?.total || res?.total || 0;
+
+        if (isReset || availablePage.current === 1) {
+          availableParams.value = records;
+        } else {
+          availableParams.value = [...availableParams.value, ...records];
+        }
+
+        availablePage.total = total;
+        if (availableParams.value.length >= total) {
+          availablePageStatus.value = "nomore";
+        } else {
+          availablePageStatus.value = "loadmore";
+          availablePage.current++;
+        }
+      })
+      .catch(() => {
+        availablePageStatus.value = "loadmore";
+      });
+  };
+
+  const selectParam = param => {
+    selectedBaseParam.value = param;
+    selectedStandardValue.value = param.standardValue || "";
+  };
+
+  const handleSelectSubmit = () => {
+    if (!selectedBaseParam.value) {
+      uni.showToast({ title: "璇烽�夋嫨涓�涓熀纭�鍙傛暟", icon: "none" });
+      return;
+    }
+    if (!selectedStandardValue.value) {
+      uni.showToast({ title: "璇疯緭鍏ユ爣鍑嗗��", icon: "none" });
+      return;
+    }
+    addProcessParam({
+      technologyOperationId: processId.value,
+      technologyParamId: selectedBaseParam.value.id,
+      standardValue: selectedStandardValue.value,
+    })
+      .then(() => {
+        uni.showToast({ title: "娣诲姞鎴愬姛" });
+        selectModalVisible.value = false;
+        getParamList();
+      })
+      .catch(err => {
+        uni.showToast({ title: err.msg || "娣诲姞澶辫触", icon: "error" });
+      });
+  };
+
+  const handleEditParam = item => {
+    currentEditParam.value = item;
+    currentEditValue.value = item.standardValue;
+    editModalVisible.value = true;
+  };
+
+  const handleEditSubmit = () => {
+    if (!currentEditValue.value) {
+      uni.showToast({ title: "璇疯緭鍏ユ爣鍑嗗��", icon: "none" });
+      return;
+    }
+    editProcessParam({
+      id: currentEditParam.value.id,
+      technologyOperationId: processId.value,
+      technologyParamId: currentEditParam.value.technologyParamId,
+      standardValue: currentEditValue.value,
+    })
+      .then(() => {
+        uni.showToast({ title: "淇敼鎴愬姛" });
+        editModalVisible.value = false;
+        getParamList();
+      })
+      .catch(err => {
+        uni.showToast({ title: err.msg || "淇敼澶辫触", icon: "error" });
+      });
+  };
+
+  const handleDeleteParam = item => {
+    uni.showModal({
+      title: "鎻愮ず",
+      content: "纭畾瑕佸垹闄よ鍙傛暟閰嶇疆鍚楋紵",
+      success: res => {
+        if (res.confirm) {
+          deleteProcessParam(item.id).then(() => {
+            uni.showToast({ title: "鍒犻櫎鎴愬姛" });
+            getParamList();
+          });
+        }
+      },
+    });
+  };
+
+  const getParamTypeText = type => {
+    const typeMap = { 1: "鏁板��", 2: "鏂囨湰", 3: "涓嬫媺", 4: "鏃堕棿" };
+    return typeMap[type] || "鏈煡";
+  };
+
+  const getParamTypeTag = type => {
+    const typeMap = { 1: "primary", 2: "info", 3: "warning", 4: "success" };
+    return typeMap[type] || "default";
+  };
+
+  onLoad(option => {
+    if (option.id) {
+      processId.value = option.id;
+      processName.value = decodeURIComponent(option.name || "");
+      getParamList();
+    }
+  });
+</script>
+
+<style scoped lang="scss">
+  @import "@/styles/procurement-common.scss";
+
+  .process-params {
+    min-height: 100vh;
+    background: #f5f5f5;
+  }
+
+  .modal-content {
+    padding: 20rpx 0;
+    width: 100%;
+  }
+
+  .param-scroll-list {
+    height: 500rpx;
+    margin-top: 20rpx;
+    border: 1px solid #eee;
+    border-radius: 8rpx;
+  }
+
+  .param-select-item {
+    padding: 20rpx;
+    border-bottom: 1px solid #f5f5f5;
+    width: 100%;
+    &.active {
+      background-color: #e3f2fd;
+    }
+  }
+
+  .param-main {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    margin-bottom: 8rpx;
+  }
+
+  .param-name {
+    font-size: 28rpx;
+    font-weight: bold;
+    color: #333;
+  }
+
+  .param-code {
+    font-size: 24rpx;
+    color: #999;
+  }
+
+  .standard-input-box {
+    margin-top: 30rpx;
+    display: flex;
+    align-items: center;
+    .label {
+      width: 120rpx;
+      font-size: 28rpx;
+      color: #333;
+    }
+  }
+
+  .edit-info {
+    .edit-label {
+      display: block;
+      margin-bottom: 20rpx;
+      font-size: 28rpx;
+      color: #666;
+    }
+  }
+
+  .fab-button {
+    position: fixed;
+    right: 40rpx;
+    bottom: 60rpx;
+    width: 100rpx;
+    height: 100rpx;
+    background: #2979ff;
+    border-radius: 50%;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    box-shadow: 0 4rpx 12rpx rgba(41, 121, 255, 0.4);
+    z-index: 100;
+  }
+</style>
\ No newline at end of file

--
Gitblit v1.9.3