返回博客

若依模板布局设计

记录若依后台模板的布局调整、样式改写与常用代码片段。

oakenoaken2026年6月18日约 1 分钟
若依模板布局设计
/**
 * 生成工单编号
 */
@Override
public String genTaskNo(){
    // 1.获取当前时间
    String currentDate = DateTimeFormatter.ofPattern("yyyyMMdd").format(LocalDate.now());
    // 2.查询数据库中该前缀的当前日期的最大单据编号
    String prefix = "TNo.";
    String maxTaskNo = cmsTaskMapper.findCmsTaskMaxTaskNo(prefix, currentDate);
    // 3.初始化单据编号
    String newTaskNo = prefix + currentDate + "001";
    // 4.判断是否已存在
    if (StringUtils.isNotEmpty(maxTaskNo)){
        int serialStartIndex = prefix.length() + 8;
        String numberPart = maxTaskNo.substring(serialStartIndex);
        int number = Integer.parseInt(numberPart);
        number++;
        newTaskNo = prefix + currentDate + String.format("%03d", number);
    }
    return newTaskNo;
}
<el-table-column label="生效状态" align="center" prop="beffect" width="100">
  <template slot-scope="scope">
    <span slot="reference" v-if="scope.row.beffect == 1">
      <i class="dotClass" style="background-color: springgreen;width:10px;height:10px;border-radius:50%;display:block"></i>
    </span>
    <span slot="reference" v-if="scope.row.beffect == 0">
      <i class="dotClass" style="background-color: red;width:10px;height:10px;border-radius:50%;display:block"></i>
    </span>
  </template>
</el-table-column>

若依样式

// to fix style
.el-form-search {
  float: right;
  .el-form-search-item {
    margin-bottom: 0px;
    .el-input__inner {
      width: 140px;
    }
  }
}

.el-define-box {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.row-flex-middle {
  display: flex;
  align-items: center;
}
若依VueDevOps