已修改5个文件
316 ■■■■ 文件已修改
src/api/productionManagement/productionReporting.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/config.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/manifest.json 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/index.vue 221 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/productionManagement/productionReport/index.vue 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/productionManagement/productionReporting.js
@@ -32,4 +32,13 @@
    method: "post",
    data: query,
  });
}
}
// 新增产品主表
export function addProductMain(data) {
  return request({
    url: "/productionProductMain/addProductMain",
    method: "post",
    data: data,
  });
}
src/config.js
@@ -1,12 +1,6 @@
// 应用全局配置
const config = {
  //  baseUrl: 'https://vue.ruoyi.vip/prod-api',
  // baseUrl: 'http://localhost/prod-api',
  baseUrl: 'http://114.132.189.42:9066', // 宁夏润泰
  // baseUrl: 'http://114.132.189.42:9068', // 新疆海川开心
  // baseUrl: 'http://192.168.1.147:9036',
   //cloud后台网关地址
  //  baseUrl: 'http://192.168.10.3:8080',
  baseUrl: 'http://1.15.17.182:9001', // 军泰伟业
   // 应用信息
   appInfo: {
     // 应用名称
src/manifest.json
@@ -1,6 +1,6 @@
{
    "name" : "润泰生物",
    "appid" : "__UNI__115F1B1",
    "name" : "军泰伟业",
    "appid" : "__UNI__082D16B",
    "description" : "",
    "versionName" : "1.0.0",
    "versionCode" : "100",
@@ -17,7 +17,10 @@
            "delay" : 0
        },
        /* 模块配置 */
        "modules" : {},
        "modules" : {
            "Barcode" : {},
            "Camera" : {}
        },
        /* 应用发布信息 */
        "distribute" : {
            /* android打包配置 */
src/pages/index.vue
@@ -18,7 +18,7 @@
    <view class="hero-section">
      <view class="bg-img">
        <view class="hero-content">
          <text class="hero-title">润泰生物科技</text>
          <text class="hero-title">军泰伟业</text>
        </view>
        <view class="hero-wave"></view>
      </view>
@@ -38,77 +38,77 @@
    <!--            </view>-->
    <!--        </view>-->
    <!-- 营销管理模块 -->
    <view class="common-module marketing-module">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">营销管理</text>
        </view>
      </view>
      <view class="module-content">
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in marketingItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container"
                  :style="{ background: item.bgColor }">
              <up-icon :name="item.icon"
                       :size="58"
                       color="#ffffff"></up-icon>
            </view>
            <text class="item-label">{{item.label}}</text>
          </up-grid-item>
        </up-grid>
      </view>
    </view>
    <!-- 采购管理模块 -->
    <view class="common-module purchase-module">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">采购管理</text>
        </view>
      </view>
      <view class="module-content">
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in purchaseItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container"
                  :style="{ background: item.bgColor }">
              <up-icon :name="item.icon"
                       :size="58"
                       color="#ffffff"></up-icon>
            </view>
            <text class="item-label">{{item.label}}</text>
          </up-grid-item>
        </up-grid>
      </view>
    </view>
    <!-- 协同办公模块 -->
    <view class="common-module collaboration-module">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">协同办公</text>
        </view>
      </view>
      <view class="module-content">
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in collaborationItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container"
                  :style="{ background: item.bgColor }">
              <up-icon :name="item.icon"
                       :size="58"
                       color="#ffffff"></up-icon>
            </view>
            <text class="item-label">{{item.label}}</text>
          </up-grid-item>
        </up-grid>
      </view>
    </view>
    <!--    <view class="common-module marketing-module">-->
    <!--      <view class="module-header">-->
    <!--        <view class="module-title-container">-->
    <!--          <text class="module-title">营销管理</text>-->
    <!--        </view>-->
    <!--      </view>-->
    <!--      <view class="module-content">-->
    <!--        <up-grid :border="false"-->
    <!--                 col="4">-->
    <!--          <up-grid-item v-for="(item, index) in marketingItems"-->
    <!--                        :key="index"-->
    <!--                        @click="handleCommonItemClick(item)">-->
    <!--            <view class="icon-container"-->
    <!--                  :style="{ background: item.bgColor }">-->
    <!--              <up-icon :name="item.icon"-->
    <!--                       :size="58"-->
    <!--                       color="#ffffff"></up-icon>-->
    <!--            </view>-->
    <!--            <text class="item-label">{{item.label}}</text>-->
    <!--          </up-grid-item>-->
    <!--        </up-grid>-->
    <!--      </view>-->
    <!--    </view>-->
    <!--    &lt;!&ndash; 采购管理模块 &ndash;&gt;-->
    <!--    <view class="common-module purchase-module">-->
    <!--      <view class="module-header">-->
    <!--        <view class="module-title-container">-->
    <!--          <text class="module-title">采购管理</text>-->
    <!--        </view>-->
    <!--      </view>-->
    <!--      <view class="module-content">-->
    <!--        <up-grid :border="false"-->
    <!--                 col="4">-->
    <!--          <up-grid-item v-for="(item, index) in purchaseItems"-->
    <!--                        :key="index"-->
    <!--                        @click="handleCommonItemClick(item)">-->
    <!--            <view class="icon-container"-->
    <!--                  :style="{ background: item.bgColor }">-->
    <!--              <up-icon :name="item.icon"-->
    <!--                       :size="58"-->
    <!--                       color="#ffffff"></up-icon>-->
    <!--            </view>-->
    <!--            <text class="item-label">{{item.label}}</text>-->
    <!--          </up-grid-item>-->
    <!--        </up-grid>-->
    <!--      </view>-->
    <!--    </view>-->
    <!--    &lt;!&ndash; 协同办公模块 &ndash;&gt;-->
    <!--    <view class="common-module collaboration-module">-->
    <!--      <view class="module-header">-->
    <!--        <view class="module-title-container">-->
    <!--          <text class="module-title">协同办公</text>-->
    <!--        </view>-->
    <!--      </view>-->
    <!--      <view class="module-content">-->
    <!--        <up-grid :border="false"-->
    <!--                 col="4">-->
    <!--          <up-grid-item v-for="(item, index) in collaborationItems"-->
    <!--                        :key="index"-->
    <!--                        @click="handleCommonItemClick(item)">-->
    <!--            <view class="icon-container"-->
    <!--                  :style="{ background: item.bgColor }">-->
    <!--              <up-icon :name="item.icon"-->
    <!--                       :size="58"-->
    <!--                       color="#ffffff"></up-icon>-->
    <!--            </view>-->
    <!--            <text class="item-label">{{item.label}}</text>-->
    <!--          </up-grid-item>-->
    <!--        </up-grid>-->
    <!--      </view>-->
    <!--    </view>-->
    <!-- 生产管控模块 -->
    <!--        <view class="common-module production-module">-->
    <!--            <view class="module-header">-->
@@ -163,29 +163,29 @@
      </view>
    </view>
    <!-- 设备管理模块 -->
    <view class="common-module equipment-module">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">设备管理</text>
        </view>
      </view>
      <view class="module-content">
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in equipmentItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container"
                  :style="{ background: item.bgColor }">
              <up-icon :name="item.icon"
                       :size="58"
                       color="#ffffff"></up-icon>
            </view>
            <text class="item-label">{{item.label}}</text>
          </up-grid-item>
        </up-grid>
      </view>
    </view>
    <!--    <view class="common-module equipment-module">-->
    <!--      <view class="module-header">-->
    <!--        <view class="module-title-container">-->
    <!--          <text class="module-title">设备管理</text>-->
    <!--        </view>-->
    <!--      </view>-->
    <!--      <view class="module-content">-->
    <!--        <up-grid :border="false"-->
    <!--                 col="4">-->
    <!--          <up-grid-item v-for="(item, index) in equipmentItems"-->
    <!--                        :key="index"-->
    <!--                        @click="handleCommonItemClick(item)">-->
    <!--            <view class="icon-container"-->
    <!--                  :style="{ background: item.bgColor }">-->
    <!--              <up-icon :name="item.icon"-->
    <!--                       :size="58"-->
    <!--                       color="#ffffff"></up-icon>-->
    <!--            </view>-->
    <!--            <text class="item-label">{{item.label}}</text>-->
    <!--          </up-grid-item>-->
    <!--        </up-grid>-->
    <!--      </view>-->
    <!--    </view>-->
  </view>
</template>
@@ -533,19 +533,24 @@
        let orderRow = "";
        // 尝试从扫码结果中提取orderRow参数
        // 假设二维码内容是JSON格式或URL参数格式
        try {
          // 检查是否是JSON格式
          const parsedData = JSON.parse(scanResult);
          if (parsedData.orderRow) {
            orderRow = parsedData.orderRow;
          }
          // 处理混合格式: http://...?orderRow={...}
          const orderRowStart = scanResult.indexOf("orderRow={");
          // 提取从orderRow={开始的JSON内容
          const jsonPart = scanResult.substring(orderRowStart + 9); // 9是"orderRow=".length
          // 尝试直接使用这个JSON部分
          orderRow = jsonPart;
        } catch (e) {
          // 检查是否是URL参数格式,如 orderRow=12345
          const params = new URLSearchParams(scanResult);
          orderRow = params.get("orderRow") || "";
          console.error(e, "解析失败====????=====");
          orderRow = "";
        }
        console.log(orderRow, "orderRow======@@@@@@@@");
        try {
          JSON.parse(orderRow);
        } catch (error) {
          modal.msgError("订单解析失败");
          return;
        }
        // 扫码成功后跳转到生产报工页面,并传递orderRow参数
        uni.navigateTo({
          url: `/pages/productionManagement/productionReport/index?orderRow=${orderRow}`,
@@ -556,9 +561,9 @@
          title: "扫码失败",
          icon: "none",
        });
        uni.navigateTo({
          url: `/pages/productionManagement/productionReport/index`,
        });
        // uni.navigateTo({
        //   url: `/pages/productionManagement/productionReport/index`,
        // });
      },
    });
  };
