huminmin
5 天以前 62294084c9c35d35594e9f2d6c41342ae84e9526
src/views/basicData/product/index.vue
@@ -112,6 +112,19 @@
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="24">
            <el-form-item label="标准数量:"
                          prop="standardQuantity">
              <el-input v-model="form.standardQuantity"
                        type="number"
                        :step="0.001"
                        placeholder="请输入产品标准数量"
                        clearable
                        @keydown.enter.prevent />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
@@ -331,11 +344,29 @@
  const data = reactive({
    form: {
      productName: "",
      standardQuantity: null,
    },
    rules: {
      productName: [
        { required: true, message: "请输入", trigger: "blur" },
        { max: 20, message: "产品名称不能超过20个字符", trigger: "blur" },
      ],
      standardQuantity: [
        {
          required: false,
          trigger: "blur",
          validator: (rule, value, callback) => {
            if (value == null || value === "") {
              callback();
              return;
            }
            if (isNaN(value) || value < 0) {
              callback(new Error("标准数量必须是非负数字"));
            } else {
              callback();
            }
          },
        },
      ],
    },
    modelForm: {
@@ -412,6 +443,8 @@
    productDia.value = true;
    form.value.productName =
      type === "edit" && data ? data.productName : "";
    form.value.standardQuantity =
      type === "edit" && data ? data.standardQuantity : null;
  };
  // 打开规格型号弹框
  const openModelDia = (type, data) => {