广丰卷烟厂数采质量分析系统
zhuguifei
2026-03-04 63b4909ac5d0b7355be211cc7080673b41cdb3cc
ruoyi-plus-soybean/src/views/analy/roller/modules/roller-data-operate-drawer.vue
@@ -1,9 +1,9 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue';
import { jsonClone } from '~/packages/utils';
import { fetchCreateRollerData, fetchUpdateRollerData } from '@/service/api/analy/roller-data';
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
import { $t } from '@/locales';
import { jsonClone } from '~/packages/utils';
defineOptions({
  name: 'RollerDataOperateDrawer'
@@ -45,36 +45,32 @@
function createDefaultModel(): Model {
  return {
      time: null,
      key: '',
      online: null,
      qty: null,
      badQty: null,
      lvbangVal: null,
      juanyanzhiVal: null,
      shuisongzhiVal: null,
      runTime: null,
      stopTime: null,
      stopTimes: null,
      speed: null,
      runStatus: null,
      cy: null,
      cyCs: null,
      cyOnline: '',
      recQty1: null,
      recQty2: null
    time: null,
    key: '',
    online: null,
    qty: null,
    badQty: null,
    lvbangVal: null,
    juanyanzhiVal: null,
    shuisongzhiVal: null,
    runTime: null,
    stopTime: null,
    stopTimes: null,
    speed: null,
    runStatus: null,
    cy: null,
    cyCs: null,
    cyOnline: '',
    recQty1: null,
    recQty2: null
  };
}
type RuleKey = Extract<
  keyof Model,
  | 'time'
  | 'key'
>;
type RuleKey = Extract<keyof Model, 'time' | 'key'>;
const rules: Record<RuleKey, App.Global.FormRule> = {
  time: createRequiredRule('时间不能为空'),
  key: createRequiredRule('key不能为空'),
  key: createRequiredRule('key不能为空')
};
function handleUpdateModelWhenEdit() {
@@ -92,16 +88,73 @@
async function handleSubmit() {
  await validate();
  const { time, key, online, qty, badQty, lvbangVal, juanyanzhiVal, shuisongzhiVal, runTime, stopTime, stopTimes, speed, runStatus, cy, cyCs, cyOnline, recQty1, recQty2 } = model.value;
  const {
    time,
    key,
    online,
    qty,
    badQty,
    lvbangVal,
    juanyanzhiVal,
    shuisongzhiVal,
    runTime,
    stopTime,
    stopTimes,
    speed,
    runStatus,
    cy,
    cyCs,
    cyOnline,
    recQty1,
    recQty2
  } = model.value;
  // request
  if (props.operateType === 'add') {
    const { error } = await fetchCreateRollerData({ time, key, online, qty, badQty, lvbangVal, juanyanzhiVal, shuisongzhiVal, runTime, stopTime, stopTimes, speed, runStatus, cy, cyCs, cyOnline, recQty1, recQty2 });
    const { error } = await fetchCreateRollerData({
      time,
      key,
      online,
      qty,
      badQty,
      lvbangVal,
      juanyanzhiVal,
      shuisongzhiVal,
      runTime,
      stopTime,
      stopTimes,
      speed,
      runStatus,
      cy,
      cyCs,
      cyOnline,
      recQty1,
      recQty2
    });
    if (error) return;
  }
  if (props.operateType === 'edit') {
    const { error } = await fetchUpdateRollerData({ time, key, online, qty, badQty, lvbangVal, juanyanzhiVal, shuisongzhiVal, runTime, stopTime, stopTimes, speed, runStatus, cy, cyCs, cyOnline, recQty1, recQty2 });
    const { error } = await fetchUpdateRollerData({
      time,
      key,
      online,
      qty,
      badQty,
      lvbangVal,
      juanyanzhiVal,
      shuisongzhiVal,
      runTime,
      stopTime,
      stopTimes,
      speed,
      runStatus,
      cy,
      cyCs,
      cyOnline,
      recQty1,
      recQty2
    });
    if (error) return;
  }
@@ -131,12 +184,7 @@
          />
        </NFormItem>
        <NFormItem label="key" path="key">
          <NInput
            v-model:value="model.key"
            :rows="3"
            type="textarea"
            placeholder="请输入key"
          />
          <NInput v-model:value="model.key" :rows="3" type="textarea" placeholder="请输入key" />
        </NFormItem>
        <NFormItem label="网络状态" path="online">
          <NInputNumber v-model:value="model.online" placeholder="请输入网络状态" class="w-full" />
@@ -182,12 +230,7 @@
          <NInputNumber v-model:value="model.cyCs" placeholder="请输入储烟设备车速" class="w-full" />
        </NFormItem>
        <NFormItem label="储烟设备网络" path="cyOnline">
          <NInput
            v-model:value="model.cyOnline"
            :rows="3"
            type="textarea"
            placeholder="请输入储烟设备网络"
          />
          <NInput v-model:value="model.cyOnline" :rows="3" type="textarea" placeholder="请输入储烟设备网络" />
        </NFormItem>
        <NFormItem label="接收机产量" path="recQty1">
          <NInputNumber v-model:value="model.recQty1" placeholder="请输入接收机产量" class="w-full" />