傅豪杰 1 سال پیش
والد
کامیت
8c52daf12c

+ 23 - 15
ruoyi-ui/src/baseComponents/f-form/index.vue

@@ -4,7 +4,7 @@
     :key="update" 
     :rules="rules" 
     class="flex-wrap f-form" 
-    :class="text ? 'text' : ''"
+    :class="{text:text,required:required}"
     :model="form"
     :label-position="labelPosition">
     <el-form-item
@@ -97,6 +97,11 @@ export default {
     online:{
       type:Boolean,
       default:false
+    },
+    // 是否有必填
+    required:{
+      type:Boolean,
+      default:false
     }
   },
   data() {
@@ -213,7 +218,7 @@ export default {
       // 增加rules为入参,判断当前项是否有必填校验,如果有那么width加上11px;
       const val = this.labelWidth.find((e) => e.indexList.includes(index));
       const rulesWidth = val.hasRules ? 11 : 0;
-      return val.nameLength * 14 + rulesWidth + 16 + 'px';
+      return val.nameLength * 14 + rulesWidth + 16 + 10 + 'px';
     },
     // 将字符串转为16进制值,汉子转4位,英文字母和数组转2位
     charCode: (str) =>
@@ -264,21 +269,24 @@ export default {
 };
 </script>
 <style lang="scss" scoped>
-.f-form .el-form-item {
-  margin-bottom: 25px;
-  display: inline-block;
+.f-form{
+    &.required  .el-form-item:not(.is-required) ::v-deep.el-form-item__label{
+      padding-left: 9px;
+      box-sizing: border-box;
+    }
+   .el-form-item {
+    margin-bottom: 25px;
+    display: inline-block;
     padding-right: 8px;
-  // display: flex;
-  // align-items: center;
-  .el-change-icon {
-    transform: rotate(90deg);
-  }
-  .el-form-item_custom {
-    cursor: pointer;
-    i {
-      margin-left: 2px;
+    .el-change-icon {
+      transform: rotate(90deg);
+    }
+    .el-form-item_custom {
+      cursor: pointer;
+      i {
+        margin-left: 2px;
+      }
     }
   }
 }
-
 </style>

+ 1 - 0
ruoyi-ui/src/views/base/addBase/blocks/detailDialog.vue

@@ -17,6 +17,7 @@
         :rules="fromRules"
         label-position="left"
         :column="2"
+        required
         :key="fromKey"
       />
     </template>

+ 1 - 0
ruoyi-ui/src/views/template/addButton/blocks/detailDialog.vue

@@ -17,6 +17,7 @@
         :rules="fromRules"
         label-position="left"
         :column="2"
+        required
         :key="fromKey"
       />
     </template>

+ 2 - 0
ruoyi-ui/src/views/template/addTemplate/blocks/detailDialog.vue

@@ -101,6 +101,7 @@
                   :rules="btnRules"
                   label-position="left"
                   :column="1"
+                  required
                   @change="handleBtnFormChange"
                 />
               </el-tab-pane>
@@ -112,6 +113,7 @@
                   :config="btnClassConfig"
                   label-position="left"
                   :column="1"
+                  required
                   @blur="handleBlur"
                 />
               </el-tab-pane>