ZN
22 小时以前 87fce896046ec8e804810f75a90a62a5986e67ed
fix: 修正端口号、消息页签索引及生产报告表单字段

- 将API基础URL和文件URL端口从9003更新为9023
- 修正消息标签页索引从2改为1,确保角标显示正确
- 重构生产报告表单,拆分班组信息和审核人为独立字段
- 移除从首页跳转时的默认用户填充逻辑,优化表单初始化流程
已修改4个文件
82 ■■■■ 文件已修改
src/config.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/login.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/message.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/productionManagement/productionReport/index.vue 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/config.js
@@ -1,7 +1,7 @@
// 应用全局配置
const config = {
  baseUrl: 'http://1.15.17.182:9003',
  fileUrl: 'http://1.15.17.182:9003',
  baseUrl: 'http://1.15.17.182:9023',
  fileUrl: 'http://1.15.17.182:9023',
   // 应用信息
   appInfo: {
     // 应用名称
src/pages/login.vue
@@ -201,12 +201,12 @@
        // 更新tabbar的角标
        if (count > 0) {
          uni.setTabBarBadge({
            index: 2, // 消息标签页的索引
            index: 1, // 消息标签页的索引
            text: count.toString(),
          });
        } else {
          uni.removeTabBarBadge({
            index: 2,
            index: 1,
          });
        }
      })
src/pages/message.vue
@@ -239,12 +239,12 @@
          // 更新tabbar的角标
          if (count > 0) {
            uni.setTabBarBadge({
              index: 2, // 消息标签页的索引
              index: 1, // 消息标签页的索引
              text: count.toString(),
            });
          } else {
            uni.removeTabBarBadge({
              index: 2,
              index: 1,
            });
          }
        })
src/pages/productionManagement/productionReport/index.vue
@@ -31,13 +31,16 @@
                   placeholder="请输入"
                   type="number" />
        </u-form-item>
        <u-form-item label="班组信息"
                     prop="schedulingUserId"
        <!-- 班组信息和审核人 -->
        <u-form-item v-for="(item, key) in pickerFields"
                     :key="key"
                     :label="item.label"
                     :prop="key + '.name'"
                     required>
          <u-input v-model="form.userName"
                   placeholder="请选择生产人"
          <u-input v-model="form[key].name"
                   :placeholder="form[key].name ? '已选择: ' + form[key].name : '请选择' + item.label"
                   readonly
                   @click="openProducerPicker"
                   @click="openProducerPicker(key)"
                   suffix-icon="arrow-down" />
        </u-form-item>
      </view>
@@ -76,23 +79,29 @@
  const formRef = ref();
  // 表单数据
  let form = ref({
  const form = ref({
    planQuantity: "",
    quantity: "",
    scrapQty: "",
    userName: "",
    workOrderId: "",
    productProcessRouteItemId: "",
    userId: "",
    schedulingUserId: "",
    userId: { value: "", name: "" }, // 班组信息
    auditUserId: { value: "", name: "" }, // 审核人
  });
  // 这里的字段配置用于模版循环
  const pickerFields = {
    userId: { label: "班组信息" },
    auditUserId: { label: "审核人" },
  };
  // 生产人选择器状态
  const showProducerPicker = ref(false);
  const producerList = ref([]);
  const currentField = ref(""); // 当前选择的字段
  // 打开生产人选择器
  const openProducerPicker = async () => {
  const openProducerPicker = async (field) => {
    if (producerList.value.length === 0) {
      // 如果列表为空,先加载用户列表
      try {
@@ -100,7 +109,7 @@
        const users = res.data || [];
        // 转换为 action-sheet 需要的格式
        producerList.value = users.map(user => ({
          name: user.nickName || user.userName,
          name: user.nickName || "",
          value: user.userId,
        }));
      } catch (error) {
@@ -110,13 +119,15 @@
      }
    }
    showProducerPicker.value = true;
    currentField.value = field; // 保存当前字段
  };
  // 生产人选择确认
  const onProducerConfirm = e => {
    form.value.schedulingUserId = e.value;
    form.value.userName = e.name;
    form.value.userId = e.value; // 同时更新 userId
    if (currentField.value && form.value[currentField.value]) {
      form.value[currentField.value].value = e.value;
      form.value[currentField.value].name = e.name ;
    }
    showProducerPicker.value = false;
  };
@@ -136,9 +147,14 @@
      showToast("请输入本次生产数量");
      return;
    }
    if (!form.value.schedulingUserId) {
    if (!form.value.userId.value) {
      submitting.value = false;
      showToast("请选择生产人");
      showToast("请选择班组信息");
      return;
    }
    if (!form.value.auditUserId.value) {
      submitting.value = false;
      showToast("请选择审核人");
      return;
    }
    // 转换为数字进行比较
@@ -162,6 +178,9 @@
      quantity: Number(form.value.quantity),
      scrapQty: Number(form.value.scrapQty) || 0,
      planQuantity: Number(form.value.planQuantity) || 0,
      userId: form.value.userId.value,
      auditUserId: form.value.auditUserId.value,
      schedulingUserId: form.value.userId.value, // 兼容旧字段
    };
    console.log(submitData, "submitData");
@@ -181,31 +200,16 @@
  // 页面加载时初始化数据
  onLoad(options => {
    console.log(options, "options");
    // 如果没有 orderRow 参数,说明是从首页直接跳转,需要用户手动选择订单
    if (!options.orderRow) {
      console.log("从首页跳转,无订单数据");
      getInfo().then(res => {
        // 默认使用当前登录用户
        form.value.userId = res.user.userId;
        form.value.userName = res.user.userName;
        form.value.schedulingUserId = res.user.userId;
      });
      return;
    }
    try {
      const orderRow = JSON.parse(options.orderRow);
      console.log("构造的orderRow:", orderRow);
      console.log(orderRow, "orderRow======########");
      // 确保 planQuantity 转换为字符串,以便在 u-input 中正确显示
      form.value.planQuantity = orderRow.planQuantity != null ? String(orderRow.planQuantity) : "";
      form.value.productProcessRouteItemId = orderRow.productProcessRouteItemId || "";
      form.value.workOrderId = orderRow.id || "";
      getInfo().then(res => {
        // 默认使用当前登录用户,但允许用户修改
        form.value.userId = res.user.userId;
        form.value.userName = res.user.userName;
        form.value.schedulingUserId = res.user.userId;
        form.value.userId.value = res.user.userId;
        form.value.userId.name = res.user.nickName;
      });
      // 使用 nextTick 确保 DOM 更新
      nextTick(() => {