田源
2023-10-20 4f7aec5e212b9e2f2e006985ea76d6b8598b42e4
最大流水号功能实现
已修改4个文件
104 ■■■■ 文件已修改
Source/UBCS-WEB/src/api/code/maxSerialNum.js 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/api/code/maxSerialNum.js
@@ -17,13 +17,10 @@
    })
  }
export const getMaxSerialNumber = (codeRuleOid,secDTOList) => {
export const getMaxSerialNumber = (params) => {
  return request({
    url: '/api/ubcs-code/codeBasicSecController/getMaxSerialNumberForCodeRule',
    method: 'get',
    params:{
      codeRuleOid,
      secDTOList
    }
    params
  })
}
Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
@@ -101,6 +101,7 @@
  },
  data() {
    return {
      ValidataValue:false,
      eventFlag:{},
      TreeValueForm:'',
      updateIndex: 0,
@@ -131,6 +132,8 @@
  },
  mounted() {
    this.handleResize();
  },
  updated() {
  },
  created() {
    if (this.LoadingStatus === 'code') {
@@ -165,7 +168,7 @@
      },
      deep:true,
      immediate:true
    }
    },
  },
  methods: {
    // 渲染表单模板
@@ -510,6 +513,7 @@
          if (valid) {
            done();
            resolve(true);
            this.ValidataValue=true;
          } else {
            resolve(false);
          }
Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue
@@ -966,16 +966,5 @@
.bottom {
  margin-top: 10px;
}
//.custom-scrollbar::-webkit-scrollbar {
//  width: 10px  !important;;/* 设置滚动条的宽度 */
//}
//
//.custom-scrollbar::-webkit-scrollbar-thumb {
//  background-color: #a11313  !important;; /* 设置滚动条的颜色 */
//  border-radius: 5px  !important;; /* 设置滚动条的边框弧度 */
//}
//
//.custom-scrollbar::-webkit-scrollbar-track {
//  background-color: #f1f1f1  !important;; /* 设置滚动条的轨道颜色 */
//}
</style>
Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue
@@ -1,8 +1,8 @@
<template>
  <el-dialog title="最大流水号" width="30%" append-to-body="true" class="avue-dialog avue-dialog--top" top="-3%" :visible.sync="dialogVisible">
    <el-form :label-position="right" ref="ruleForm" label-width="80px" :model="formModel" :rules="rules">
    <el-form :label-position="right" ref="ruleForm" label-width="80px" :model="formModel" :rules="rules"  v-loading="loading">
      <el-form-item label="流水号" prop="maxSecNum">
        <el-input v-model="formModel.maxSecNum"></el-input>
        <el-input v-model="formModel.maxSecNum" @blur="handleBlur"></el-input>
      </el-form-item>
    </el-form>
    <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
@@ -52,10 +52,15 @@
      },
      immediate: true,
      deep: true
    }
    },
  },
   mounted() {
  },
  data() {
    return {
      loading:false,
      maxNum:Number,
      ruleFormFlag:Boolean,
      dialogVisible: this.visible,
      activeName: 'codePrice',
      confirmLoadding: false,
@@ -68,7 +73,17 @@
      },
      rules: {
        maxSecNum: [
          { required: true, message: '请输入流水号', trigger: 'blur' }
          { required: true, message: '请输入流水号', trigger: 'blur' },
          {
            validator: (rule, value, callback) => {
              if (value > this.maxNum) {
                callback(new Error('不能大于最大流水号'));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }
        ],
      },
      selfColumnType: {
@@ -110,6 +125,10 @@
    }
  },
  methods: {
    //清除正则
    handleBlur() {
      this.$refs.ruleForm.clearValidate('maxSecNum');
    },
    // 获取码段
    async apiGetCode() {
      this.activeName = "codeApply";
@@ -142,7 +161,45 @@
    },
    getCodeApplyFormData(codeApplyForm) {
      this.codeApplyForm = codeApplyForm;
      //最大流水Number
      const objcodekey = Object.keys(codeApplyForm)
      const filteredObj = objcodekey.reduce((acc, key) => {
        const pattern = /[\u4e00-\u9fa5]/; // 匹配中文字符的正则表达式
        const patterns = /\$/;
        if (!pattern.test(key)&&!patterns.test(key)) {
          acc[key] = this.codeApplyForm[key];
        }
        return acc;
      }, {});
      const arrCode = Object.entries(filteredObj).map(([key, value]) => {
        return {
          secOid: key,
          secValue: value
        }
      })
      this.ruleFormFlag = Object.values(codeApplyForm).every(value => {
        return value !== null && value !== undefined && value !== '';
      });
      if (this.ruleFormFlag && this.secVOList.length>0) {
        this.loading=true;
        let params = {};
        params['codeRuleOid'] = this.ruleOid;
        Object.keys(arrCode).forEach((key) => {
          params[key] = arrCode[key];
        });
        getMaxSerialNumber(params).then(res => {
          this.formModel.maxSecNum = res.data.data;
          this.loading=false;
          this.maxNum=res.data.data
        });
      }
    },
    // 取消
    cancel() {
      this.dialogVisible = false
@@ -172,10 +229,13 @@
      })
      this.formModel['secDTOList'] = arrCode
      this.formModel['codeRuleOid'] = this.ruleOid
      this.confirmLoadding = true
      const rule = await this.$refs.CodeApply.validate()
      this.confirmLoadding = true;
      // this.FormRule= await this.$refs.CodeApply.validate();
      const rule = await this.$refs.CodeApply.validate();
      // console.log(rule)
      this.$refs.ruleForm.validate(res => {
        if (rule && res) {
          // console.log(rule,res)
          saveMaxSerialNum(this.formModel).then(res => {
            if (res.data.success) {
              this.$message.success('操作成功!');
@@ -189,12 +249,6 @@
          this.confirmLoadding = false
        }
      })
      // let object={}
      // object['secDTOList'] = arrCode;
      // object['codeRuleOid'] = this.ruleOid;
      // getMaxSerialNumber(object.codeRuleOid,object.secDTOList).then(res=>{
      //   console.log(res)
      // })
    },
    // 参照组件数据变更