src/pages/productionManagement/productionReport/index.vue
@@ -12,20 +12,23 @@
      <!-- 基本信息 -->
      <view class="form-section">
        <u-form-item label="待生产数量"
                     prop="remainingQuantity"
                     prop="planQuantity"
                     required>
          <u-input v-model="form.remainingQuantity"
          <u-input v-model="form.planQuantity"
                   placeholder="自动填充"
                   disabled />
        </u-form-item>
        <u-form-item label="本次生产数量"
                     prop="quantity"
                     required>
          <u-number-box v-model="form.quantity"
          <u-input v-model="form.quantity"
                   placeholder="请输入"
                   type="number" />
          <!-- <u-number-box v-model="form.quantity"
                        step="0.1"
                        bgColor="#fff"
                        decimal-length="1"
                        :min="0"></u-number-box>
                        :min="0"></u-number-box> -->
        </u-form-item>
        <u-form-item label="班组信息"
                     prop="schedulingUserId"
@@ -53,6 +56,7 @@
<script setup>
  import { ref, onMounted } from "vue";
  import { onLoad } from "@dcloudio/uni-app";
  import FooterButtons from "@/components/FooterButtons.vue";
  const showToast = message => {
@@ -61,10 +65,7 @@
      icon: "none",
    });
  };
  import { formatDateToYMD } from "@/utils/ruoyi";
  import { userListNoPageByTenantId } from "@/api/system/user";
  import { productionReport } from "@/api/productionManagement/productionReporting";
  import { addProductMain } from "@/api/productionManagement/productionReporting";
  import { getInfo } from "@/api/login";
  // 表单引用
@@ -72,7 +73,7 @@
  // 表单数据
  let form = ref({
    remainingQuantity: 0,
    planQuantity: 0,
    quantity: 0,
    userName: "",
    workOrderId: "",
@@ -105,7 +106,6 @@
  const goBack = () => {
    uni.navigateBack();
  };
  const parsedOrderRow = ref({});
  // 提交表单
  const submitForm = async () => {
    submitting.value = true;
@@ -115,17 +115,20 @@
      showToast("请输入本次生产数量");
      return;
    }
    if (form.value.quantity > form.value.remainingQuantity) {
    if (form.value.quantity > form.value.planQuantity) {
      submitting.value = false;
      showToast("本次生产数量不能大于待生产数量");
      return;
    }
    console.log(form.value, "form.value");
    addProductMain(reportForm).then(res => {
    addProductMain(form.value).then(res => {
      if (res.code === 200) {
        showToast("报工成功");
        submitting.value = false;
        goBack();
        setTimeout(() => {
          goBack();
        }, 1000);
      } else {
        showToast(res.msg || "报工失败");
        submitting.value = false;
@@ -134,26 +137,26 @@
  };
  // 页面加载时初始化数据
  onMounted(() => {
    // 获取传递过来的orderRow参数
    const pages = getCurrentPages();
    const currentPage = pages[pages.length - 1];
    const orderRow = currentPage.options.orderRow;
    form.value.remainingQuantity = 1;
    if (orderRow) {
      parsedOrderRow.value = JSON.parse(orderRow);
      form.value.quantity = parsedOrderRow.value.quantity;
      form.value.productProcessRouteItemId =
        parsedOrderRow.value.productProcessRouteItemId;
      form.value.workOrderId = parsedOrderRow.value.id;
      form.value.reportWork = parsedOrderRow.value.reportWork;
      form.value.productMainId = parsedOrderRow.value.productMainId;
  onLoad(options => {
    console.log(options, "options");
    try {
      const orderRow = JSON.parse(options.orderRow);
      console.log(orderRow, "orderRow======########");
      form.value.planQuantity = orderRow.planQuantity;
      form.value.quantity = orderRow.quantity;
      form.value.productProcessRouteItemId = orderRow.productProcessRouteItemId;
      form.value.workOrderId = orderRow.id;
      form.value.reportWork = orderRow.reportWork;
      form.value.productMainId = orderRow.productMainId;
      getInfo().then(res => {
        form.value.userId = res.user.userId;
        form.value.userName = res.user.userName;
      });
    } catch (error) {
      modal.msgError("订单解析失败");
      goBack();
      return;
    }
    getInfo().then(res => {
      form.value.userId = res.user.userId;
      form.value.userName = res.user.userName;
    });
  });
</script>